Skip to content

Commit f66ab58

Browse files
authored
Merge pull request #84 from ngayraud/fix_docstring
Fixed multiple docstring issues
2 parents c5108ef + f67f8fd commit f66ab58

File tree

1 file changed

+65
-58
lines changed

1 file changed

+65
-58
lines changed

ot/da.py

Lines changed: 65 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -473,22 +473,24 @@ def joint_OT_mapping_kernel(xs, xt, mu=1, eta=0.001, kerneltype='gaussian',
473473
Weight for the linear OT loss (>0)
474474
eta : float, optional
475475
Regularization term for the linear mapping L (>0)
476-
bias : bool,optional
477-
Estimate linear mapping with constant bias
478476
kerneltype : str,optional
479477
kernel used by calling function ot.utils.kernel (gaussian by default)
480478
sigma : float, optional
481479
Gaussian kernel bandwidth.
480+
bias : bool,optional
481+
Estimate linear mapping with constant bias
482+
verbose : bool, optional
483+
Print information along iterations
484+
verbose2 : bool, optional
485+
Print information along iterations
482486
numItermax : int, optional
483487
Max number of BCD iterations
484-
stopThr : float, optional
485-
Stop threshold on relative loss decrease (>0)
486488
numInnerItermax : int, optional
487489
Max number of iterations (inner CG solver)
488490
stopInnerThr : float, optional
489491
Stop threshold on error (inner CG solver) (>0)
490-
verbose : bool, optional
491-
Print information along iterations
492+
stopThr : float, optional
493+
Stop threshold on relative loss decrease (>0)
492494
log : bool, optional
493495
record log if True
494496
@@ -643,7 +645,8 @@ def OT_mapping_linear(xs, xt, reg=1e-6, ws=None,
643645
The function estimates the optimal linear operator that aligns the two
644646
empirical distributions. This is equivalent to estimating the closed
645647
form mapping between two Gaussian distributions :math:`N(\mu_s,\Sigma_s)`
646-
and :math:`N(\mu_t,\Sigma_t)` as proposed in [14] and discussed in remark 2.29 in [15].
648+
and :math:`N(\mu_t,\Sigma_t)` as proposed in [14] and discussed in remark
649+
2.29 in [15].
647650
648651
The linear operator from source to target :math:`M`
649652
@@ -1184,25 +1187,25 @@ class SinkhornTransport(BaseTransport):
11841187
algorithm if no it has not converged
11851188
tol : float, optional (default=10e-9)
11861189
The precision required to stop the optimization algorithm.
1187-
mapping : string, optional (default="barycentric")
1188-
The kind of mapping to apply to transport samples from a domain into
1189-
another one.
1190-
if "barycentric" only the samples used to estimate the coupling can
1191-
be transported from a domain to another one.
1190+
verbose : bool, optional (default=False)
1191+
Controls the verbosity of the optimization algorithm
1192+
log : int, optional (default=False)
1193+
Controls the logs of the optimization algorithm
11921194
metric : string, optional (default="sqeuclidean")
11931195
The ground metric for the Wasserstein problem
11941196
norm : string, optional (default=None)
11951197
If given, normalize the ground metric to avoid numerical errors that
11961198
can occur with large metric values.
1197-
distribution : string, optional (default="uniform")
1199+
distribution_estimation : callable, optional (defaults to the uniform)
11981200
The kind of distribution estimation to employ
1199-
verbose : int, optional (default=0)
1200-
Controls the verbosity of the optimization algorithm
1201-
log : int, optional (default=0)
1202-
Controls the logs of the optimization algorithm
1201+
out_of_sample_map : string, optional (default="ferradans")
1202+
The kind of out of sample mapping to apply to transport samples
1203+
from a domain into another one. Currently the only possible option is
1204+
"ferradans" which uses the method proposed in [6].
12031205
limit_max: float, optional (defaul=np.infty)
12041206
Controls the semi supervised mode. Transport between labeled source
1205-
and target samples of different classes will exhibit an infinite cost
1207+
and target samples of different classes will exhibit an cost defined
1208+
by this variable
12061209
12071210
Attributes
12081211
----------
@@ -1287,22 +1290,19 @@ class EMDTransport(BaseTransport):
12871290
12881291
Parameters
12891292
----------
1290-
mapping : string, optional (default="barycentric")
1291-
The kind of mapping to apply to transport samples from a domain into
1292-
another one.
1293-
if "barycentric" only the samples used to estimate the coupling can
1294-
be transported from a domain to another one.
12951293
metric : string, optional (default="sqeuclidean")
12961294
The ground metric for the Wasserstein problem
12971295
norm : string, optional (default=None)
12981296
If given, normalize the ground metric to avoid numerical errors that
12991297
can occur with large metric values.
1300-
distribution : string, optional (default="uniform")
1301-
The kind of distribution estimation to employ
1302-
verbose : int, optional (default=0)
1303-
Controls the verbosity of the optimization algorithm
1304-
log : int, optional (default=0)
1298+
log : int, optional (default=False)
13051299
Controls the logs of the optimization algorithm
1300+
distribution_estimation : callable, optional (defaults to the uniform)
1301+
The kind of distribution estimation to employ
1302+
out_of_sample_map : string, optional (default="ferradans")
1303+
The kind of out of sample mapping to apply to transport samples
1304+
from a domain into another one. Currently the only possible option is
1305+
"ferradans" which uses the method proposed in [6].
13061306
limit_max: float, optional (default=10)
13071307
Controls the semi supervised mode. Transport between labeled source
13081308
and target samples of different classes will exhibit an infinite cost
@@ -1387,28 +1387,32 @@ class SinkhornLpl1Transport(BaseTransport):
13871387
Entropic regularization parameter
13881388
reg_cl : float, optional (default=0.1)
13891389
Class regularization parameter
1390-
mapping : string, optional (default="barycentric")
1391-
The kind of mapping to apply to transport samples from a domain into
1392-
another one.
1393-
if "barycentric" only the samples used to estimate the coupling can
1394-
be transported from a domain to another one.
1395-
metric : string, optional (default="sqeuclidean")
1396-
The ground metric for the Wasserstein problem
1397-
norm : string, optional (default=None)
1398-
If given, normalize the ground metric to avoid numerical errors that
1399-
can occur with large metric values.
1400-
distribution : string, optional (default="uniform")
1401-
The kind of distribution estimation to employ
14021390
max_iter : int, float, optional (default=10)
14031391
The minimum number of iteration before stopping the optimization
14041392
algorithm if no it has not converged
14051393
max_inner_iter : int, float, optional (default=200)
14061394
The number of iteration in the inner loop
1407-
verbose : int, optional (default=0)
1395+
log : bool, optional (default=False)
1396+
Controls the logs of the optimization algorithm
1397+
tol : float, optional (default=10e-9)
1398+
Stop threshold on error (inner sinkhorn solver) (>0)
1399+
verbose : bool, optional (default=False)
14081400
Controls the verbosity of the optimization algorithm
1401+
metric : string, optional (default="sqeuclidean")
1402+
The ground metric for the Wasserstein problem
1403+
norm : string, optional (default=None)
1404+
If given, normalize the ground metric to avoid numerical errors that
1405+
can occur with large metric values.
1406+
distribution_estimation : callable, optional (defaults to the uniform)
1407+
The kind of distribution estimation to employ
1408+
out_of_sample_map : string, optional (default="ferradans")
1409+
The kind of out of sample mapping to apply to transport samples
1410+
from a domain into another one. Currently the only possible option is
1411+
"ferradans" which uses the method proposed in [6].
14091412
limit_max: float, optional (defaul=np.infty)
14101413
Controls the semi supervised mode. Transport between labeled source
1411-
and target samples of different classes will exhibit an infinite cost
1414+
and target samples of different classes will exhibit a cost defined by
1415+
limit_max.
14121416
14131417
Attributes
14141418
----------
@@ -1504,27 +1508,28 @@ class SinkhornL1l2Transport(BaseTransport):
15041508
Entropic regularization parameter
15051509
reg_cl : float, optional (default=0.1)
15061510
Class regularization parameter
1507-
mapping : string, optional (default="barycentric")
1508-
The kind of mapping to apply to transport samples from a domain into
1509-
another one.
1510-
if "barycentric" only the samples used to estimate the coupling can
1511-
be transported from a domain to another one.
1512-
metric : string, optional (default="sqeuclidean")
1513-
The ground metric for the Wasserstein problem
1514-
norm : string, optional (default=None)
1515-
If given, normalize the ground metric to avoid numerical errors that
1516-
can occur with large metric values.
1517-
distribution : string, optional (default="uniform")
1518-
The kind of distribution estimation to employ
15191511
max_iter : int, float, optional (default=10)
15201512
The minimum number of iteration before stopping the optimization
15211513
algorithm if no it has not converged
15221514
max_inner_iter : int, float, optional (default=200)
15231515
The number of iteration in the inner loop
1524-
verbose : int, optional (default=0)
1516+
tol : float, optional (default=10e-9)
1517+
Stop threshold on error (inner sinkhorn solver) (>0)
1518+
verbose : bool, optional (default=False)
15251519
Controls the verbosity of the optimization algorithm
1526-
log : int, optional (default=0)
1520+
log : bool, optional (default=False)
15271521
Controls the logs of the optimization algorithm
1522+
metric : string, optional (default="sqeuclidean")
1523+
The ground metric for the Wasserstein problem
1524+
norm : string, optional (default=None)
1525+
If given, normalize the ground metric to avoid numerical errors that
1526+
can occur with large metric values.
1527+
distribution_estimation : callable, optional (defaults to the uniform)
1528+
The kind of distribution estimation to employ
1529+
out_of_sample_map : string, optional (default="ferradans")
1530+
The kind of out of sample mapping to apply to transport samples
1531+
from a domain into another one. Currently the only possible option is
1532+
"ferradans" which uses the method proposed in [6].
15281533
limit_max: float, optional (default=10)
15291534
Controls the semi supervised mode. Transport between labeled source
15301535
and target samples of different classes will exhibit an infinite cost
@@ -1646,10 +1651,12 @@ class MappingTransport(BaseEstimator):
16461651
Max number of iterations (inner CG solver)
16471652
inner_tol : float, optional (default=1e-6)
16481653
Stop threshold on error (inner CG solver) (>0)
1649-
verbose : bool, optional (default=False)
1650-
Print information along iterations
16511654
log : bool, optional (default=False)
16521655
record log if True
1656+
verbose : bool, optional (default=False)
1657+
Print information along iterations
1658+
verbose2 : bool, optional (default=False)
1659+
Print information along iterations
16531660
16541661
Attributes
16551662
----------

0 commit comments

Comments
 (0)