From 02c265741464a0ffed452940a4a416501c2431ab Mon Sep 17 00:00:00 2001 From: jlsuarezdiaz Date: Wed, 8 Aug 2018 10:17:10 +0200 Subject: [PATCH] Added installation instructions to doc --- dml/tune.py | 2 +- doc/sphinx/source/index.rst | 16 +++++++++++++++- doc/sphinx/source/installation.rst | 5 ++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/dml/tune.py b/dml/tune.py index 3da99ff..d8f5ec7 100644 --- a/dml/tune.py +++ b/dml/tune.py @@ -205,7 +205,7 @@ def tune_knn(dml,X,y,n_neighbors,dml_params,tune_args,n_folds=5,n_reps=1,verbose print("*** Tuning Case ",tune_case,"...") # DML algorthm with each tune params - dml_alg = dml(**tuned_args,**dml_params) + dml_alg = dml(**tuned_args, **dml_params) alg = Pipeline([("DML",dml_alg),("KNN",knn)]) results = cross_validate(alg,X,y,n_folds=n_folds,n_reps=n_reps,verbose=verbose,seed=seed) diff --git a/doc/sphinx/source/index.rst b/doc/sphinx/source/index.rst index 1014b2a..b16125a 100644 --- a/doc/sphinx/source/index.rst +++ b/doc/sphinx/source/index.rst @@ -7,12 +7,26 @@ Welcome to pyDML's documentation! ================================= - The need of a similarity measure is very common in many machine learning algorithms, such as nearest neighbors classification. Usually, a standard distance, like the euclidean distance, is used to measure this similarity. The distance metric learning paradigm tries to learn an optimal distance from the data. This package provides the classic algorithms of supervised distance metric learning, together with some of the newest proposals. +How to learn a distance? +------------------------ + +There are two main ways to learn a distance in Distance Metric Learning: + +* Learning a metric matrix M, that is, a positive semidefinite matrix. In this case, the distance is measured as + +.. math:: + + d(x,y) = \sqrt{(x-y)^TM(x-y)}. + +* Learning a linear map L. This map is also represented by a matrix, not necessarily definite or squared. Here, the distance between two elements is the euclidean distance after applying the transformation. + +Every linear map defines a single metric (:math:`M = L^TL`), and two linear maps that define the same metric only differ in an isometry. So both approaches are equivalent. + .. toctree:: :maxdepth: 1 diff --git a/doc/sphinx/source/installation.rst b/doc/sphinx/source/installation.rst index e50cd8d..aab2f8d 100644 --- a/doc/sphinx/source/installation.rst +++ b/doc/sphinx/source/installation.rst @@ -1,2 +1,5 @@ Installation -============ \ No newline at end of file +============ + +* PyPI latest version: :code:`pip install pyDML`. +* From GitHub: clone or download this repository and run the command :code:`python setup.py install` on the root directory. \ No newline at end of file