ValueError: 'balanced_accuracy' is not a valid scoring value in scikit-learn
up vote
1
down vote
favorite
I tried to pass to GridSearchCV
other scoring metrics like balanced_accuracy
for Binary Classification (instead of the default accuracy
)
scoring = ['balanced_accuracy','recall','roc_auc','f1','precision']
validator = GridSearchCV(estimator=clf, param_grid=param_grid, scoring=scoring, refit=refit_scorer, cv=cv)
and got this error
ValueError: 'balanced_accuracy' is not a valid scoring value. Valid
options are
['accuracy','adjusted_mutual_info_score','adjusted_rand_score','average_precision','completeness_score','explained_variance','f1','f1_macro','f1_micro','f1_samples','f1_weighted','fowlkes_mallows_score','homogeneity_score','mutual_info_score','neg_log_loss','neg_mean_absolute_error','neg_mean_squared_error','neg_mean_squared_log_error','neg_median_absolute_error','normalized_mutual_info_score','precision','precision_macro','precision_micro','precision_samples','precision_weighted','r2','recall','recall_macro','recall_micro','recall_samples','recall_weighted','roc_auc','v_measure_score']
This is strange because 'balanced_accuracy' should be valid
Without defining balanced_accuracy
then the code works fine
scoring = ['recall','roc_auc','f1','precision']
Also the scoring metrics in the error above seems to be different from the ones in the document
Any ideas why? Thank you so much
scikit-learn
version is 0.19.2
python machine-learning scikit-learn metrics
add a comment |
up vote
1
down vote
favorite
I tried to pass to GridSearchCV
other scoring metrics like balanced_accuracy
for Binary Classification (instead of the default accuracy
)
scoring = ['balanced_accuracy','recall','roc_auc','f1','precision']
validator = GridSearchCV(estimator=clf, param_grid=param_grid, scoring=scoring, refit=refit_scorer, cv=cv)
and got this error
ValueError: 'balanced_accuracy' is not a valid scoring value. Valid
options are
['accuracy','adjusted_mutual_info_score','adjusted_rand_score','average_precision','completeness_score','explained_variance','f1','f1_macro','f1_micro','f1_samples','f1_weighted','fowlkes_mallows_score','homogeneity_score','mutual_info_score','neg_log_loss','neg_mean_absolute_error','neg_mean_squared_error','neg_mean_squared_log_error','neg_median_absolute_error','normalized_mutual_info_score','precision','precision_macro','precision_micro','precision_samples','precision_weighted','r2','recall','recall_macro','recall_micro','recall_samples','recall_weighted','roc_auc','v_measure_score']
This is strange because 'balanced_accuracy' should be valid
Without defining balanced_accuracy
then the code works fine
scoring = ['recall','roc_auc','f1','precision']
Also the scoring metrics in the error above seems to be different from the ones in the document
Any ideas why? Thank you so much
scikit-learn
version is 0.19.2
python machine-learning scikit-learn metrics
3
Please post the relevant code - as it is, there are not enough details for the question to be answered meaningfully. Also post your scikit-learn version (you can get it withsklearn.__version__)
)
– desertnaut
Nov 17 at 8:58
Thank you I added the code andscikit-learn
version
– Long
Nov 17 at 14:54
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I tried to pass to GridSearchCV
other scoring metrics like balanced_accuracy
for Binary Classification (instead of the default accuracy
)
scoring = ['balanced_accuracy','recall','roc_auc','f1','precision']
validator = GridSearchCV(estimator=clf, param_grid=param_grid, scoring=scoring, refit=refit_scorer, cv=cv)
and got this error
ValueError: 'balanced_accuracy' is not a valid scoring value. Valid
options are
['accuracy','adjusted_mutual_info_score','adjusted_rand_score','average_precision','completeness_score','explained_variance','f1','f1_macro','f1_micro','f1_samples','f1_weighted','fowlkes_mallows_score','homogeneity_score','mutual_info_score','neg_log_loss','neg_mean_absolute_error','neg_mean_squared_error','neg_mean_squared_log_error','neg_median_absolute_error','normalized_mutual_info_score','precision','precision_macro','precision_micro','precision_samples','precision_weighted','r2','recall','recall_macro','recall_micro','recall_samples','recall_weighted','roc_auc','v_measure_score']
This is strange because 'balanced_accuracy' should be valid
Without defining balanced_accuracy
then the code works fine
scoring = ['recall','roc_auc','f1','precision']
Also the scoring metrics in the error above seems to be different from the ones in the document
Any ideas why? Thank you so much
scikit-learn
version is 0.19.2
python machine-learning scikit-learn metrics
I tried to pass to GridSearchCV
other scoring metrics like balanced_accuracy
for Binary Classification (instead of the default accuracy
)
scoring = ['balanced_accuracy','recall','roc_auc','f1','precision']
validator = GridSearchCV(estimator=clf, param_grid=param_grid, scoring=scoring, refit=refit_scorer, cv=cv)
and got this error
ValueError: 'balanced_accuracy' is not a valid scoring value. Valid
options are
['accuracy','adjusted_mutual_info_score','adjusted_rand_score','average_precision','completeness_score','explained_variance','f1','f1_macro','f1_micro','f1_samples','f1_weighted','fowlkes_mallows_score','homogeneity_score','mutual_info_score','neg_log_loss','neg_mean_absolute_error','neg_mean_squared_error','neg_mean_squared_log_error','neg_median_absolute_error','normalized_mutual_info_score','precision','precision_macro','precision_micro','precision_samples','precision_weighted','r2','recall','recall_macro','recall_micro','recall_samples','recall_weighted','roc_auc','v_measure_score']
This is strange because 'balanced_accuracy' should be valid
Without defining balanced_accuracy
then the code works fine
scoring = ['recall','roc_auc','f1','precision']
Also the scoring metrics in the error above seems to be different from the ones in the document
Any ideas why? Thank you so much
scikit-learn
version is 0.19.2
python machine-learning scikit-learn metrics
python machine-learning scikit-learn metrics
edited Nov 17 at 14:53
asked Nov 17 at 7:54
Long
4418
4418
3
Please post the relevant code - as it is, there are not enough details for the question to be answered meaningfully. Also post your scikit-learn version (you can get it withsklearn.__version__)
)
– desertnaut
Nov 17 at 8:58
Thank you I added the code andscikit-learn
version
– Long
Nov 17 at 14:54
add a comment |
3
Please post the relevant code - as it is, there are not enough details for the question to be answered meaningfully. Also post your scikit-learn version (you can get it withsklearn.__version__)
)
– desertnaut
Nov 17 at 8:58
Thank you I added the code andscikit-learn
version
– Long
Nov 17 at 14:54
3
3
Please post the relevant code - as it is, there are not enough details for the question to be answered meaningfully. Also post your scikit-learn version (you can get it with
sklearn.__version__)
)– desertnaut
Nov 17 at 8:58
Please post the relevant code - as it is, there are not enough details for the question to be answered meaningfully. Also post your scikit-learn version (you can get it with
sklearn.__version__)
)– desertnaut
Nov 17 at 8:58
Thank you I added the code and
scikit-learn
version– Long
Nov 17 at 14:54
Thank you I added the code and
scikit-learn
version– Long
Nov 17 at 14:54
add a comment |
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
Update your sklearn to the latest version if you want to use balanced_accuracy
. As you can see from the 0.19 documentation balanced_accuracy
is not a valid scoring metric. It was added in 0.20.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
Update your sklearn to the latest version if you want to use balanced_accuracy
. As you can see from the 0.19 documentation balanced_accuracy
is not a valid scoring metric. It was added in 0.20.
add a comment |
up vote
2
down vote
accepted
Update your sklearn to the latest version if you want to use balanced_accuracy
. As you can see from the 0.19 documentation balanced_accuracy
is not a valid scoring metric. It was added in 0.20.
add a comment |
up vote
2
down vote
accepted
up vote
2
down vote
accepted
Update your sklearn to the latest version if you want to use balanced_accuracy
. As you can see from the 0.19 documentation balanced_accuracy
is not a valid scoring metric. It was added in 0.20.
Update your sklearn to the latest version if you want to use balanced_accuracy
. As you can see from the 0.19 documentation balanced_accuracy
is not a valid scoring metric. It was added in 0.20.
answered Nov 17 at 15:03
Mihai Chelaru
2,0177820
2,0177820
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53349331%2fvalueerror-balanced-accuracy-is-not-a-valid-scoring-value-in-scikit-learn%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
3
Please post the relevant code - as it is, there are not enough details for the question to be answered meaningfully. Also post your scikit-learn version (you can get it with
sklearn.__version__)
)– desertnaut
Nov 17 at 8:58
Thank you I added the code and
scikit-learn
version– Long
Nov 17 at 14:54