Skip to content

Commit dc9e21d

Browse files
author
William de Vazelhes
committed
FIX fix docstrings of decision functions
1 parent d12729a commit dc9e21d

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

metric_learn/base_metric.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -335,10 +335,12 @@ def predict(self, pairs):
335335
return - 2 * (self.decision_function(pairs) > self.threshold_) + 1
336336

337337
def decision_function(self, pairs):
338-
"""Returns the learned metric between input pairs.
338+
"""Returns the decision function used to classify the pairs.
339339
340-
Returns the learned metric value between samples in every pair. It should
341-
ideally be low for similar samples and high for dissimilar samples.
340+
Returns the opposite of the learned metric value between samples in every
341+
pair. Hence it should ideally be low for dissimilar samples and high for
342+
similar samples. This is the decision function that is used to classify
343+
pairs as similar (+1), or dissimilar (-1).
342344
343345
Parameters
344346
----------
@@ -350,7 +352,7 @@ def decision_function(self, pairs):
350352
Returns
351353
-------
352354
y_predicted : `numpy.ndarray` of floats, shape=(n_constraints,)
353-
The predicted learned metric value between samples in every pair.
355+
The predicted decision function value for each pair.
354356
"""
355357
pairs = check_input(pairs, type_of_inputs='tuples',
356358
preprocessor=self.preprocessor_,
@@ -426,8 +428,12 @@ def predict(self, quadruplets):
426428
def decision_function(self, quadruplets):
427429
"""Predicts differences between sample distances in input quadruplets.
428430
429-
For each quadruplet of samples, computes the difference between the learned
430-
metric of the first pair minus the learned metric of the second pair.
431+
For each quadruplet in the samples, computes the difference between the
432+
learned metric of the second pair minus the learned metric of the first
433+
pair. The higher it is, the more probable it is that the pairs in the
434+
quadruplet are presented in the right order, i.e. that the label of the
435+
quadruplet is 1. The lower it is, the more probable it is that the label of
436+
the quadruplet is -1.
431437
432438
Parameters
433439
----------

0 commit comments

Comments
 (0)