You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Problems accepting pandas.SparseSeries as target #7352
for this value of r, roc_auc_score claims that y_true is constant. For other values of r the returned score is > 1.
A few points:
Users are unlikely to be making substantial memory savings when evaluating roc_auc_score with a sparse y_true. After all, the scores are dense so will occupy at least as much memory as one is attempting to save with a sparse structure.
Our metrics and estimators were not intended for and have not been tested with SparseSeries. We should, initially, raise an error when they are passed. (Contributor welcome.)
The current problem seems to come down to the fact that np.array(some_sparse_series) only returns the explicit data, i.e. no zeroes.
There is also quirky behaviour involving sparse series of non-floats: pd.SparseSeries([True, False, False, False, True])[[1,2,0,3,4]] returns a SparseSeries with a float64 dtype. (And taking np.array of the result returns an array of 2 floats. Hence some weirdness in roc_auc_score.)
The latter two points may constitute bugs or features for Pandas. I will post issues there.
Again a contributor is welcome to implement rejecting y as SparseSeries.
Hi, this is the guide to developers for contributing and setting up the environment. Also there is gitter where you can hop in and discuss. Hope it helps.
Yes, that is indeed unexpected, as @jnothman also notes in the top-post. He opened an issue about it, see the dicussion here: pandas-dev/pandas#14167
Summary: it was originally deliberately implemeted like that, but in the meantime we agree we should change it to return the dense values. The question is more when we would like to change that (which is not answered in the issue)
Activity
nielsenmarkus11 commentedon Sep 7, 2016
Thanks. I've corrected my code to add
pandas.SparseSeries.to_dense()in order to correct the problem.amueller commentedon Sep 7, 2016
hm after the
arrayconversion, the length shouldn't match any more, right? Shouldn't that throw us off?nielsenmarkus11 commentedon Sep 7, 2016
@amueller, these both returned the same results:
nielsenmarkus11 commentedon Sep 7, 2016
@jnothman, I can work on a solution for this one. Although, I'm a newbie to GitHub. How can I become a contributor?
maniteja123 commentedon Sep 8, 2016
Hi, this is the guide to developers for contributing and setting up the environment. Also there is gitter where you can hop in and discuss. Hope it helps.
nielsenmarkus11 commentedon Sep 8, 2016
Thanks @maniteja123!
InonS commentedon May 28, 2017
Hey, @nielsenmarkus11 , thanks for picking this up!
Any news? Maybe the milestone should be updated?
lesteve commentedon Jun 1, 2017
I am a bit confused about this one. It seems like the root of the problem is that:
Output:
Expected behaviour:
I am wondering whether pandas is to blame on this one. @jorisvandenbossche, if you can give your opinion on this one that would be great.
jorisvandenbossche commentedon Jun 1, 2017
Yes, that is indeed unexpected, as @jnothman also notes in the top-post. He opened an issue about it, see the dicussion here: pandas-dev/pandas#14167
Summary: it was originally deliberately implemeted like that, but in the meantime we agree we should change it to return the dense values. The question is more when we would like to change that (which is not answered in the issue)
lesteve commentedon Jun 1, 2017
OK thanks I did miss that in the top-post indeed.