r"""Propagate target labels :math:`\mathbf{y_t}` to obtain estimated source labels :math:`\mathbf{y_s}` Parameters ---------- yt : array-like, shape (n_target_samples,) Returns ------- transp_ys : array-like, shape (n_source_samples, nb_class
(self, yt=None)
| 830 | return transp_Xt |
| 831 | |
| 832 | def inverse_transform_labels(self, yt=None): |
| 833 | r"""Propagate target labels :math:`\mathbf{y_t}` to obtain estimated source labels |
| 834 | :math:`\mathbf{y_s}` |
| 835 | |
| 836 | Parameters |
| 837 | ---------- |
| 838 | yt : array-like, shape (n_target_samples,) |
| 839 | |
| 840 | Returns |
| 841 | ------- |
| 842 | transp_ys : array-like, shape (n_source_samples, nb_classes) |
| 843 | Estimated soft source labels. |
| 844 | """ |
| 845 | nx = self.nx |
| 846 | |
| 847 | # check the necessary inputs parameters are here |
| 848 | if check_params(yt=yt): |
| 849 | # perform label propagation |
| 850 | transp = self.coupling_ / nx.sum(self.coupling_, 1)[:, None] |
| 851 | # set nans to 0 |
| 852 | transp = nx.nan_to_num(transp, nan=0, posinf=0, neginf=0) |
| 853 | |
| 854 | # compute propagated labels |
| 855 | labels = label_normalization(yt) |
| 856 | masks = labels_to_masks(labels, nx=nx, type_as=transp) |
| 857 | transp_ys = nx.dot(masks.T, transp.T) |
| 858 | |
| 859 | return transp_ys.T |
| 860 | |
| 861 | |
| 862 | class LinearTransport(BaseTransport): |