Intel® Extension for Scikit-learn* Cheat Sheet

author-image

By

Get started with Intel® Extension for Scikit-learn* using the following commands.

For more information, see Intel Extension for Scikit-learn.

Basic Installation Using PyPI*

pip install scikit-learn-intelex

Basic Installation Using Anaconda*

conda install scikit-learn-intelex

Import Intel Extension for Scikit-Learn*

import sklearnex

Turn On Intel Extension for Scikit-Learn Optimizations (in the Code): All Supported Algorithms

from sklearnex import patch_sklearn

patch_sklearn()

Turn Off Intel Extension for Scikit-Learn Optimizations in the Code: All Supported Algorithms

from sklearnex import patch_sklearn

unpatch_sklearn()

Turn On Intel Extension for Scikit-Learn* Optimizations (Command Prompt): All Supported Algorithms

python -m sklearnex my_application.py

Turn On Optimizations for a Specific scikit-learn Algorithm

Note This example uses SVC.

from sklearnex import patch_sklearn

#the names match scikit-learn estimators

patch_sklearn(‘SVC’)

Turn Off Optimizations for a Specific scikit-learn Algorithm

Note This example uses SVC.

from sklearnex import patch_sklearn

unpatch_sklearn(‘SVC’)

Turn On Optimizations for Multiple Specific scikit-learn Algorithms

Note This example uses SVC and DBSCAN.

from sklearnex import patch_sklearn

#the names match scikit-learn estimators

patch_sklearn([‘SVC’, ‘DBSCAN’])

Turn Off Optimizations for Multiple Specific scikit-learn* Algorithm

Note This example uses SVC and DBSCAN.

from sklearnex import patch_sklearn

unpatch_sklearn([‘SVC’, ‘DBSCAN’])

Turn On Global Patching (Command Prompt)

python sklearnex.glob patch_sklearn

Turn Off Global Patching (Command Prompt)

python sklearnex.glob unpatch_sklearn

Turn On Global Patching for a Specific scikit-learn Algorithm (Command Prompt)
Note This example uses SVC.

python sklearnex.glob patch_sklearn -a svc random_forest_classifier

 

Turn On Global Patching (in the Code)

from sklearnex import patch_sklearn

patch_sklearn(global_patch=True)

Turn Off Global Patching (in the Code)

from sklearnex import unpatch_sklearn

unpatch_sklearn(global_patch=True)

For more information and support, or to report any issues, see the AI Tools from Intel forum.

Sign up and try this extension for free using Intel® Developer Cloud for oneAPI.