I'm trying to do a clustering with K-means method but I would like to measure the performance of my clustering.
I'm not an expert but I am eager to learn more about clustering.
Here is my code :
import pandas as pd
from sklearn import datasets
#loading the dataset
iris = datasets.load_iris()
df = pd.DataFrame(iris.data)
#K-Means
from sklearn import cluster
k_means = cluster.KMeans(n_clusters=3)
k_means.fit(df) #K-means training
y_pred = k_means.predict(df)
#We store the K-means results in a dataframe
pred = pd.DataFrame(y_pred)
pred.columns = ['Species']
#we merge this dataframe with df
prediction = pd.concat([df,pred], axis = 1)
#We store the clusters
clus0 = prediction.loc[prediction.Species == 0]
clus1 = prediction.loc[prediction.Species == 1]
clus2 = prediction.loc[prediction.Species == 2]
k_list = [clus0.values, clus1.values,clus2.values]
Now that I have my KMeans and my three clusters stored, I'm trying to use the Dunn Index to measure the performance of my clustering (we seek the greater index) For that purpose I import the jqm_cvi package (available here)
from jqmcvi import base
base.dunn(k_list)
My question is : does any clustering internal evaluation already exist in Scikit Learn (except from silhouette_score) ? Or in another well known library ?