Python Ecosystem – Part 2 – Python ML Ecosystem libraries

Python is an open-source ML language that is continually gaining popularity among the data science community. This is because it supports open-source tools available for machine learning and deep learning. However, there is no one size fits all tool for AI or ML subsets. Leading to the several core libraries serving a particular set of use cases or problems.

 

In this article, we’ll introduce you to some of the widely used Python libraries available for machine learning.

 

 

 

1. Scikit-learn –

 

 

Scikit-learn is one of the Python components which is widely used for the implementation of ML algorithms. It provides a clean uniform API platform that enables you to interact with a wide range of models.

 

 

Python Scikit-learn – Environment Setup

 

 

In order to install the Scikit-learn package, install the latest version of Python 3 using Anaconda or miniconda installers, and then run:

 

 

$ conda create -n sklearn-env -c conda-forge scikit-learn

 

 

$ conda activate sklearn-env

 

 

In order to check the installation, run the following command

 

 

$ conda list scikit-learn  # to see which scikit-learn version is installed

 

 

$ python -c “import sklearn; sklearn.show_versions()”

 

 

2. TensorFlow –

 

 

TensorFlow is a deep learning library that was originally developed by the Google Brain team. The library is built for numerical computation using data flow graphs which use the neural network of deep learning to help express and analyze patterns in large datasets.

 

 

Python TensorFlow – Environment Setup

 

 

conda install -c conda-forge cudatoolkit=11.2 cudnn=8.1.0

 

 

python3 -m pip install tensorflow

 

 

# Verify install:

 

 

python3 -c “import tensorflow as tf; print(tf.config.list_physical_devices(‘GPU’))”

 

 

3. Keras –

 

 

TensorFlow, although a highly scalable and powerful deep learning library, is known for its user-friendly interface. Keras made TensorFlow simple by allowing for fast experimentation with the TensorFlow library.

 

 

Python Keras – Environment Setup

 

 

For Python Keras environment setup, run the following commands –

 

 

conda install python=3.6

 

 

conda create –name PythonGPU

 

 

activate PythonGPU

 

 

conda deactivate

 

 

conda install -c anaconda keras-gpu

 

 

conda install -c anaconda keras

 

 

conda install spyder

 

 

4. Pycaret

 

 

Python Pycaret – Environment Setup

 

 

conda create -n yourenvname python=x.x anaconda

 

 

conda activate yourenvname

 

 

conda deactivate

 

 

conda remove -n yourenvname –all

 

 

pip install pycaret

 

 

5. SciPy

 

SciPy is an ecosystem of Python libraries for mathematics, science, and engineering. It’s an add-on to Python needed for machine learning. It is comprised of three components – NumPy, Matplotlib, and Pandas.

 

 

Python SciPy – Environment Setup

 

 

For SciPy installation, the first step is to install Python. Once install confirm the installation was successful. Than open python interactive environment by typing “python” at the command line then run the following code –

 

 

# scipy

 

 

import scipy

 

 

print(‘scipy: %s’ % scipy.__version__)

 

 

# numpy

 

 

import numpy

 

 

print(‘numpy: %s’ % numpy.__version__)

 

 

# matplotlib

 

 

import matplotlib

 

 

print(‘matplotlib: %s’ % matplotlib.__version__)

 

 

# pandas

 

 

import pandas

 

 

print(‘pandas: %s’ % pandas.__version__)

 

 

In this article, we have covered the five most popular Python packages for machine learning. There are many other libraries available across the Python ecosystem including Theano, Chainer and Spark ML, etc that provide solutions for a specific set of problems.

 

skillcef

Skillcef admin responsible for creative content idea generation and publishing