from numpy import genfromtxt import numpy as npy from sklearn import datasets,linear_model filepath=r"G:\六西格玛\第一阶段-深度学习基础\代码与素材\代码与素材(2)\MachineLearning\MultiLinearRegression\Delivery.csv" data=genfromtxt(filepath,delimiter=',')#从文本文件中提取数据并且转换为数组格式,delimoter是分隔符,csv文件的分隔符是逗号 print(data) x=data[1:,0:2] y=data[1:,2] print(x) print(y) mlr=linear_model.LinearRegression() mlr.fit(x,y) print(mlr.coef_) print(mlr.intercept_) test_x=[[102,6]] test_y=mlr.predict(test_x) print(test_y)