1.1. Linear Models
The following are a set of methods intended for regression in which the target value is expected to be a linear combination of the features. In mathematical notation, if $\hat{y}$ is the predicted value.
Across the module, we designate the vector $w = (w_1, ...,
w_p)$ as coef_ and $w_0$ as
intercept_.
1.1.1. Ordinary Least Squares
LinearRegression fits a linear model with coefficients $w = (w_1, ..., w_p)$ to minimize the residual sum of squares between the observed targets in the dataset, and the targets predicted by the linear approximation.
from sklearn import linear_model
reg = linear_model.LinearRegression()
reg.fit([[0, 0], [1, 1], [2, 2]], [0, 1, 2])
# LinearRegression()
reg.coef_
# array([0.5, 0.5])
Note: Пример
Это редактируемая область. Напиши сюда свой текст для зачета.