Recap: Tea Tasting
Part of the Unsupervised Learning section of Coddy's Machine Learning journey. Lesson 15 of 51.
Challenge
MediumA tea club tasted 66 teas. teas.csv holds how each was brewed, three flavour scores and its known type. Can the numbers alone find the types?
- Scale the five
featuresand cluster the teas into 3 groups with k-means. - Profile the clusters in real units, sorted by brewing temperature, and name them from
namesin that order, like the theme park's visitors. - Compare with the known types: print each cluster's size, temperature, steep time, and its most common type with its count.
For another club:
Delicate: 18 teas, 77°C for 2.5 min, mostly green (15)
Balanced: 25 teas, 87°C for 3.4 min, mostly oolong (20)
Bold: 23 teas, 96°C for 4.8 min, mostly black (22)Try it yourself
import pandas as pd
from sklearn.preprocessing import StandardScaler
from sklearn.cluster import KMeans
# 66 teas a tea club tasted: how they are brewed, three flavour scores from 1 to 10, and their type
teas = pd.read_csv("teas.csv")
features = ["brew_temp_c", "steep_min", "bitterness", "floral", "malty"]
# Names for the clusters, from the coolest brewing temperature to the hottest
names = ["Delicate", "Balanced", "Bold"]
# Write your code below
All lessons in Unsupervised Learning
1Finding Groups
Learning Without LabelsMeasuring SimilarityK-Means by HandK-Means in scikit-learnRecap: Gym Members7PCA in Practice
Seeing 64 DimensionsComponents as PatternsCompress and RebuildPCA Before a ModelRecap: Face Scanner10Project: Digit Explorer
Look at the DigitsShrink with PCACluster the DigitsName the ClustersFind the Odd Ones3Reading Clusters
Profiling ClustersCenters in Real UnitsClusters vs Known LabelsWhen K-Means FailsRecap: Tea TastingPractice on your own: Online Python compiler