Module 7 · Classical ML

Module 7: guided construction and mastery

Use this after the foundation bridge and before attempting independent practice; return to the module run instructions afterward. Read, predict, run, change, and explain. The shared runner remains the complete reference; these small steps expose its ideas.

Worked concept

Without scaling, a feature measured in thousands can dominate a feature measured in fractions. K-means minimizes squared distance to centers. Its IDs have no inherent order or meaning.

Predict and construct

Predict the printed values, shape or rejection before running. Use the documented environment. The notebook contains this same runnable construction cell.

from sklearn.preprocessing import StandardScaler
from sklearn.cluster import KMeans
from practical_ml_ai.continuation_data import wine_splits
learning_split, learning_features, _ = wine_splits()
learning_scaler = StandardScaler().fit(learning_split["train"][learning_features])
learning_x = learning_scaler.transform(learning_split["train"][learning_features])
learning_clusterer = KMeans(n_clusters=2, n_init=10, random_state=42).fit(learning_x)
print("centers in original units", learning_scaler.inverse_transform(learning_clusterer.cluster_centers_))
assert learning_clusterer.cluster_centers_.shape == (2,len(learning_features))

Complete with less support

Fit a predeclared second K using training and compare development geometry and cluster sizes. Explain why quality must not choose an allegedly unsupervised partition.

Debug a plausible misconception

Is silhouette a classification accuracy? Write a prediction before opening feedback. Include a counterexample or calculation, not only a definition.

Independent transfer

Compare supervised learning with clustering and reinforcement learning using label, feedback and reward availability.

Minimum mastery evidence

Keep the evidence listed in the study workflow and name the module outcome each item supports. The criteria describe developing, meeting and extending the outcome.