Skip to content

Conversation

fritshermans
Copy link
Contributor

@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
Contributor 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
Contributor Author

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

@glemaitre glemaitre changed the title [MRG] implement InstanceHardnessCV FEA implement InstanceHardnessCV cross-validation splitter Aug 14, 2025
@glemaitre glemaitre merged commit 367fb90 into scikit-learn-contrib:master Aug 14, 2025
30 checks passed
@glemaitre
Copy link
Member

All good. Thanks @fritshermans.

It should be released in the day :).

@fritshermans
Copy link
Contributor Author

Thanks a lot Guillaume! I'm very happy with this! 🍾

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