# sklearn.linear model

A sklearn.linear_model is a collection of generalized linear model fitting systems within scikit-learn.

## References

### 2017b

• http://scikit-learn.org/stable/modules/linear_model.html
• QUOTE: The following are a set of methods intended for regression in which the target value is expected to be a linear combination of the input variables. In mathematical notion, if \hat{y} is the predicted value: $\hat{y}(w, x) = w_0 + w_1 x_1 + ... + w_p x_p$ Across the module, we designate the vector w = (w_1, ..., w_p) as coef_ and w_0 as intercept_.

To perform classification with generalized linear models, see Logistic regression.

### 2016

import sklearn.datasets
from sklearn.model_selection import cross_val_predict
import sklearn.linear_model
import matplotlib.pyplot as plt

lr = linear_model.LinearRegression()
y = boston.target

# cross_val_predict returns an array of the same size as y where each entry
# is a prediction obtained by cross validation:
predicted = cross_val_predict(lr, boston.data, y, cv=10)

fig, ax = plt.subplots()
ax.scatter(y, predicted, edgecolors=(0, 0, 0))
ax.plot([y.min(), y.max()], [y.min(), y.max()], 'k--', lw=4)
ax.set_xlabel('Measured')
ax.set_ylabel('Predicted')
plt.show()