我正在學習 XGBoost,并且 mae 和 rmse 數字如此之大,這怎么可能?
這是我在 python 中使用的代碼
# Create the DMatrix: housing_dmatrix
housing_dmatrix = xgb.DMatrix(data=X, label=y)
# Create the parameter dictionary: params
params = {"objective":"reg:linear", "max_depth":4}
# Perform cross-validation: cv_results
cv_results = xgb.cv(dtrain=housing_dmatrix, params=params, nfold=4, num_boost_round=5, metrics="rmse", as_pandas=True, seed=123)
# Print cv_results
print(cv_results)
# Extract and print final boosting round metric
print((cv_results["test-rmse-mean"]).tail(1))
train-rmse-mean train-rmse-std test-rmse-mean test-rmse-std
0 141767.535156 429.452682 142980.429688 1193.794436
1 102832.542969 322.473304 104891.392578 1223.157623
2 75872.617187 266.469946 79478.935547 1601.344218
3 57245.651367 273.625016 62411.921875 2220.149857
4 44401.297851 316.422372 51348.281250 2963.378741
51348.28125
uj5u.com熱心網友回復:
我認為您的問題是解釋指標。首先,我將解釋它的用途:
- MSE代表均方誤差和
- RMSE表示均方根誤差
這意味著這兩個指標都取決于預測值的大小。如果您預測一輛車的座位數在 2 到 7 之間變化,那么您的RMSE非常大。另一方面,如果您預測的值介于 1 到 1 億之間,則RMSE非常低。這就是為什么您應該使用其他一些指標的主要原因,例如MAPE(平均絕對百分比誤差),它會給您0 和 1 之間的值。
查看此鏈接以獲取有關 MAPE 以及如何使用 scikit-learn 使用它的更多資訊。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/339248.html
標籤:Python 机器学习 统计数据 回归 xgboost
上一篇:使用Keras將Dropout層添加到Segmentation_ModelsResnet34
下一篇:使用networkx繪制多部分圖
