Recap: Climbing Partners
Part of the Statistics for ML section of Coddy's Machine Learning journey. Lesson 51 of 64.
Challenge
MediumA climbing gym pairs each newcomer with the most similar member. Each row of members is a member, named in names: height (cm), arm span (cm) and dead hang (minutes on a bar). The program reads the newcomer's measurements.
- Find the nearest member in the raw table.
- Standardize with a
StandardScalerfitted on the members; print the newcomer scaled. - Find the nearest member again, on the scaled tables.
Round to 2 decimals. Another gym, with three members:
Its output:
Nearest before scaling: Kim (4.56)
Newcomer scaled: [[-0.38 -0.54 0.98]]
Nearest after scaling: Lou (1.09)Try it yourself
import numpy as np
from sklearn.preprocessing import StandardScaler
names = ["Iris", "Jon", "Kai", "Lena", "Max", "Nora"]
# One row per member: height in cm, arm span in cm, dead hang in minutes
members = np.array([[166, 169, 1.6],
[182, 188, 1.1],
[171, 170, 2.3],
[176, 181, 1.4],
[188, 191, 2.0],
[160, 163, 0.9]])
# The newcomer
height = float(input())
span = float(input())
hang = float(input())
# Write your code below
All lessons in Statistics for ML
1Center and Spread
Mean and MedianPercentiles and QuartilesVariance and StdSample or Population?The Most Common ValueRecap: Delivery Times4Samples and Populations
Population and SampleSample Means VaryThe Sampling DistributionBigger Samples, Less NoiseRecap: Polling a Town2Distributions
Density HistogramsShapes of DataThe Normal CurveThe 68-95-99.7 RuleZ-ScoresRecap: Battery Life3Probability by Simulation
Probability as FrequencyThe Law of Large NumbersSums of DiceExpected ValueConditional ProbabilityRecap: Dice Stall Odds6Relationships
Reading Scatter PlotsCorrelationCorrelation MatrixCorrelation HeatmapsCorrelation Is Not CauseRecap: Ice Cream and Sun9Feature Scaling
Why Scale FeaturesMin-Max ScalingStandardizationStandardScalerRecap: Climbing PartnersPractice on your own: Online Python compiler