Skip to content

Commit 96a8abc

Browse files
Version bump to 0.3, updating docs
1 parent ce5f238 commit 96a8abc

9 files changed

+41
-28
lines changed

README.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Metric Learning algorithms in Python.
1717

1818
**Dependencies**
1919

20-
- Python 2.6+
20+
- Python 2.7+, 3.4+
2121
- numpy, scipy, scikit-learn
2222
- (for running the examples only: matplotlib)
2323

doc/index.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ metric learning algorithms.
1717
:caption: Algorithms
1818
:maxdepth: 1
1919

20+
metric_learn.covariance
2021
metric_learn.lmnn
2122
metric_learn.itml
2223
metric_learn.sdml
@@ -51,7 +52,7 @@ Alternately, download the source repository and run:
5152

5253
**Dependencies**
5354

54-
- Python 2.6+
55+
- Python 2.7+, 3.4+
5556
- numpy, scipy, scikit-learn
5657
- (for running the examples only: matplotlib)
5758

doc/metric_learn.covariance.rst

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Covariance metric (baseline method)
2+
===================================
3+
4+
.. automodule:: metric_learn.covariance
5+
:members:
6+
:undoc-members:
7+
:inherited-members:
8+
:show-inheritance:
9+
10+
Example Code
11+
------------
12+
13+
::
14+
15+
from metric_learn import Covariance
16+
from sklearn.datasets import load_iris
17+
18+
iris_data = load_iris()
19+
20+
cov = Covariance()
21+
x = cov.fit_transform(iris_data['data'])

doc/metric_learn.itml.rst

+3-7
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,15 @@ Example Code
1212

1313
::
1414

15-
import numpy as np
16-
from metric_learn import ITML
15+
from metric_learn import ITML_Supervised
1716
from sklearn.datasets import load_iris
1817

1918
iris_data = load_iris()
2019
X = iris_data['data']
2120
Y = iris_data['target']
2221

23-
itml = ITML()
24-
25-
num_constraints = 200
26-
C = ITML.prepare_constraints(Y, X.shape[0], num_constraints)
27-
itml.fit(X, C, verbose=False)
22+
itml = ITML_Supervised(num_constraints=200)
23+
itml.fit(X, Y)
2824

2925
References
3026
----------

doc/metric_learn.lsml.rst

+3-5
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,15 @@ Example Code
1212

1313
::
1414

15-
import numpy as np
16-
from metric_learn import LSML
15+
from metric_learn import LSML_Supervised
1716
from sklearn.datasets import load_iris
1817

1918
iris_data = load_iris()
2019
X = iris_data['data']
2120
Y = iris_data['target']
2221

23-
lsml = LSML()
24-
C = LSML.prepare_constraints(Y, 200)
25-
isml.fit(X, C, verbose=False)
22+
lsml = LSML_Supervised(num_constraints=200)
23+
isml.fit(X, Y)
2624

2725
References
2826
----------

doc/metric_learn.rca.rst

+3-5
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,15 @@ Example Code
1212

1313
::
1414

15-
import numpy as np
16-
from metric_learn import RCA
15+
from metric_learn import RCA_Supervised
1716
from sklearn.datasets import load_iris
1817

1918
iris_data = load_iris()
2019
X = iris_data['data']
2120
Y = iris_data['target']
2221

23-
rca = RCA()
24-
C = RCA.prepare_constraints(Y, num_chunks=30, chunk_size=2)
25-
rca.fit(X, C)
22+
rca = RCA_Supervised(num_chunks=30, chunk_size=2)
23+
rca.fit(X, Y)
2624

2725
References
2826
------------------

doc/metric_learn.sdml.rst

+3-5
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,15 @@ Example Code
1212

1313
::
1414

15-
import numpy as np
16-
from metric_learn import SDML
15+
from metric_learn import SDML_Supervised
1716
from sklearn.datasets import load_iris
1817

1918
iris_data = load_iris()
2019
X = iris_data['data']
2120
Y = iris_data['target']
2221

23-
sdml = SDML()
24-
W = SDML.prepare_constraints(Y, X.shape[0], 1500)
25-
sdml.fit(X, W)
22+
sdml = SDML_Supervised(num_constraints=200)
23+
sdml.fit(X, Y)
2624

2725
References
2826
------------------

metric_learn/sdml.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ def fit(self, X, W):
5555
"""
5656
X: data matrix, (n x d)
5757
each row corresponds to a single instance
58-
W: connectivity graph, (n x n). +1 for positive pairs, -1 for negative.
58+
W: connectivity graph, (n x n)
59+
+1 for positive pairs, -1 for negative.
5960
"""
6061
self._prepare_inputs(X, W)
6162
P = pinvh(self.M) + self.params['balance_param'] * self.loss_matrix

setup.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# -*- coding: utf-8 -*-
33
from setuptools import setup
44

5-
version = "0.2.1"
5+
version = "0.3.0"
66
setup(name='metric-learn',
77
version=version,
88
description='Python implementations of metric learning algorithms',
@@ -26,12 +26,12 @@
2626
'six'
2727
],
2828
extras_require=dict(
29-
docs=['sphinx', 'numpydoc'],
29+
docs=['sphinx', 'shinx_rtd_theme', 'numpydoc'],
3030
demo=['matplotlib'],
3131
),
3232
test_suite='test',
3333
keywords=[
34-
'Metric Learning',
34+
'Metric Learning',
3535
'Large Margin Nearest Neighbor',
3636
'Information Theoretic Metric Learning',
3737
'Sparse Determinant Metric Learning',

0 commit comments

Comments
 (0)