DAILY PRACTICEBuild your AI engineering skills, one problem at a time.Try today's challenge
InferenceAIStart learning path

Machine Learning · Beginner

Regression

Regression predicts a numerical value from input features.

TRY IT YOURSELF

Fit a simple line

Toy data: (1, 2), (2, 4), (3, 6). The model is y = slope × x.

Predictions1.0, 2.0, 3.0
Mean squared error4.67

How it works

A linear model combines input features with weights and a bias. Training chooses parameters that reduce a loss, such as mean squared error, on observed examples.

A concrete example

For a toy dataset with inputs 1, 2, 3 and targets 2, 4, 6, a line y = 2x fits all three observations exactly.

Watch for this

A low training error does not prove a model will generalize. Evaluate on held-out examples and check for leakage.

Try it yourself

Change the slope and find the smallest mean squared error for the toy dataset.

Continue to practice →

Read the source: Google: linear regression ↗

Related concepts

Classification →

Decision trees →

Feature engineering →