8000 Add gen by coding-famer · Pull Request #800 · cleanlab/cleanlab · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add gen #800

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

Merged
merged 14 commits into from
Aug 30, 2023
Merged

Add gen #800

merged 14 commits into from
Aug 30, 2023

Conversation

coding-famer
Copy link
Contributor

Add GEN as new pred_probs based out-of-distribution detection method. For #728.

@CLAassistant
Copy link
CLAassistant commented Aug 8, 2023

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link
codecov bot commented Aug 8, 2023

Codecov Report

Patch coverage: 77.77% and project coverage change: -0.04% ⚠️

Comparison is base (4ce9f77) 96.73% compared to head (1ccd6ca) 96.69%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #800      +/-   ##
==========================================
- Coverage   96.73%   96.69%   -0.04%     
==========================================
  Files          65       65              
  Lines        5077     5084       +7     
  Branches      880      882       +2     
==========================================
+ Hits         4911     4916       +5     
- Misses         85       86       +1     
- Partials       81       82       +1     
Files Changed Coverage Δ
cleanlab/outlier.py 97.84% <77.77%> (-2.16%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

)
probs = softmax(pred_probs, axis=1)
probs_sorted = np.sort(probs, axis=1)[:,-M:]
ood_predictions_scores = -np.sum(probs_sorted**gamma * (1 - probs_sorted)**(gamma), axis=1)
Copy link
Member

Choose a reason for hiding this comment

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

please confirm:

You are transforming the GEN scores (posthoc) to ensure they lie in 0-1 and smaller values == datapoints that are more severe outliers

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To transform the GEN scores to lie in 0-1, I use 1-ori_gen_score/M as the output ood prediction scores. Please let me know if you have other ideas.

Copy link
Member

Choose a reason for hiding this comment

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

seems fine to me. Please add:

  1. a comment in the code clarifying that you're doing this
  2. a unit test that ensures all values are in 0-1 range, and smallest values are the outliers in a toy dataset

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes I have already added the unit test to ensure all values are in 0-1 range. And for the smallest values things, I saw your another comment. Yes the ood score will be 1 for both entropy and least_confidence methods because the prediction confidence will be 1 for that datapoint. I tried using the mean of three means of data distribution and it works well for me.

@jwmueller jwmueller requested a review from elisno August 21, 2023 22:27
@jwmueller jwmueller self-requested a review August 30, 2023 05:29
Copy link
Member
@jwmueller jwmueller left a comment

Choose a reason for hiding this comment

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

Thanks for your great contribution @coding-famer!
We really appreciate all of your benchmarking efforts.

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.

4 participants
0