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)
不念过去,不畏将来!
理想,信仰,使命感……
愿你出走半生,归来仍是少年……