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

Method fit_transform

ot/da.py:633–659  ·  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})` and transports source samples :math:`\mathbf{X_s}` onto target ones :math:`\mathbf{X_t}` Parameters ---------- Xs

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

Source from the content-addressed store, hash-verified

631 return self
632
633 def fit_transform(self, Xs=None, ys=None, Xt=None, yt=None):
634 r"""Build a coupling matrix from source and target sets of samples
635 :math:`(\mathbf{X_s}, \mathbf{y_s})` and :math:`(\mathbf{X_t}, \mathbf{y_t})`
636 and transports source samples :math:`\mathbf{X_s}` onto target ones :math:`\mathbf{X_t}`
637
638 Parameters
639 ----------
640 Xs : array-like, shape (n_source_samples, n_features)
641 The training input samples.
642 ys : array-like, shape (n_source_samples,)
643 The class labels for training samples
644 Xt : array-like, shape (n_target_samples, n_features)
645 The training input samples.
646 yt : array-like, shape (n_target_samples,)
647 The class labels. If some target samples are unlabelled, fill the
648 :math:`\mathbf{y_t}`'s elements with -1.
649
650 Warning: Note that, due to this convention -1 cannot be used as a
651 class label
652
653 Returns
654 -------
655 transp_Xs : array-like, shape (n_source_samples, n_features)
656 The source samples samples.
657 """
658
659 return self.fit(Xs, ys, Xt, yt).transform(Xs, ys, Xt, yt)
660
661 def transform(self, Xs=None, ys=None, Xt=None, yt=None, batch_size=128):
662 r"""Transports source samples :math:`\mathbf{X_s}` onto target ones :math:`\mathbf{X_t}`

Calls 2

fitMethod · 0.95
transformMethod · 0.45