Creating a Linear Regression Model in Python
Dec 31, 2020
Creating a Linear Regression model in python requires imports from the Sci-kit Learn library. It is useful to assess the relationship between two variables.
This example will use heart disease data found on Kaggle's website.
Create a variable for your data frame.
Target is our outcome and what we need to set as our y variable.
The other columns are used to determine y and will be our x data.
Create a constant in our x variable data.
From the value of the R-squared score, it is low and is not a good model to be used. A different type of regression model will most likely work better.