ft_linear_regression · 42 · 2026
Linear Regression
Gradient descent, written by hand in Rust.
- 24
- cars in the dataset
- 0
- machine-learning libraries
Problem
Predict a car's price from its mileage, without any machine-learning library.
Solution
Mileage is min-max normalized, then θ₀ and θ₁ are trained by gradient descent and updated simultaneously. A Cargo workspace separates training, prediction and shared code.
- 50,000 km
- 7,427 €
- 120,000 km
- 5,926 €
- 200,000 km
- 4,210 €
Rust · Cargo · serde · csv
Nearly done.