# ft_linear_regression A simple linear regression implementation using gradient descent to predict car prices based on mileage. ## Requirements - Python 3 - matplotlib (for visualization only) ``` pip install matplotlib ``` ## Usage ### Train the model ``` python3 train.py ``` Example: ``` python3 train.py 1.0 1000 ``` This trains the model on `data.csv` and saves the resulting parameters (θ0, θ1) to `thetas.csv`. ### Predict a price ``` python3 predict.py ``` Prompts for a mileage value and outputs the estimated price. Loops until Ctrl+C. If no trained model is found, θ0 and θ1 default to 0. ### Visualize ``` python3 visualize.py ``` Displays a scatter plot of the dataset. If a trained model exists, the regression line is drawn on top. ## How it works The model fits a linear function: ``` estimatePrice(mileage) = θ0 + θ1 * mileage ``` Parameters are found via gradient descent with min-max normalization on the input data. After training, thetas are denormalized so they work directly on raw mileage values.