Académique Documents
Professionnel Documents
Culture Documents
Machine Learning
TP3 : Régression linéaire avec Sklearn
Exercice 1
x̄ = m1 m
P
i=1 xi
ȳ = m1 m
P
i=1 yi
Pm
(x − x̄)(yi − ȳ)
Pm i
a = i=1 2
i=1 (xi − x̄)
b = ȳ − ax̄
1
1
Pm 1
Pm
M SE = m i=1 (ŷi − yi )2 = m i=1 ((axi + b) − yi )2
Pm
2 (yi − ŷi )2
R = 1 − Pi=1
m 2
i=1 (yi − ȳ)
Partie 2
Implémenter la Partie 1 en utilisant cette fois les fonctions de la bibliothèque sklearn.
Partie 3 Une solution analytique peut-être donnée directement par l’équation normale :
θ = (X T X)−1 X T Y
Calculer et afficher les valeurs a et b en utilisant l’équation normale sur les tableaux X et Y .