aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md54
1 files changed, 54 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..4d6833d
--- /dev/null
+++ b/README.md
@@ -0,0 +1,54 @@
+# 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 <learning_rate> <iterations>
+```
+
+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.