This is a draft cheat sheet. It is a work in progress and is not finished yet.
TO START
# IMPORT VIS LIBRARIES
import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline
# IMPORT MODELLING LIBRARIES
from sklearn.cluster import KMeans
|
PRELIMINARY OPERATIONS
df = pd.read_csv('data.csv') |
import data |
df.head() |
check head df |
df.info() |
check info df |
df.describe() |
check stats df |
|
|
TRAIN MODEL
df.drop('col',axis=1) |
take everything but 1 col |
FIT THE MODEL |
kmeans = Kmeans(n_clusters=n) |
instatiate model |
kmeans.fit(data) |
train/fit the model |
kmeans.cluster_centers_ |
find centers |
kmeans.labels_ |
find labels |
|
|
|