Reading 13
Linear Regression
A linear regression takes an explanatory variable and a response variable and plots their relationship via scatterplot. A line is then drawn through the plots that represents the expected relationship between the two variables, based on that data.
- Scikit-learn is a Python module that contains tools for machine learning and includes a regression tool.
import sklearn
from sklearn.linear_model import LinearRegression
A Few Important Linear Regression Methods:
lm.fit() -> fits a linear model
lm.predict() -> Predict Y using the linear model with estimated coefficients
lm.score() -> Returns the coefficient of determination (R^2). A measure of how well observed outcomes are replicated by the model, as the proportion of total variation of outcomes explained by the model.
source: https://bigdata-madesimple.com/how-to-run-linear-regression-in-python-scikit-learn/