Machine learning algorithms can take significant amounts of time to run. Intel’s distribution of Python aims to accelerate this machine learning process without users having to switch to C or C++. The prospect of code acceleration within Python itself is exciting. Therefore, a very simple experiment was set up to analyse Intel Python’s performance. This experiment utilises the 4 commonly used machine learning libraries : random forest, linear regression, hierarchical clustering and K-means clustering.
Intel Python performs the speed up through Intel® MKL, Intel® DAAL and the Intel® AVX. These are libraries which aim to optimise matrix and vector operations (common in machine learning).
It is important to note that Intel and Anaconda have been collaborating since 2016. This means that Intel contributes to performance enhancement in Anaconda’s Python distribution. (https://www.anaconda.com/improved-security-performance-in-anaconda-distribution-5/)
Operating System: macOS Mojave – Version 10.14.6
Processor: 2.8 GHz Intel Core i7
Memory: 16 GB 2133 MHz LPDDR3
Graphics: Intel Iris Plus Graphics 655 1536 MB
The following describes the environments that were set up for this experiment.
- Stock Python (Stock) – Default Python environment
- Vanilla Conda (Conda) – Conda distributed Python environment
- Idp Conda (IdpCon) – Intel Python environment distributed by Anaconda
- Idp Conda Environment, Pip Install Idp (IdpPip) – Intel Python environment, installed in a conda environment using pip install.
- Idp Standalone (IdpStd) – Intel python standalone distributed by Intel.
The models and size of data used for the experiment are shown below. Data is generated using numpy.random.
- K-means Clustering – 1,000,000 rows, 3 columns, 6 clusters.
- Hierarchical Clustering – 10,000 rows, 3 columns, 6 clusters.
- Random Forest – 10,000 training rows, 10 training columns, 1,000 test rows, 100 estimators.
- Linear Regression – 10,000,000 training rows, 10 training columns, 1000000 test rows.
Stock Python is significantly slower for LR and K-means while it is faster in hierarchical clustering. It is interesting to note that IdpPip performs ~8x faster than conda and ~16x faster than stock Python.
With the exception of K-means clustering, the performance of Intel’s Python distribution appears comparable to Anaconda’s Python distribution. IdpPip has a significant speedup over the other environments. However, stock Python still performs better at hierarchical clustering. Therefore, it is not conclusive if Anaconda or Intel Python is definitively better.
Fortunately, Intel is constantly working on performance enhancements for Python code. We can look forward to a near future when Intel Python becomes definitively better than other distributions of Python.