Intro to Regression

Regression analysis is used to predict continuous outcomes from the given data. It uses features from data to fit a line that models the relationship

Regression also helps us understand how the features influence a target variable. The Target value will always be a continuous value in regression modelling.

As you know, in Machine Learning, we have features (X) and Target value (y). So you plot the features using matplotlib.pyplot module and you can leverage scatterplot to plot the relationship.

Linear Regression is one of the type of regression model. Its part of SciKit learn package.

from sklearn.linear_model import LinearRegression as lr

then you follow the steps:

  1. Initiate the model
  2. Fit the model
  3. Predict the model
  4. Plot the model

When plot for linear regression line, always plot your training data with predicted data

plt.plot(X, prediction, color="red") #color for visual representation

Leave a Reply

Your email address will not be published. Required fields are marked *