Skip to content

[MRG] implement InstanceHardnessCV #1125

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

Open
wants to merge 21 commits into
base: master
Choose a base branch
from

Conversation

fritshermans
Copy link

@fritshermans fritshermans commented Jan 31, 2025

As discussed on LinkedIn with @glemaitre, I implemented the InstanceHardnessCV splitter as described in my blog post.

'Instance hardness' refers to the difficulty to classify an instance. The way hard-to-classify instances are distributed over train and test sets has significant effect on the test set performance metrics.

Todo:

  • add example to examples/ folder
  • write documentation

@fritshermans
Copy link
Author

I made a small change in the way samples with large instance hardness are distributed over the folds. I first sort by label and then by proba before assigning the folds. Documentation is now also created. Let me know if there are questions or if there's something more I can do!

@fritshermans fritshermans changed the title [WIP] implement InstanceHardnessCV implement InstanceHardnessCV Mar 30, 2025
@fritshermans fritshermans changed the title implement InstanceHardnessCV [MRG] implement InstanceHardnessCV Mar 30, 2025
@glemaitre
Copy link
Member

Since I was late to review and I'm planning a release, I took the liberty to push a couple of changes directly. @fritshermans It looks really good already. I just change the module name to align on the scikit-learn naming (cross_validation was unfortunate because it is an old name of a deprecated module). I change slightly the API to not depend on a random state and always request an estimator and handle the positive label properly.

We could extend later for multiclass if it makes any sense then.

@fritshermans
Copy link
Author

Thanks for looking into this Guillaume! Please let me know if there's anything I can do now ☺️

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.

2 participants