Welcome back to the oneAPI channel. Using SciKit-learn for classification,
regression, clustering, dimension reduction or any other algorithm?
How about running it 3 4 X and sometimes 20 or 100x faster
Using the same code… on Intel CPU or even GPU In previous videos we have talked
about the oneAPI components. About the languages, tools and libraries,
That can now work on multiple devices, what we call XPUs..
And are arranged into toolkits, for example the base toolkit
But also many other toolkits The intel AI Analytics toolkit,
is one of them.. And it has many tools, resources and utilities
as you can see in the dedicated video to the AI toolkit
You can find here optimized Deep Learning frameworks
And many other python packages for data-analysis,
machine learning and data preparation The Intel extension for Scikit-Learn is part
of the AI toolkit starting 2021.3 version, but you can get it separately as well.
you can use your scikit-learn algorithms the same way as today,
but they'll run even faster with the Intel extension.
The only thing you have to do is to get The intel extensions for SciKit-learn
and add 2 lines of code to patch the stock scikit-learn
I have seen intel scikit learn accelerating algorithms by 20, 40 x and sometimes more
We are able to achieve this acceleration because under the hood we are using the oneAPI oneDAL
Data-Analytic library and other optimizations
Look for the dedicated video on oneDAL to learn more
There are multiple ways to get the intel extension for scikit-learn.
Maybe the easiest way to try it is to log in to the Intel dev-cloud.
Few clicks and you are getting an installed, ready to work environment
with sample code on the latest intel HW. Installing the AI-tookit is my preferred way,
just follow these QR codes. A good resource is the intel
scikit-learn extension git hub.. You can find here documentations,
articles to read, and how to get started on CPU or on a GPU
And this is the full documentation You can read here all the explanations,
In the “get started” page, you can see how to download and patch
In the “supported algorithms” you can see
which algorithms are supported, and with which parameters
And last, I’d like to show you a quick example.. I already have the AI-toolkit installed,
And I’ll use a pixel-wise Vector color Quantization using K-mean
I’ll run the original K-mean notebook Let’s run all the cells
This is the original image, 96 thousand colors And the quantized image, only 128 color
Here you can see that I calculate the time it took to perform the Clustering with K-mean
I call it t_1 and store it And the time to predict the color
indices, called t_2.. And we store it And now I’ll run exactly the same code
Let’s duplicate the notebook And open it..
Now all I have to do is to get the intel extension and patch my scikit-learn
I will run the same code, but let’s call this t1_ex for extension and t2_ex
And run the notebook Images are created
Now I open the compare notebook And basically I read t1 and t1_ex,
t2 and t2_ex and compare the timing Let’s run the full notebook
And you can see that with zero effort, I got the fitting to run 3x faster on a small sub
sample of the image and 4x on the full image. Performance will of course vary depending on
the algorithm you are performing, the data size and the system used..
Install the AI-toolkit, or just get the Intel extension for scikit-learn
and boost your performance, using the same code, on CPU or on intel GPU
Subscribe to the cannel to get more videos like this one
Thank you