No. | Degré d'orientation | Température | pression |
---|---|---|---|
1 | 45 | 17.5 | 30 |
2 | 38 | 17.0 | 25 |
3 | 41 | 18.5 | 20 |
4 | 34 | 16.0 | 30 |
5 | 59 | 19.0 | 45 |
6 | 47 | 19.5 | 35 |
7 | 35 | 16.0 | 25 |
8 | 43 | 18.0 | 35 |
9 | 54 | 19.0 | 35 |
10 | 52 | 19.5 | 40 |
stat.py
# coding: UTF-8
import numpy as np
def stat(obj, exp):
n = exp.shape[1]
exp = np.vstack([np.ones(n), exp]) #Terme constant, variable explicative
coef = np.linalg.lstsq(exp.T, obj)[0] #Coefficient de régression partiel
return coef
if __name__ == '__main__':
f = (45, 38, 41, 34, 59, 47, 35, 43, 54, 52) #Degré d'orientation
t = (17.5, 17.0, 18.5, 16.0, 19.0, 19.5, 16.0, 18.0, 19.0, 19.5) #Température
p = (30, 25, 20, 30, 45, 35, 25, 35, 35, 40) #pression
obj = np.array(f) #Variable objectif
exp = np.array([t, p]) #Variable explicative
b0, bt, bp = stat(obj, exp)
print "Equation de régression multiple:Degré d'orientation= %f + %f*Température+ %f*pression" % (b0, bt, bp)
> python stat.py
Equation de régression multiple:Degré d'orientation= -34.712931 + 3.469813*Température+ 0.533009*pression
Recommended Posts