ft_linear_regression

If you thing this is usefull, you can support me by sending some eth at : 0x343901374AdF3AFAc8EA1eC1Fb00a75F904eD48E

Description

Machine learning is more and more use in today word, from creating image to weather forcast, passing by creating bots that beat humain in chess game.

Ft_linear_regression is a 42 project that introduct you to machine learning.

You have to predict the price of a car 🚗 with the km as input.

It let you discover the power of linear regression and gradient descent.

To predict the price of the car you have to use the mathematics formula of linear regression:

equation

You have to use these mathematics fomulars to get both θ.

This will give you θ0 :

equation1

This will give you θ1 :

equation2

A default dataset is provided

Explanation

Machine learning work amost everytime with normalized data.

A normalized dataset is just a way to set the dataset in a range that is more easy to work

e.g : set all values between 0-1

You can check more information on Normalize

When your dataset is normalized you can work on it to find θ values.

We will use a gradient descent algorithme to get a more precise value possible of both θ.

Gradient descent is a first-order iterative optimization algorithm for finding a local minimum of a differentiable function.

For more information on Gradient descent

We will iterate n number of time over the values in the dataset, to calculate the derivation.

When you subtract the derivation to the actual values in the dataset, you get the loss.

With this loss you can ajust the learning rate in the next iteration and try to optimise the values of both θ, to get the smaller loss.

After some iteration, you will see that the values of both θ and the loss will stabilise.

Prediciton of the price of a car with the km

Price : 3650 €
T0 : 0T1 : 0

Dataset

Graph datas

Dataset prices / km
Prices / km, Ordered by km
Prediction prices / km
Prediction prices / km, Ordered by km

Graph history