Classifieurs linéaires en Python
Michael (Mike) Gelbart
Instructor, The University of British Columbia
x = np.arange(3)
x
array([0, 1, 2])
y = np.arange(3,6)
y
array([3, 4, 5])
x*y
array([0, 4, 10])
np.sum(x*y)
14
x@y
14
x@y s'appelle le produit scalaire de x et y, et s'écrit $x \cdot y$.fit diffère mais predict est identique$\textrm{sortie brute du modèle} = \textrm{coefficients} \cdot \textrm{caractéristiques} + \textrm{ordonnée à l'origine}$
lr = LogisticRegression()
lr.fit(X,y)
lr.predict(X)[10]
0
lr.predict(X)[20]
1
lr.coef_ @ X[10] + lr.intercept_ # sortie brute du modèle
array([-33.78572166])
lr.coef_ @ X[20] + lr.intercept_ # sortie brute du modèle
array([ 0.08050621])



Classifieurs linéaires en Python