Skip to content

Commit 6be7bc9

Browse files
committed
fix rca examples
1 parent 6c9dea2 commit 6be7bc9

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

doc/weakly_supervised.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -518,17 +518,17 @@ as the Mahalanobis matrix.
518518

519519
from metric_learn import RCA
520520

521-
pairs = [[[1.2, 7.5], [1.3, 1.5]],
522-
[[6.4, 2.6], [6.2, 9.7]],
523-
[[1.3, 4.5], [3.2, 4.6]],
524-
[[6.2, 5.5], [5.4, 5.4]]]
525-
y = [1, 1, -1, -1]
521+
X = [[1.2, 7.5], [1.3, 1.5],
522+
[6.4, 2.6], [6.2, 9.7],
523+
[1.3, 4.5], [3.2, 4.6],
524+
[6.2, 5.5], [5.4, 5.4]]
525+
chunks = [1, 1, 2, 2, 1, 1, 2, 2]
526526

527-
# in this task we want points where the first feature is close to be closer
528-
# to each other, no matter how close the second feature is
527+
# in this task we want points that belong to the same class as indicated
528+
# by chunks but not necesarily assest which chunks belong to wich class
529529

530530
rca = RCA()
531-
rca.fit(pairs, y)
531+
rca.fit(X, chunks)
532532

533533
.. topic:: References:
534534

metric_learn/rca.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,17 @@ class RCA(MahalanobisMixin, TransformerMixin):
6363
Examples
6464
--------
6565
>>> from metric_learn import RCA
66-
>>> pairs = [[[1.2, 7.5], [1.3, 1.5]],
67-
>>> [[6.4, 2.6], [6.2, 9.7]],
68-
>>> [[1.3, 4.5], [3.2, 4.6]],
69-
>>> [[6.2, 5.5], [5.4, 5.4]]]
70-
>>> y = [1, 1, -1, -1]
71-
>>> # in this task we want points where the first feature is close to be
72-
>>> # closer to each other, no matter how close the second feature is
66+
>>> X = [[1.2, 7.5], [1.3, 1.5],
67+
>>> [6.4, 2.6], [6.2, 9.7],
68+
>>> [1.3, 4.5], [3.2, 4.6],
69+
>>> [6.2, 5.5], [5.4, 5.4]]
70+
>>> chunks = [1, 1, 2, 2, 3, 3, 4, 4]
71+
>>> # in this task we want points that belong to the same class as indicated
72+
>>> # by chunks but not necesarily assest which chunks belong to which class,
73+
>>> # for example, 1 & 3 could belong to one class while 2 & 4 could belong
74+
>>> # to the other
7375
>>> rca = RCA()
74-
>>> rca.fit(pairs, y)
76+
>>> rca.fit(X, chunks)
7577
7678
References
7779
------------------

0 commit comments

Comments
 (0)