Back to the lessonPreparing the printout…

Fundamental of Machine Learning · Module 2: Core Machine Learning Algorithms

2.1 Linear Regression

[video] /api/lesson-media/videos/9b417aa2-5e9f-4ae3-a9db-2a3b7f03f372-1794615011536-e7cfe4e7f0d82c59.mp4

[markdown] content available only on the platform

[markdown] content available only on the platform

Flashcards · 2.1 Linear Regression

Linear Regression — An algorithm that predicts a continuous number by fitting the straight line or flat surface that best matches the data.

Predicting salary from years of experience.

Slope (m) — How much the predicted target changes when the feature increases by one unit.

m = 2: each extra year of experience adds 2 to predicted salary.

Intercept (b) — The predicted value when every feature equals zero; where the line crosses the vertical axis.

Baseline salary for someone with 0 years of experience.

Best fit line — The line whose average squared distance to the data points is the smallest possible.

The green line through the salary and experience scatter plot.

Mean squared error (MSE) — The average of the squared differences between predictions and actual values, used as the loss to minimise.

Errors 1 and 3 give MSE = (1 + 9) / 2 = 5.

Simple Linear Regression — Linear Regression with exactly one input feature; the model is a straight line in 2D.

Salary predicted from Experience only.

Multiple Linear Regression — Linear Regression with two or more input features used together; the model is a plane or hyperplane.

Salary predicted from Experience and Education.

Hyperplane — The flat surface a linear model forms when there are many features; it cannot be drawn but works the same way.

A model with 20 features fits a hyperplane in 21 dimensions.

LinearRegression — The scikit-learn class for both simple and multiple Linear Regression; learned weights are in coef_ and intercept_.

LinearRegression().fit(data[['Experience']], data['Salary'])

Fundamental of Machine Learning · 2.1 Linear Regression · printed on November 21, 2026