多元线性回归1

import numpy as npy
import pandas as pda
from sklearn import linear_model
filepath="G:/Delivery.csv"
data=pda.read_csv(filepath,encoding="gbk")
print(data)
x=data.iloc[:,0:2].as_matrix()
y=data.iloc[:,2].as_matrix()
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)

你可能感兴趣的:(python)