Skip to content

sklearn fit silently drops or errors when length of eval_set and sample_weights do not match #4913

@mmccarty

Description

@mmccarty

XGBModel.fit packages the evals into a list of DMatrix objects by iterating over a range generated by the length of the given eval_set. However, when the user provides eval_set=[(x1, y2), (x2, y2)], sample_weight_eval_set=[weight1] the evals list will have silently dropped the second set. When the user provides eval_set=[(x1, y2)], sample_weight_eval_set=[weight1, weight2] an index exception is raised.

We discovered this when discussing and testing a PR adding early_stopping to dask-xgboost. We are wondering what is the right thing to do in this case? Raise an exception? Or do nothing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions