Skip to content

Commit

Permalink
weight corrections in all measures
Browse files Browse the repository at this point in the history
  • Loading branch information
giba0 committed Nov 11, 2018
1 parent 8b922a5 commit 774c6c7
Showing 1 changed file with 9 additions and 22 deletions.
31 changes: 9 additions & 22 deletions src/skmultiflow/metrics/measure_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ def reset(self):
self.exact_match_count = 0
self.j_sum = 0

def add_result(self, y_true, y_pred, weight=1.0):
def add_result(self, y_true, y_pred):
""" Updates its statistics with the results of a prediction.
Adds the result to the MOLConfusionMatrix and update exact_matches and
Expand All @@ -609,11 +609,8 @@ def add_result(self, y_true, y_pred, weight=1.0):
y_pred: list or numpy.ndarray
The classifier's prediction
weight: float
Sample's weight
"""
check_weights(weight)

self.last_true_label = y_true
self.last_prediction = y_pred
m = 0
Expand All @@ -624,7 +621,7 @@ def add_result(self, y_true, y_pred, weight=1.0):
self.n_targets = m
equal = True
for i in range(m):
self.confusion_matrix.update(i, y_true[i], y_pred[i], weight=weight)
self.confusion_matrix.update(i, y_true[i], y_pred[i])
# update exact_match count
if y_true[i] != y_pred[i]:
equal = False
Expand Down Expand Up @@ -786,7 +783,7 @@ def reset(self):
self.true_labels = FastComplexBuffer(self.window_size, self.n_targets)
self.predictions = FastComplexBuffer(self.window_size, self.n_targets)

def add_result(self, y_true, y_pred, weight=1.0):
def add_result(self, y_true, y_pred):
""" Updates its statistics with the results of a prediction.
Adds the result to the MOLConfusionMatrix, and updates the
Expand All @@ -800,11 +797,8 @@ def add_result(self, y_true, y_pred, weight=1.0):
y_pred: list or numpy.ndarray
The classifier's prediction
weight: float
Sample's weight
"""
check_weights(weight)

self.last_true_label = y_true
self.last_prediction = y_pred
m = 0
Expand All @@ -815,7 +809,7 @@ def add_result(self, y_true, y_pred, weight=1.0):
self.n_targets = m

for i in range(m):
self.confusion_matrix.update(i, y_true[i], y_pred[i],weight=weight)
self.confusion_matrix.update(i, y_true[i], y_pred[i])

old_true = self.true_labels.add_element(y_true)
old_predict = self.predictions.add_element(y_pred)
Expand Down Expand Up @@ -927,7 +921,7 @@ def reset(self):
self.last_true_label = None
self.last_prediction = None

def add_result(self, y_true, y_pred, weight=1.0):
def add_result(self, y_true, y_pred):
""" Use the true value and the prediction to update the statistics.
Parameters
Expand All @@ -938,11 +932,7 @@ def add_result(self, y_true, y_pred, weight=1.0):
y_pred: float
The predicted value.
weight: float
Sample's weight
"""
check_weights(weight)
self.last_true_label = y_true
self.last_prediction = y_pred

Expand Down Expand Up @@ -1118,7 +1108,7 @@ def reset(self):
self.last_true_label = None
self.last_prediction = None

def add_result(self, y, prediction, weight=1.0):
def add_result(self, y, prediction):
""" Use the true value and the prediction to update the statistics.
Parameters
Expand All @@ -1132,11 +1122,8 @@ def add_result(self, y, prediction, weight=1.0):
prediction: float or list or np.ndarray
The predicted value(s).
weight: float
Sample's weight
"""
check_weights(weight)

self.last_true_label = y
self.last_prediction = prediction

Expand Down

0 comments on commit 774c6c7

Please sign in to comment.