aa6af82f458acf3f853e5174d34b11d319eea1c0,unbalanced_dataset/under_sampling/instance_hardness_threshold.py,InstanceHardnessThreshold,transform,#InstanceHardnessThreshold#,189
Before Change
mask = probabilities >= self.threshold
elif self.kind_sel == "maj":
ratios = np.zeros(100, )
probs = np.linspace(0., 1., 100)
for i, p in enumerate(probs):
ratios[i] = self.stats_c_[self.min_c_] / np.count_nonzero(np.logical_or(probabilities >= p, y == self.min_c_))
ratios = np.abs(ratios - self.ratio)
threshold = probs[ratios.argmin()]
mask = np.logical_or(probabilities >= self.threshold, y == self.min_c_)
X_resampled = X[mask]
y_resampled = y[mask]
After Change
mask = probabilities >= self.ratio_
elif self.kind_sel == "maj":
min_count = np.sum(y == self.min_c_)
max_count = len(y) - min_count
rem_count = max_count - (min_count / self.ratio_)
threshold = np.percentile(probabilities[y != self.min_c_],
100*(rem_count/max_count))
mask = np.logical_or(probabilities >= threshold, y == self.min_c_)
X_resampled = X[mask]
y_resampled = y[mask]
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 8
Instances
Project Name: scikit-learn-contrib/imbalanced-learn
Commit Name: aa6af82f458acf3f853e5174d34b11d319eea1c0
Time: 2016-06-17
Author: victor.dvro@gmail.com
File Name: unbalanced_dataset/under_sampling/instance_hardness_threshold.py
Class Name: InstanceHardnessThreshold
Method Name: transform
Project Name: daavoo/pyntcloud
Commit Name: 59ec6660464bd378b20d4ae200c7614133a9a38b
Time: 2019-08-26
Author: hc.wang96@gmail.com
File Name: pyntcloud/samplers/points.py
Class Name: FarthestPointsSampler
Method Name: compute
Project Name: facebookresearch/pytext
Commit Name: 900b9a7f2884aaf419e62508be7497b0ad3e1f62
Time: 2021-02-24
Author: debo@fb.com
File Name: pytext/metric_reporters/squad_metric_reporter.py
Class Name: SquadMetricReporter
Method Name: _unnumberize