h2oai / driverlessai-recipes

Recipes for Driverless AI
Apache License 2.0
240 stars 93 forks source link

Migrate call to label_binarize to scikit-learn 1.1.3 #195

Closed rsujeevan closed 7 months ago

rsujeevan commented 7 months ago

Fixes DAI tests that are failing with the error

[2024-04-11T01:34:38.293Z] Traceback (most recent call last):
[2024-04-11T01:34:38.293Z]   File "/h2oai/h2oaicore/metrics.py", line 666, in test_scorer
[2024-04-11T01:34:38.293Z]     self.test_scorer_sanity(actuals1, preds1, None, labels1)
[2024-04-11T01:34:38.293Z]   File "/h2oai/h2oaicore/metrics.py", line 939, in test_scorer_sanity
[2024-04-11T01:34:38.293Z]     ret = self.score_base(actual=actuals, predicted=preds, sample_weight=sample_weight, labels=labels, **kwargs)
[2024-04-11T01:34:38.293Z]           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[2024-04-11T01:34:38.293Z]   File "/h2oai/h2oaicore/metrics.py", line 212, in score_base
[2024-04-11T01:34:38.293Z]     score = self.score(actual=actual, predicted=predicted,
[2024-04-11T01:34:38.293Z]             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[2024-04-11T01:34:38.293Z]   File "/h2oai/tests/contrib/scorers/custom_scorers.py", line 605, in score
[2024-04-11T01:34:38.293Z]     enc_actual = label_binarize(enc_actual, labels).ravel()
[2024-04-11T01:34:38.293Z]                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[2024-04-11T01:34:38.293Z] TypeError: label_binarize() takes 1 positional argument but 2 were given