Linear Regression
learning target
- Ownership in the implementation process of linear regression
- Application LinearRegression or SGDRegressor achieve regression prediction
- We know the assessment criteria and formulas regression algorithm
- Overfitting know the causes and solutions underfitting
- We know principle ridge regression and linear regression differences
- Application Ridge achieve regression prediction
- Application joblib achieve saving and loading models
2.2 linear regression api initial use
1 linear regression API
- sklearn.linear_model.LinearRegression()
- LinearRegression.coef_: regression coefficient
2 Examples
2.1 Analysis of step
- 1. Obtain data set
- 2. Basic data processing (omitted in this case)
- 3. The feature works (in this case omitted)
- 4. Machine Learning
- The model assessment (omitted in this case)
2.2 Code Process
from sklearn.linear_model import LinearRegression
x = [[80, 86],
[82, 80],
[85, 78],
[90, 90],
[86, 82],
[82, 90],
[78, 80],
[92, 94]]
y = [84.2, 80.6, 80.1, 90, 83.2, 87.6, 79.4, 93.4]
- Machine learning - training model
estimator = LinearRegression()
estimator.fit(x,y)
estimator.coef_
estimator.predict([[100, 80]])