What we will learn
- Linear regression in Python
The source of this summary The first link
The source of this summary The second link ______________
Linear regression
What is linear regression
Linear regression performs the task to predict a dependent variable value (y) based on a given independent variable (x). So, this regression technique finds out a linear relationship between x (input) and y(output).
Scikit-learn
Scikit-learn is a free machine learning library for Python. It features various algorithms like support vector machine, random forests, and k-neighbours, and it also supports Python numerical and scientific libraries like NumPy and SciPy. also It contains function for regression, classification, clustering, model selection and dimensionality reduction.
How to run Linear regression
-
Import the packages and classes you need.
-
Provide data to work with and eventually do appropriate transformations.
-
Create a regression model and fit it with existing data. represents the regression model fitted with existing data.
-
Check the results of model fitting to know whether the model is satisfactory.
-
Apply the model for predictions. You can predict the output values by multiplying each column of the input with the appropriate weight, summing the results and adding the intercept to the sum.
Residual Plots
A residual plot is a type of plot that displays the fitted values against the residual values for a regression model. This type of plot is often used to assess whether or not a linear regression model is appropriate for a given dataset and to check for heteroscedasticity of residuals
Regression analysis
Regression analysis is used when you want to predict a continuous dependent variable from a number of independent variables. If the dependent variable is dichotomous, then logistic regression should be used.