MCPcopy Create free account
hub / github.com/PythonOT/POT / fit

Method fit

ot/da.py:1492–1533  ·  view source on GitHub ↗

r"""Build a coupling matrix from source and target sets of samples :math:`(\mathbf{X_s}, \mathbf{y_s})` and :math:`(\mathbf{X_t}, \mathbf{y_t})` Parameters ---------- Xs : array-like, shape (n_source_samples, n_features) The training input samples.

(self, Xs, ys=None, Xt=None, yt=None)

Source from the content-addressed store, hash-verified

1490 self.max_iter = max_iter
1491
1492 def fit(self, Xs, ys=None, Xt=None, yt=None):
1493 r"""Build a coupling matrix from source and target sets of samples
1494 :math:`(\mathbf{X_s}, \mathbf{y_s})` and :math:`(\mathbf{X_t}, \mathbf{y_t})`
1495
1496 Parameters
1497 ----------
1498 Xs : array-like, shape (n_source_samples, n_features)
1499 The training input samples.
1500 ys : array-like, shape (n_source_samples,)
1501 The class labels
1502 Xt : array-like, shape (n_target_samples, n_features)
1503 The training input samples.
1504 yt : array-like, shape (n_target_samples,)
1505 The class labels. If some target samples are unlabelled, fill the
1506 :math:`\mathbf{y_t}`'s elements with -1.
1507
1508 Warning: Note that, due to this convention -1 cannot be used as a
1509 class label
1510
1511 Returns
1512 -------
1513 self : object
1514 Returns self.
1515 """
1516
1517 super(EMDTransport, self).fit(Xs, ys, Xt, yt)
1518
1519 returned_ = emd(
1520 a=self.mu_s,
1521 b=self.mu_t,
1522 M=self.cost_,
1523 numItermax=self.max_iter,
1524 log=self.log,
1525 )
1526
1527 # coupling estimation
1528 if self.log:
1529 self.coupling_, self.log_ = returned_
1530 else:
1531 self.coupling_ = returned_
1532 self.log_ = dict()
1533 return self
1534
1535
1536class SinkhornLpl1Transport(BaseTransport):

Callers 15

test_emd_transport_classFunction · 0.95
_init_lr_sinkhornFunction · 0.45
ewcaFunction · 0.45
fitMethod · 0.45
fitMethod · 0.45
fitMethod · 0.45
fitMethod · 0.45
fitMethod · 0.45
get_graph_partitionFunction · 0.45
semirelaxed_init_planFunction · 0.45

Calls 1

emdFunction · 0.85

Tested by 3

test_emd_transport_classFunction · 0.76
test_log_daFunction · 0.36