Merge pull request #594 from Far0n/feval
python: multiple eval_metrics changes
This commit is contained in:
@@ -67,10 +67,17 @@ XGBoost use list of pair to save [parameters](../parameter.md). Eg
|
||||
```python
|
||||
param = {'bst:max_depth':2, 'bst:eta':1, 'silent':1, 'objective':'binary:logistic' }
|
||||
param['nthread'] = 4
|
||||
plst = param.items()
|
||||
plst += [('eval_metric', 'auc')] # Multiple evals can be handled in this way
|
||||
plst += [('eval_metric', 'ams@0')]
|
||||
param['eval_metric'] = 'auc'
|
||||
```
|
||||
* You can also specify multiple eval metrics:
|
||||
```python
|
||||
param['eval_metric'] = ['auc', 'ams@0']
|
||||
|
||||
# alternativly:
|
||||
# plst = param.items()
|
||||
# plst += [('eval_metric', 'ams@0')]
|
||||
```
|
||||
|
||||
* Specify validations set to watch performance
|
||||
```python
|
||||
evallist = [(dtest,'eval'), (dtrain,'train')]
|
||||
@@ -116,7 +123,7 @@ The model will train until the validation score stops improving. Validation erro
|
||||
|
||||
If early stopping occurs, the model will have two additional fields: `bst.best_score` and `bst.best_iteration`. Note that `train()` will return a model from the last iteration, not the best one.
|
||||
|
||||
This works with both metrics to minimize (RMSE, log loss, etc.) and to maximize (MAP, NDCG, AUC).
|
||||
This works with both metrics to minimize (RMSE, log loss, etc.) and to maximize (MAP, NDCG, AUC). Note that if you specify more than one evaluation metric the last one in `param['eval_metric']` is used for early stopping.
|
||||
|
||||
Prediction
|
||||
----------
|
||||
|
||||
Reference in New Issue
Block a user