Intel® Extension for Scikit-Learn* Getting Started Guide

Published: 07/05/2021  

Last Updated: 07/05/2021

By Rachel Oberman

About Intel® Extension For Scikit-Learn*

Designed for data scientists, Intel® Extension for Scikit-Learn* is a seamless way to speed up your Scikit-learn applications for machine learning to solve real-world problems. This extension package dynamically patches scikit-learn estimators to use Intel® oneAPI Data Analytics Library (oneDAL) as the underlying solver, while achieving the speed up for your machine learning algorithms.
Previously, these scikit-learn patch optimizations were available through daal4py, the Python API for Intel® oneAPI Data Analytics Library. All future updates for these patches for scikit-learn* will be available only in Intel® Extension for Scikit-learn. We recommend you to use Intel® Extension for Scikit-Learn* instead of daal4py.

Before You Begin

Please note that if you already have one of the latest versions of the scikit-learn* package installed, you do not need to remove or re-install it. Once enabled, Intel® Extension for Scikit-Learn* will seamlessly accelerate your existing scikit-learn* package.

If you do not already have scikit-learn* installed with your setup, upon installation Intel® Extension for Scikit-Learn will install a compatible version of scikit-learn* that can be used along with it.
For more information on which versions of scikit-learn* support Intel® Extension for Scikit-Learn, please review the Intel® Extension for Scikit-Learn* patching documentation.

Supported Installation Options

Install via Intel® oneAPI AI Analytics Toolkit

Intel® oneAPI AI Analytics Toolkit includes Scikit-Learn* alongside Intel® Extension for Scikit-Learn*. There are multiple ways to get the toolkit and its components. It is distributed through several channels – Anaconda, Docker containers, Package managers (Yum, Apt, Zypper) and an online / offline installer from Intel. To download Intel® Extension for Scikit-Learn* from the Intel® oneAPI AI Analytics Toolkit, visit here and choose the installation method of your choice. You can find more detailed information about the toolkit here.

Install via Individual Component

There are multiple options to only install Intel® Extension for Scikit-Learn*.
Linux*, Windows*, and MacOS* are supported (x86 architecture only) - see more details on the Intel® Extension for Scikit-Learn* Getting Started Documentation.

Install from Anaconda:

  • Conda-Forge channel (recommended for users by defaut):
    сonda install scikit-learn-intelex -c conda-forge
  • Intel channel (recommended for Intel® Distribution for Python users):
    conda install scikit-learn-intelex -c intel
  • Defaults channel (recommended for users that prefer the main channel):
    conda install scikit-learn-intelex

Install from PyPI:

pip install scikit-learn-intelex

Build From Source

To build Intel® Extension for Scikit-Learn* from source, please see the "Build From Source" instructions from the Intel® Extension for Scikit-Learn* documentation.

Getting Started with Intel® Extension for Scikit-Learn*: Usage and Sanity Check

There are a few ways to enable the Intel® Extension for Scikit-Learn* Optimizations:

  • Command line:
    python -m sklearnex my_application.py
  • Or from your Python* script by patching Scikit-Learn* dynamically:
    from sklearnex import patch_sklearn
    patch_sklearn()

     

  • To patch individual Scikit-Learn* algorithms, just import the specific Scikit-Learn* estimator you would like to optimized and use it
    # from sklearn.svm import SVC
    from sklearnex.svm import SVC
    
    # normal code without any more changes

     

These methods can also be used as a sanity check that Intel® Extension for Scikit-Learn* is properly installed, as a warning should generate after usage telling the user that Intel® Extension for Scikit-Learn* accelerations have been enabled.

Support

If you have further questions or need support on your workload optimization, please submit your queries to the Intel® AI Analytics Toolkit Forum or Intel Extension for Scikit-Learn* GitHub, on the Issues or Discussions pages depending on the type of support required.

Useful Resources

Notices and Disclaimers

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex​​.  

Performance results are based on testing as of dates shown in configurations and may not reflect all publicly available ​updates.  See backup for configuration details.  No product or component can be absolutely secure. 

Your costs and results may vary. 

Intel technologies may require enabled hardware, software or service activation.

© Intel Corporation.  Intel, the Intel logo, and other Intel marks are trademarks of Intel Corporation or its subsidiaries.  Other names and brands may be claimed as the property of others.  ​

Product and Performance Information

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.

Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.