31

Machine Learning Made Easy by PyCaret

 4 years ago
source link: https://towardsdatascience.com/machine-learning-made-easy-by-pycaret-5be22394b1ac?gi=bc9a884af917
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Entire machine learning pipeline with 10 lines of code.

3MnIzqq.jpg!web

PyCaret is a python open source low-code machine learning library created by Moez Ali and released in April 2020. It is literally a low-code library which allows to create an entire machine learning pipeline with very few lines of code. PyCaret is essentially a wrapper built on common python machine learning libraries such as scikit-learn, XGBOOST and many more.

What PyCaret achieves is a higly simple yet functional syntax. For instance, we can compare 18 classification models with 1 line of code. In this post, I will walk you through a classification task using PyCaret and explain the details of each step.

Let’s start with installing PyCaret:

!pip install pycaret

If you use google colab as your IDE and plan to render interactive visualizations in the notebook, following code needs to be executed:

from pycaret.utils import enable_colab
enable_colab()

The dataset we will use is “ Telco Customer Churn ” dataset which is available on kaggle. After importing numpy and pandas, we can read the dataset into a pandas dataframe:

import numpy as np
import pandas as pddf = pd.read_csv("/content/Customer-churn.csv")
df.shape
(7043, 21)

The dataset has 7043 observations (rows) and 21 columns. Here is the list of columns:

R3qUBvQ.png!web

“CustomerID” does not have any informative power since it is just a random rumber assigned to each customer. “TotalCharges” column is multiplication of “tenure” and “MonthlyCharges” columns so we don’t need this column as well. We just drop these two columns:

df.drop(['customerID','TotalCharges'], axis=1, inplace=True)

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK