I am looking at the source code of the InstanceHardnessThreshold transformer from imbalanced-learn, here: https://github.com/scikit-learn-contrib/imbalanced-learn/blob/12b2e