Menu
CoddyTech

Recap: Tea Tasting

Part of the Unsupervised Learning section of Coddy's Machine Learning journey. Lesson 15 of 51.

challenge icon

Challenge

Medium

A 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?

  1. Scale the five features and cluster the teas into 3 groups with k-means.
  2. Profile the clusters in real units, sorted by brewing temperature, and name them from names in that order, like the theme park's visitors.
  3. 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

Practice on your own: Online Python compiler