Skip to content

Commit cbfa74c

Browse files
osanai-hisashiglemaitre
authored andcommitted
FIX Remove unused variable (#225)
The variable "count" is NOT used in tomek_links.py. So this patch removed it as a minor refactoring.
1 parent 26b19cc commit cbfa74c

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

imblearn/under_sampling/tomek_links.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,8 @@ def is_tomek(y, nn_index, class_type):
103103
104104
"""
105105

106-
# Initialize the boolean result as false, and also a counter
106+
# Initialize the boolean result as false.
107107
links = np.zeros(len(y), dtype=bool)
108-
count = 0
109108

110109
# Loop through each sample and looks whether it belongs to the minority
111110
# class. If it does, we don't consider it since we want to keep all
@@ -119,11 +118,9 @@ def is_tomek(y, nn_index, class_type):
119118

120119
if y[nn_index[ind]] == class_type:
121120

122-
# If they form a tomek link, put a True marker on this
123-
# sample, and increase counter by one.
121+
# If they form a tomek link, put a True marker on this sample.
124122
if nn_index[nn_index[ind]] == ind:
125123
links[ind] = True
126-
count += 1
127124

128125
return links
129126

0 commit comments

Comments
 (0)