Clustering using PyCaret!!!

Let’s see how PyCaret helps build models faster

Getting Started with Clustering!!

If you are not familiar with PyCaret. I suggest you to first go through the below link before moving on from here.

Complete Guide to PyCaret.

Also, Check out our Article on:

Reading Data

from pycaret.datasets import get_dataget_data('index')

Scrolling down we can find datasets available for the Classification Modelling.

import pycaretfrom pycaret.clustering import *data = get_data('pokemon')

We will use the pokemon data

Setting up the PyCaret environment

clust = setup(data = data)

After this press enter and you will get results as shown below.

Creating Models

create_model('model_ID')

Model ID for Clustering Models.

+-----------------------+----------------+
| Cluster PCA Plot (2d) | ‘cluster’ |
+-----------------------+----------------+
| Cluster TSnE (3d) | ‘tsne’ |
| Elbow Plot | ‘elbow’ |
| Silhouette Plot | ‘silhouette’ |
| Distance Plot | ‘distance’ |
| Distribution Plot | ‘distribution’ |
+-----------------------+----------------+

Moving on with the kmeans model.

Assign Models

Plot a Model

model = create_model('Model_name')plot_model(model)
+-----------------------+----------------+
| Cluster PCA Plot (2d) | ‘cluster’ |
+-----------------------+----------------+
| Cluster TSnE (3d) | ‘tsne’ |
| Elbow Plot | ‘elbow’ |
| Silhouette Plot | ‘silhouette’ |
| Distance Plot | ‘distance’ |
| Distribution Plot | ‘distribution’ |
+-----------------------+----------------+

Save Models

As you can see PyCaret literally helps build an end to end clustering model with few lines of code

Also, Check out our Article on:

Visit us on https://www.insaid.co/

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
INSAID

INSAID

One of India’s leading institutions providing world-class Data Science & AI programs for working professionals with a mission to groom Data leaders of tomorrow!