-
-
Save amankharwal/fee6cb0a3a4710eb28ed48289f6c809e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.preprocessing import LabelEncoder | |
le = LabelEncoder() | |
labels_true = le.fit_transform(data['Revenue']) | |
# get predicted clustering result label | |
labels_pred = y_means | |
# print adjusted rand index, which measures the similarity of the two assignments | |
from sklearn import metrics | |
score = metrics.adjusted_rand_score(labels_true, labels_pred) | |
print("Adjusted rand index: ") | |
print(score) | |
# print confusion matrix | |
#cm = metrics.plot_confusion_matrix(None, labels_true, labels_pred) | |
#print(cm) | |
import scikitplot as skplt | |
plt_1 = skplt.metrics.plot_confusion_matrix(labels_true, labels_pred, normalize=False) | |
plt_2 = skplt.metrics.plot_confusion_matrix(labels_true, labels_pred, normalize=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment