MLR:利用多元线性回归法,从大量数据中提取五个因变量来预测一个自变量—Jason niu

from numpy import genfromtxt    
from sklearn import linear_model

datapath=r"Delivery_Dummy.csv" 
data = genfromtxt(datapath,delimiter=",") 

x = data[1:,:-1] 
y = data[1:,-1]
print (x)
print (y)

mlr = linear_model.LinearRegression() 
 
mlr.fit(x, y)  
 
print (mlr)
print ("coef:")
print (mlr.coef_)        
print ("intercept")
print (mlr.intercept_)  
 
xPredict =  [[120,3,1,0,0]]
yPredict = mlr.predict(xPredict)
  
print ("predict:")
print (yPredict)

 

posted @ 2018-01-07 12:24  一个处女座的程序猿  阅读(1805)  评论(0编辑  收藏  举报