Python Bytes - Machine Learning K Means Part 8 Calculate Plot Cluster Distortion Code in Description

preview_player
Показать описание
#Coded by Andrew C
import pandas as pd
from sklearn import datasets

X = wine[['alcohol', 'total_phenols']]

scale = StandardScaler()

import numpy as numpy

inertia = []
differ=[]
pre_inertia=0
km = KMeans(
n_clusters=i
)

distortion = { i + 1 : differ[i] for i in range(0, len(differ) ) }
print(distortion)
print()

#datascience #coding #python
Рекомендации по теме