Azhad Syed
Azhad Syed

Reputation: 63

XGBoostError: Unknown metric function mape

I'm trying to predict price using this train dataset, but I can't seem to use the MAPE eval_metric even though it is a documented option for the parameter. Is anyone else having this problem?

dtrain = xgb.DMatrix(X_train_transformed, label = y_train)
dval = xgb.DMatrix(X_val_transformed, label = y_val)

param = {'max_depth': 2, 'eta': 1, 'objective': 'reg:squarederror', 'eval_metric': 'mape'}
evallist = [(dtrain, 'train'), (dval, 'eval')]
num_round = 100
bst = xgb.train (param, dtrain, num_round, evallist, early_stopping_rounds=10)
XGBoostError: [14:45:32] C:\Users\Administrator\workspace\xgboost-win64_release_1.2.0\src\metric\metric.cc:49: Unknown metric function mape

again, the code runs perfectly with eval_metric = mae or rmse, but just not mape.

Upvotes: 1

Views: 2594

Answers (1)

JAV
JAV

Reputation: 675

MAPE is upcoming functionality not included in 1.2.0. Here's the commit if you want to take a look.

Upvotes: 1

Related Questions