diff --git a/doc/getting_started.rst b/doc/getting_started.rst index 5a671d86..5ce4242a 100644 --- a/doc/getting_started.rst +++ b/doc/getting_started.rst @@ -29,11 +29,14 @@ Quick start This example loads the iris dataset, and evaluates a k-nearest neighbors algorithm on an embedding space learned with `NCA`. ->>> from metric_learn import NCA ->>> from sklearn.datasets import load_iris ->>> from sklearn.model_selection import cross_val_score ->>> from sklearn.pipeline import make_pipeline ->>> ->>> X, y = load_iris(return_X_y=True) ->>> clf = make_pipeline(NCA(), KNeighborsClassifier()) ->>> cross_val_score(clf, X, y) +:: + + from metric_learn import NCA + from sklearn.datasets import load_iris + from sklearn.model_selection import cross_val_score + from sklearn.pipeline import make_pipeline + from sklearn.neighbors import KNeighborsClassifier + + X, y = load_iris(return_X_y=True) + clf = make_pipeline(NCA(), KNeighborsClassifier()) + cross_val_score(clf, X, y) diff --git a/doc/supervised.rst b/doc/supervised.rst index 3c941b20..f221ba4a 100644 --- a/doc/supervised.rst +++ b/doc/supervised.rst @@ -374,7 +374,12 @@ Supervised versions of weakly-supervised algorithms Each :ref:`weakly-supervised algorithm ` has a supervised version of the form `*_Supervised` where similarity tuples are randomly generated from the labels information and passed to the underlying -algorithm. +algorithm. + +.. warning:: + Supervised versions of weakly-supervised algorithms interpret label -1 + (or any negative label) as a point with unknown label. + Those points are discarded in the learning process. For pairs learners (see :ref:`learning_on_pairs`), pairs (tuple of two points from the dataset), and pair labels (`int` indicating whether the two points diff --git a/metric_learn/itml.py b/metric_learn/itml.py index 1f3f90ee..5202c9e1 100644 --- a/metric_learn/itml.py +++ b/metric_learn/itml.py @@ -273,6 +273,7 @@ class ITML_Supervised(_BaseITML, TransformerMixin): be removed in 0.6.0. num_constraints: int, optional number of constraints to generate + (`20 * num_classes**2` constraints by default) bounds : Not used .. deprecated:: 0.5.0 `bounds` was deprecated in version 0.5.0 and will diff --git a/metric_learn/lsml.py b/metric_learn/lsml.py index dfb12720..b9df3825 100644 --- a/metric_learn/lsml.py +++ b/metric_learn/lsml.py @@ -276,6 +276,7 @@ class LSML_Supervised(_BaseLSML, TransformerMixin): be removed in 0.6.0. num_constraints: int, optional number of constraints to generate + (`20 * num_classes**2` constraints by default) weights : (m,) array of floats, optional scale factor for each constraint verbose : bool, optional diff --git a/metric_learn/mmc.py b/metric_learn/mmc.py index 0999e417..622beb25 100644 --- a/metric_learn/mmc.py +++ b/metric_learn/mmc.py @@ -498,6 +498,7 @@ class MMC_Supervised(_BaseMMC, TransformerMixin): be removed in 0.6.0. num_constraints: int, optional number of constraints to generate + (`20 * num_classes**2` constraints by default) init : None, string or numpy array, optional (default=None) Initialization of the Mahalanobis matrix. Possible options are 'identity', 'covariance', 'random', and a numpy array of diff --git a/metric_learn/sdml.py b/metric_learn/sdml.py index 2cdaa164..21fadd74 100644 --- a/metric_learn/sdml.py +++ b/metric_learn/sdml.py @@ -302,6 +302,7 @@ class SDML_Supervised(_BaseSDML, TransformerMixin): be removed in 0.6.0. num_constraints : int, optional (default=None) number of constraints to generate + (`20 * num_classes**2` constraints by default) verbose : bool, optional (default=False) if True, prints information while learning preprocessor : array-like, shape=(n_samples, n_features) or callable