Skip to content
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

gini can be negative by your code #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

arthur-yh
Copy link

Gini index can be evaluated to be negative by your code, "The Gini coefficient is double of the area between the Lorenz Curve and the 45◦ diagonal line", so in your code metrics.py::line56, it should be like raw = df.apply(lambda x: abs(2 * x.sum() / df.shape[0] - 1.))
while I push a mr to you which shows a example of gini can be negative and it pass the unitest .
this case shows a bad model which predict high-life-value users's scores lowest, so it's gini is negative since it's line is under the Lorenz Curve.

Copy link

google-cla bot commented Aug 8, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

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.

1 participant