<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Dmitry Kalyanov on Medium]]></title>
        <description><![CDATA[Stories by Dmitry Kalyanov on Medium]]></description>
        <link>https://medium.com/@kalyanowdima?source=rss-34f9c1a27716------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*2mG6VTbLTiMqO94IgY_vlg.jpeg</url>
            <title>Stories by Dmitry Kalyanov on Medium</title>
            <link>https://medium.com/@kalyanowdima?source=rss-34f9c1a27716------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 02:46:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kalyanowdima/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Leverage Intel Optimizations in Scikit-Learn]]></title>
            <link>https://medium.com/intel-analytics-software/leverage-intel-optimizations-in-scikit-learn-f562cb9d5544?source=rss-34f9c1a27716------2</link>
            <guid isPermaLink="false">https://medium.com/p/f562cb9d5544</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[support-vector-machine]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[scikit-learn]]></category>
            <dc:creator><![CDATA[Dmitry Kalyanov]]></dc:creator>
            <pubDate>Thu, 20 May 2021 18:58:28 GMT</pubDate>
            <atom:updated>2021-06-24T14:40:16.370Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cqdvd1CzVrws3Xyj" /><figcaption>Photo by <a href="https://unsplash.com/@milancsizmadia?utm_source=medium&amp;utm_medium=referral">Milan Csizmadia</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>Artificial Intelligence</h4><h4>Better SVM Performance for Model Training and Inference</h4><p>Support vector machines (SVM) is a machine learning (ML) algorithm that achieves high accuracy for many practical tasks. However, the quadratic complexity of the algorithm makes SVM a compute-intensive approach, so it is important to use an optimized software stack. In this blog, I will compare ML software for CPUs and GPUs using publicly available datasets running on different AWS EC2 instances.</p><p>I showed in a previous blog that <a href="https://github.com/intel/scikit-learn-intelex">Intel Extension for Scikit-learn</a> provides a fast CPU implementation of SVM, outperforming the stock scikit-learn and ThunderSVM implementations.</p><p><a href="https://medium.com/intel-analytics-software/from-hours-to-minutes-600x-faster-svm-647f904c31ae">From Hours to Minutes: 600x Faster SVM</a></p><p>Intel Extension for Scikit-learn contains drop-in replacement patching functionality for scikit-learn. Let’s do another performance comparison, this time using probabilistic support vector classification (SVC) (Table 1). In practice, using Intel Extension for Scikit-learn reduces the training time from 14 hours to 10 minutes (a 96x speedup) for the covertype dataset and speeds prediction over 1000x for the codrnanorm dataset. This is pretty astonishing considering that there’s no loss in model quality.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DxFdBwapHWG4Kb2g1tOK9Q.png" /><figcaption>Table 1 Comparing Intel Extension for Scikit-learn to the stock scikit-learn</figcaption></figure><p>RAPIDS cuML is the fastest SVM implementation for NVIDIA GPU, so we will use it to compare performance to Intel and AMD CPUs. To enable optimizations of Intel Extension for Scikit-learn, add just two lines of code before the usual scikit-learn imports:</p><pre>from sklearnex import patch_sklearn<br>patch_sklearn()</pre><pre># the start of the user&#39;s code<br>from sklearn.svm import SVC<br>...</pre><p>You can get the Intel Extension for Scikit-learn by downloading the <a href="https://software.intel.com/content/www/us/en/develop/tools/oneapi/ai-analytics-toolkit.html">Intel oneAPI AI Analytics Toolkit</a> (AI Kit). If you prefer to get the optimizations independently of the AI Kit, you can use either Anaconda Cloud (Conda-Forge channel) or PyPI:</p><pre>conda install scikit-learn-intelex -c conda-forge</pre><pre>pip install scikit-learn-intelex</pre><h3>Performance Comparisons</h3><h4>Intel vs. AMD CPUs</h4><p>This performance comparison used the following AWS EC2 instances: c5.24xlarge (2nd Generation Intel Xeon Scalable processor) and c5a.24xlarge (AMD EPYC Rome). We compare the performance of Intel Extension for Scikit-learn across these instances without any environment or code changes (Figure 1). We see that the performance on the Xeon instance is better than the EPYC instance. Based on the geometric mean, it is 1.85x faster during training and 3.1x faster during prediction. The performance improvement can be explained by the availability of AVX-512 instructions and a faster NUMA interconnect on Intel architectures, which is enabled in Intel Extension for Scikit-learn. Moreover, the price:performance ratio of the c5.25xlarge instance ($4.08/hour) is significantly better than the c5a.24xlarge instance ($3.70/hour): $3.70/hour * 1.85 hours = $6.85 to do the same amount of training and $3.70/hour * 3.1 hours = $11.47 to do the same amount of prediction as the Xeon instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gUCD5RxQZCSPgngh44XaUw.png" /><figcaption>Figure 1. The speedup of Intel Xeon vs. AMD Rome</figcaption></figure><h4>Intel CPU vs. NVIDIA GPU</h4><p>This performance comparison used the same AWS EC2 c5.24xlarge Xeon instance and the p3.2xlarge instance (NVIDIA V100). We compared Intel Extension for Scikit-learn on Xeon to RAPIDS cuML on V100 (Figure 2). Based on the geometric mean, Xeon is 2.11x<strong> </strong>times faster for training and 2.74x times faster for prediction. As with the previous Xeon vs. EPYC comparison, the price:performance ratio of the c5.25xlarge instance ($4.08/hour) is significantly better than the p3.2xlarge instance ($3.06/hour): $3.06/hour * 2.11 hours = $6.46 to do the same amount of training and $3.06/hour * 2.74 hours = $8.38 to do the same amount of prediction as the Xeon instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kdb2vC1me9OPmgQLFIXBcw.png" /><figcaption>Figure 2. The speedup of Intel Xeon (using Intel Extension for Scikit-learn) vs. NVIDIA V100 (using RAPIDS cuML)</figcaption></figure><p>We see that the Intel implementation has advantages. During both training and prediction, we have to work with multiple SVM models. The multiclass task uses the one-vs-one method, which requires quite a lot of models to be trained. Probability prediction requires training of five models using CalibratedClassifierCV. This is easy to parallelize on CPUs and is implemented in Intel Extension for Scikit-learn. It is much harder to implement on GPUs because it requires continuous data synchronization in global memory.</p><p>SVM also has sequential regions of code (e.g., the SMO solver) that cannot execute in parallel, which makes efficient execution on GPUs difficult. However, Intel® Extension for Scikit-learn applies smart data blocking to maximize cache reuse. This allows Xeon to outperform V100.</p><h3>Conclusions</h3><p>Using <a href="https://github.com/intel/scikit-learn-intelex">Intel Extension for Scikit-learn</a> on Intel Xeon processors saves a lot of time and money on SVM model training and inference. It is up to 1000x faster than the stock scikit-learn with no loss in accuracy. Also, it does not require code changes. The competitive performance advantages are also clear (Figures 1 and 2). Xeon shows a 1.85x speedup for training and a 2.11x speedup for prediction compared to AMD EPYC. It shows a 2.11x speedup for training and a 2.74x speedup for prediction compared to NVIDIA V100. In both cases, the price:performance ratio of the Xeon instance is significantly better than the EPYC or V100 instances.</p><h3>Hardware and Software Configurations</h3><p>All tests were performed by the author on March 29, 2021.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/833/1*vgyy2WkiYMF-dmCkS06sqA.png" /></figure><p>Benchmarks are available in the <a href="https://github.com/IntelPython/scikit-learn_bench">scikit-learn_bench</a> repository. Run the following command to reproduce the results with Intel Extension for Scikit-learn:</p><pre>python runner.py --config configs/svm/svc_proba_sklearn.json</pre><p>Run the following command to reproduce the results with RAPIDS cuML:</p><pre>python runner.py --config configs/svm/svc_proba_cuml.json --no-intel-optimized</pre><h4>Notices and Disclaimers</h4><p>Performance results are based on testing as of dates shown in configurations and may not reflect all publicly available options. Learn more at <a href="https://edc.intel.com/content/www/us/en/products/performance/benchmarks/overview/">www.Intel.com/PerformanceIndex​</a>.</p><p>Intel technologies may require enabled hardware, software or service activation. No product or component can be absolutely secure.</p><p>© 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.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f562cb9d5544" width="1" height="1" alt=""><hr><p><a href="https://medium.com/intel-analytics-software/leverage-intel-optimizations-in-scikit-learn-f562cb9d5544">Leverage Intel Optimizations in Scikit-Learn</a> was originally published in <a href="https://medium.com/intel-analytics-software">Intel Analytics Software</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Hours to Minutes: 600x Faster SVM]]></title>
            <link>https://medium.com/intel-analytics-software/from-hours-to-minutes-600x-faster-svm-647f904c31ae?source=rss-34f9c1a27716------2</link>
            <guid isPermaLink="false">https://medium.com/p/647f904c31ae</guid>
            <category><![CDATA[scikit-learn]]></category>
            <category><![CDATA[support-vector-machine]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[intel]]></category>
            <category><![CDATA[xeon]]></category>
            <dc:creator><![CDATA[Dmitry Kalyanov]]></dc:creator>
            <pubDate>Wed, 30 Dec 2020 15:19:09 GMT</pubDate>
            <atom:updated>2021-06-28T15:06:59.066Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ShW3xmk2Cg7y8pJK" /><figcaption>Photo by <a href="https://unsplash.com/@sumo?utm_source=medium&amp;utm_medium=referral">PAUL SMITH</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>Patching scikit-learn for Better Machine Learning Performance</h4><p>Hello, readers. If you are here, you are probably interested in the support vector machines (SVM) algorithm. Maybe you’re just looking for more information about it. Or, maybe you’ve tried training SVM models, only to find that the computation takes too long. Whatever the reason, we are going to show you how to run SVM faster than ever before with <strong>Intel® Extension for Scikit-learn</strong>.</p><h3>What Is SVM?</h3><p>SVM is an umbrella term for a group of supervised machine learning algorithms based on the idea of maximizing the margin between two classes. You can use SVM for both classification and regression problems, tune its hyperparameters, and choose a kernel function suitable for your data. A detailed description of SVM is beyond the scope of this short article, but there is plenty of theoretical and practical information online.</p><p>SVM has many advantages, but many complain about its speed, which is not surprising because the training time scales with <em>O(num_samples² x num_features)</em> so building a model can take a long time.</p><h3>How to Improve SVM Performance</h3><p>Improving performance is as simple as adding -m sklearnex to the Python command that launches your scikit-learn code:</p><pre>python -m sklearnex my_scikit_learn_program.py</pre><p>Alternatively, you can patch scikit-learn inside your code before importing it:</p><pre>from sklearnex import patch_sklearn <br>patch_sklearn()</pre><pre>from sklearn.svm import SVC # your usual code without any changes<br>…</pre><p>For more details about the installation process and available algorithms, see Intel® Extension for Scikit-learn <a href="https://intel.github.io/scikit-learn-intelex/">documentation</a>.</p><p>The effect is the same in both cases: your code will run much faster. To show how much, we created some <a href="https://github.com/PetrovKP/svm_benchmarks/">benchmarks</a>, which will become a part of <a href="https://github.com/IntelPython/scikit-learn_bench">our official benchmarks</a> very soon, and investigated a wide range of datasets. For each dataset, we selected the most suitable parameters (see configuration details below).</p><p>Two of these datasets, <em>klaverjas</em> and <em>covertype</em>, are quite large for the stock SVM implementation in scikit-learn, which results in long execution times (Figures 1 and 2). To demonstrate the advantage of Intel® Extension for Scikit-learn patching, we compare to two popular frameworks that provide SVM implementations: scikit-learn and ThunderSVM. We measured the execution time of the training (Figure 1) and prediction (Figure 2) stages. Each chart shows the speedup of ThunderSVM and patched scikit-learn compared to the stock scikit-learn, as well as the execution time of stock scikit-learn.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_URnykC-QxUMnpy92fR8Lg.png" /><figcaption>Figure 1. Improving SVM training performance</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GELBlLCk0iHSkGZ86D7dMg.png" /><figcaption>Figure 2. Improving SVM inference performance</figcaption></figure><p>Let’s see how much time can be saved by using Intel® Extension for Scikit-learn:</p><ul><li>Training. For large datasets, patched scikit-learn is up to 143x faster than the stock SVM implementation in scikit-learn. There is also a significant performance improvement for smaller datasets.</li><li>Inference. Patched scikit-learn is up to 600x faster than the stock version of scikit-learn. For all test cases, the patched scikit-learn SVM is at least 65 times faster than stock implementation.</li></ul><p>These results show that for larger datasets you can train models in minutes instead of hours, which is incredible if you keep in mind that all you have to do is patch scikit-learn.</p><p>We also tracked prediction accuracy for all models. Prediction accuracy of patched scikit-learn is on par with competitors, which means that whether you use stock scikit-learn, its patched version, or ThunderSVM to train your model, you will get the same results.</p><h3>Conclusions</h3><p>With Intel® Extension for Scikit-learn patching you can:</p><ul><li>Use your scikit-learn code for training and inference without modification.</li><li>Train SVM models up to 143 times faster.</li><li>Do inference up to 600 times faster.</li><li>Get the same quality of predictions as other tested frameworks.</li></ul><p>You get all of this without have to change your code or hardware.</p><h3>Installing Via Intel oneAPI AI Analytics Toolkit</h3><p>The <a href="https://software.intel.com/content/www/us/en/develop/tools/oneapi/ai-analytics-toolkit.html">Intel oneAPI AI Analytics Toolkit</a> (AI Kit) provides a consolidated package of Intel’s latest deep and machine learning optimizations all in one place with seamless interoperability and high performance. The AI Kit includes Intel-optimized versions of deep learning frameworks, Python libraries, and a lightweight parallel data frame to streamline end-to-end data science and AI workflows on Intel architectures. The AI Kit, which includes the Intel Distribution for Python and all of Intel’s scikit-learn optimizations, is distributed through many common channels, including Intel’s website, YUM, APT, Anaconda, and more. <a href="https://software.intel.com/content/www/us/en/develop/tools/oneapi/ai-analytics-toolkit/download.html#operatingsystem=Linux">Select and download</a> the distribution package that you prefer and follow the <a href="https://software.intel.com/content/www/us/en/develop/documentation/get-started-with-ai-linux/top.html">Get Started Guide</a> for post-installation instructions.</p><h3>Hardware and Software Configuration</h3><p>Intel Xeon Platinum 8280L (2nd generation Intel Xeon Scalable processors): 2 sockets, 28 cores per socket, HT:on, Turbo:on, total memory of 384 GB (12 slots/16 GB/2933 MHz). Software: <a href="https://github.com/scikit-learn/scikit-learn">scikit-learn</a> 0.23.2, <a href="https://github.com/Xtra-Computing/thundersvm">ThunderSVM </a>(CPU) 0.3.3, <a href="https://github.com/oneapi-src/oneDAL">oneDAL </a>and <a href="https://github.com/IntelPython/daal4py">daal4py </a>2021.1, Python 3.7.9.</p><h3>Model Configuration Details</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LwtnJWBxek-tnBRFzXSzPQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/919/1*fHTu7bFYhTZTKyMghrix5w.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=647f904c31ae" width="1" height="1" alt=""><hr><p><a href="https://medium.com/intel-analytics-software/from-hours-to-minutes-600x-faster-svm-647f904c31ae">From Hours to Minutes: 600x Faster SVM</a> was originally published in <a href="https://medium.com/intel-analytics-software">Intel Analytics Software</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>