This project implements linear regression using a dataset to predict a dependent variable based on an independent variable. It involves data preprocessing, making predictions, and visualizing results using matplotlib. The final output is a scatter plot with a fitted regression line, showcasing the model’s accuracy.
Important
When refering in the project about theta0(
- theta0(
$\theta_0$ ) is the intercept, and can be used interchangeably with the term "intercept." It represents the value of 𝑦 when 𝑥=0. - theta1(
$\theta_1$ ) is the slope, and can be used interchangeably with the term "slope." It represents how much 𝑦 changes for each unit increase in 𝑥.
. ./install.sh
Computes a Linear Regression using Gradient Descend Algorithm with the dataset specified.
- use --dataset or -d to specify a dataset
- use --graphical or -g to open a graph window with the result
- use --output or -o to save the result in a json format file
python3 linear_regression.py -h
Try:
python3 linear_regression.py --dataset datasets/data.csv --graphical
This program calculates the predicted value of Y based on a given X value using a simple linear equation ( Y =
- use --theta0 or -t0 to specify the theta0 or intercept
- use --theta1 or -t1 to specify the theta1 or slope
- use --json or -j for input a json with theta0 and theta1 result from the previous program
python3 linear_predictor.py -h
Try:
python3 linear_predictor.py --theta0 8474.34137591075 --theta1 -0.021199045602042395