" 2. Support Vector Machine Regression 支持向量机回归\n",
" 3. Random Forest Regression\n",
" 3. Random Forest Regression随机森林回归\n",
" 4. Gradient Boosting Regression\n",
" 4. Gradient Boosting Regression GBDT回归\n",
" 5. K-Nearest Neighbors Regression\n",
" 5. K-Nearest Neighbors Regression K近邻回归\n",
"\n",
"\n",
"这里先使用默认参数,后续再调参"
"这里先使用默认参数,后续再调参"
]
]
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 12,
"execution_count": 11,
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [],
"source": [
"source": [
@ -1009,7 +1034,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 13,
"execution_count": 12,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
@ -1029,7 +1054,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 14,
"execution_count": 13,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
@ -1049,17 +1074,9 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 15,
"execution_count": 14,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"D:\\Anaconda3\\lib\\site-packages\\sklearn\\ensemble\\forest.py:245: FutureWarning: The default value of n_estimators will change from 10 in version 0.20 to 100 in 0.22.\n",
" \"10 in version 0.20 to 100 in 0.22.\", FutureWarning)\n"
"[15:35:29] WARNING: C:/Jenkins/workspace/xgboost-win64_release_0.90/src/objective/regression_obj.cu:152: reg:linear is now deprecated in favor of reg:squarederror.\n",
"XGBoost Regression Performance on the test set: MAE = 9.9936\n"
]
}
],
"source": [
"import xgboost as xgb\n",
"xgb_model = xgb.XGBRegressor()\n",
"xgb_mae = fit_and_evaluate(xgb_model)\n",
"\n",
"print('XGBoost Regression Performance on the test set: MAE = %0.4f' % xgb_mae)"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"lightgbm Regression Performance on the test set: MAE = 9.3751\n"
]
}
],
"source": [
"import lightgbm as lgb\n",
"lgb_model = lgb.LGBMRegressor()\n",
"lgb_mae = fit_and_evaluate(lgb_model)\n",
"print('lightgbm Regression Performance on the test set: MAE = %0.4f' % lgb_mae)"
"D:\\Anaconda3\\lib\\site-packages\\sklearn\\ensemble\\forest.py:245: FutureWarning: The default value of n_estimators will change from 10 in version 0.20 to 100 in 0.22.\n",
" \"10 in version 0.20 to 100 in 0.22.\", FutureWarning)\n"
"[15:35:29] WARNING: C:/Jenkins/workspace/xgboost-win64_release_0.90/src/objective/regression_obj.cu:152: reg:linear is now deprecated in favor of reg:squarederror.\n",
"XGBoost Regression Performance on the test set: MAE = 9.9936\n"
]
}
],
"source": [
"import xgboost as xgb\n",
"xgb_model = xgb.XGBRegressor()\n",
"xgb_mae = fit_and_evaluate(xgb_model)\n",
"\n",
"print('XGBoost Regression Performance on the test set: MAE = %0.4f' % xgb_mae)"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"lightgbm Regression Performance on the test set: MAE = 9.3751\n"
]
}
],
"source": [
"import lightgbm as lgb\n",
"lgb_model = lgb.LGBMRegressor()\n",
"lgb_mae = fit_and_evaluate(lgb_model)\n",
"print('lightgbm Regression Performance on the test set: MAE = %0.4f' % lgb_mae)"