Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

[BUG] TuneBaseSearchCV: Multiple scores as dictionary #246

Open
felipemonroy opened this issue Jun 17, 2022 · 0 comments
Open

[BUG] TuneBaseSearchCV: Multiple scores as dictionary #246

felipemonroy opened this issue Jun 17, 2022 · 0 comments

Comments

@felipemonroy
Copy link

felipemonroy commented Jun 17, 2022

Hi everyone,

I am having issues when using TuneSearch CV and a dictionary of scores. The dictionary is the following:

from sklearn.metrics import make_scorer, cohen_kappa_score

{
    'kappa': make_scorer(cohen_kappa_score), 
    'kappa_quadratic': make_scorer(cohen_kappa_score, weights="quadratic")
}

The problem is in the method _format_results of the TuneBaseSearchCV class. Specifically, when creating the test_scores and train_scores dictionaries. Here is the code:

        test_scores = {}
        train_scores = {}
        for name in self.scoring_:
            test_scores[name] = [
                df[
                    [
                        col
                        for col in dfs[0].columns
                        if "split" in col and "test_%s" % name in col
                    ]
                ].to_numpy()
                for df in finished
            ]

So, when doing if "split" in col and "test_%s" % name in col for the score kappa the results of both scores (kappa and kappa_quadratic) are returned, causing an error downstream.

Now I am using scores names that avoid that confusion, but it took me a while to figure it out.

ray: 1.13.0
tune-sklearn: 0.4.3

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant