W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
python_ml_multiple_regression.py:
import pandas from sklearn import linear_model df = pandas.read_csv("cars.csv") X = df[['Weight', 'Volume']] y = df['CO2'] regr = linear_model.LinearRegression() regr.fit(X, y) #predict the CO2 emission of a car where the weight is 2300g, and the volume is 1300ccm: predictedCO2 = regr.predict([[2300, 1300]]) print(predictedCO2)