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)
原文地址:https://www.cnblogs.com/yunyaniu/p/8227743.html
时间: 2024-10-18 16:29:57