Skip to content
BI & Data ScienceWhat machine learning is

Formulas for this chapter

The supervised learning relation

Y = f(X) fit f on labelled rows, then predict Y for new x

Every supervised task. If you cannot point at the column that holds Y, the task is unsupervised and this does not apply.

X
Input variables, the predictors or features
Y
Output variable, the label or target
f
The mapping the algorithm learns

Train-test split

training rows = 0.80 x n validation rows = 0.20 x n accept when performance(train) ~ performance(validation)

Before fitting anything. The class logistic-regression workbook uses 800 train and 200 test on 1,000 rows, exactly this ratio.

n
Total labelled rows available
0.80 / 0.20
Section B's stated default split; the ratio is a decision to record

KNN aggregation rule

classification: predicted class = majority vote of the k nearest labels regression: predicted value = average of the k nearest targets

Whenever the same neighbours must produce a label or a number. It is the one line of the algorithm that changes between the two tasks.

k
How many nearest neighbours are consulted
Step 1 of 26
The ideaTheory

A hundred thousand old customers

A bank has records of 100,000 previous customers: income, age, credit score, and whether each one repaid the loan.

Nobody writes a rule saying "decline below 600". Instead the machine reads all 100,000 rows and works out for itself which combinations of income, age and score ended badly.

Then a new applicant arrives with income 60,000, age 28 and score 700, and the machine answers. That is machine learning: the rule comes out of the data, not out of a manager's head.