Skip to content

[WIP] add balanced_accuracy_score metric #3506 #3929

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

[WIP] add balanced_accuracy_score metric #3506 #3929

wants to merge 1 commit into from

Conversation

ppuggioni
Copy link
Contributor

It refers to the issue #3506

  • It passes all the common tests for metrics and regression metrics, but I still need to implement specific tests.
  • It might be a duplicate of the work done by @lazywei at [WIP] balanced accuracy score #3511 , so I will compare the two versions

@lazywei
Copy link
Contributor

lazywei commented Dec 3, 2014

Oh, so should I close mine PR? There are still some TODOs in my PR that I haven't finished though.
Great work 👍

y_type, y_true, y_pred = _check_targets(y_true, y_pred)

if y_type != "binary":
raise ValueError("%s is not supported" % y_type)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should multilabel be supported?

@jmetzen
Copy link
Member

jmetzen commented Dec 14, 2014

Would be nice to add an example illustrating possible use-cases of balanced accuracy. For instance a binary classification task with highly imbalanced classes, where a classifier which assigns everything to the majority class obtains high accuracy but low balanced-accuracy.

@jnothman
Copy link
Member

I'm not sure if the documentation has a similar example for P/R/F, but an
annotated comparison between them (accuracy, balanced accuracy, P, R, AUC)
makes some sense.

On 14 December 2014 at 23:45, Jan Hendrik Metzen notifications@github.com
wrote:

Would be nice to add an example illustrating possible use-cases of
balanced accuracy. For instance a binary classification task with highly
imbalanced classes, where a classifier which assigns everything to the
majority class obtains high accuracy but low balanced-accuracy.


Reply to this email directly or view it on GitHub
#3929 (comment)
.

@ppuggioni
Copy link
Contributor Author

I think adding an example would be a good idea. I will work on the comment by @jnothman and then on an example in a couple of weeks during the christmas break!

or label indicator array / sparse matrix Predicted labels, as returned
by a classifier.

c : is the cost associated with the misclassification of a positive example.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no one-letter parameters ;)

@amueller
Copy link
Member

The other PR says
In binary and multiclass classification, this function is equal to thejaccard_similarity_scorefunction.
So if this is added the addition is for multi-label indicator, right?

@xuewei4d
Copy link
Contributor

@amueller No. I don't think so. For example,

>>> jaccard_similarity_score(np.array([[0,0,1,1,1]]), np.array([[1, 1,1,0, 1]]))
0.4
>>> balanced_accuracy_score(np.array([0,0,1,1,1]), np.array([1,1,1,0,1]))
0.33333333333333331

The wikipedia definition of jaccard similarity http://en.wikipedia.org/wiki/Jaccard_index#Similarity_of_asymmetric_binary_attributes
is quite different from
http://en.wikipedia.org/wiki/Accuracy_and_precision#In_binary_classification.

@arjoly
Copy link
Member

arjoly commented Oct 24, 2015

closed in favor of #5588

@arjoly arjoly closed this Oct 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants