Regression

الانحدار

Definition

A supervised learning task in which the model predicts a continuous numeric value, such as a price or a temperature.

Definition

Regression is a supervised learning task in which a model predicts a continuous numerical output from input features.

Practical examples

Code example Python
import numpy as np
from sklearn.linear_model import LinearRegression

X = np.array([[1], [2], [3], [4]])
y = np.array([3, 5, 7, 9])          # y = 2x + 1
m = LinearRegression().fit(X, y)
print(round(m.coef_[0], 2), round(m.intercept_, 2), m.predict([[5]]).round(2))

Expected output

2.0 1.0 [11.]

Mathematical equations

\hat y = \beta_0 + \sum_{j=1}^{p} \beta_j x_j, \qquad \mathrm{MSE} = \frac{1}{n}\sum_{i=1}^{n} (y_i - \hat y_i)^2

Scientific sources

References and scientific sources

  • Book
    The Elements of Statistical Learning (2nd ed.) Trevor Hastie, Robert Tibshirani, Jerome Friedman · 2009 · Springer A statistical reference on machine learning, freely available from the authors' website.
  • Book
    Pattern Recognition and Machine Learning Christopher M. Bishop · 2006 · Springer A classic reference on probabilistic machine learning.

Learn and review

Suggested terms to learn next