41134f440773c308f5224e70cd060286be6d5dd4,UnbalancedDataset.py,TomekLinks,resample,#TomekLinks#,549
Before Change
from sklearn.neighbors import NearestNeighbors
// Find the nearest neighbour of every point
print("Finding nearest neighbour...", end="")
nn = NearestNeighbors(n_neighbors=2)
nn.fit(self.x)
nns = nn.kneighbors(self.x, return_distance=False)[:, 1]
print("done!")
After Change
print("Looking for majority Tomek links...")
links = self.is_tomek(self.y, nns, self.minc, self.verbose)
if self.verbose==True:
print("Under-sampling performed: " + str(Counter(self.y[logical_not(links)])))
// Return data set without majority Tomek links.
return self.x[logical_not(links)], self.y[logical_not(links)]
class ClusterCentroids(UnbalancedDataset):
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 10
Instances Project Name: scikit-learn-contrib/imbalanced-learn
Commit Name: 41134f440773c308f5224e70cd060286be6d5dd4
Time: 2015-05-27
Author: glemaitre@visor.udg.edu
File Name: UnbalancedDataset.py
Class Name: TomekLinks
Method Name: resample
Project Name: scikit-learn-contrib/imbalanced-learn
Commit Name: 41134f440773c308f5224e70cd060286be6d5dd4
Time: 2015-05-27
Author: glemaitre@visor.udg.edu
File Name: UnbalancedDataset.py
Class Name: SMOTETomek
Method Name: resample
Project Name: scikit-learn-contrib/imbalanced-learn
Commit Name: 41134f440773c308f5224e70cd060286be6d5dd4
Time: 2015-05-27
Author: glemaitre@visor.udg.edu
File Name: UnbalancedDataset.py
Class Name: OneSidedSelection
Method Name: resample