We will use Matlab for linear regression on a Kaggle dataset
Regression models describe the relationship between variables by fitting a line to the observed data. Simple linear regression is used to estimate the relationship between two quantitative variables. The formula for a simple linear regression is:
- y is the predicted value of the dependent variable (y) for any given value of the independent variable (x).
- B0 is the intercept, the predicted value of when the x is zero.
- B1 is the regression coefficient–how much we expect y to change as x increases.
- X is the independent variable (the variable we expect is influencing y).
The cost is the error in our predicted value. We will use the Mean Squared Error function to calculate the cost.
Gradient Descent is an algorithm that finds the best-fit line for a given training dataset in a smaller number of iterations.
I used a dataset from Kaggle for the prediction of diabetes based on different conditions. The dataset is provided in the repo as well.
- Download the Matlab files
- Change the location of the dataset to the location on your machine in the code.
- Run all the function files and then run the Main file after running the main file run the prediction file.
- Change the values in the prediction portion of the code to the values you want to predict
Prediction