import numpy
as
npfrom sklearn.linear_model import LinearRegressionfrom sklearn.model_selection import train_test_split
X=data[[
'work'
,
'work_time'
,
'work_salary'
,
'work_address'
,
'worker_number'
,
'month_income'
,
'total_area'
,
'own_area'
,
'rend_area'
,
'out_area'
,
'agricultal_income'
,
'things'
,
'wifi'
,
'internet_fee'
,
'cloth_outcome'
,
'education_outcome'
,
'medcine_outcome'
,
'person_medicne_outcome'
,
'relationship_outcome'
,
'food_outcome'
,
'entertainment_outcome'
,
'agriculta_outcome'
,
'other_outcome'
,
'owe'
,
'owe_total'
,
'debt'
,
'debt_way'
,
'distance_debt'
,
'distance_market'
,
'traffic_'
,
'express'
,
'express_distance'
,
'exercise'
,
'satisfac'
,
'wifi_neghbor'
,
'wifi_relative'
,
'wifi_frend'
,
'internet'
,
'medical_insurance'
]]y=data[
'total_income'
]model=LinearRegression().fit(X,y)#拟合模型model.score(X,y)#拟合优度model.coef_#查看拟合系数model.intercept_#查看拟合截距项model.predict(np.
array
(X.ix[25,:]).reshape(1,-1))#预测model.get_params()#得到模型的参数