20
20
21
21
22
22
class PCovC (LinearClassifierMixin , _BasePCov ):
23
- r"""Principal Covariates Classification determines a latent-space projection :math:`\mathbf{T}`
23
+ r"""Principal Covariates Classification, as described in [Jorgensen2025]_,
24
+ determines a latent-space projection :math:`\mathbf{T}`
24
25
which minimizes a combined loss in supervised and unsupervised tasks.
25
26
26
27
This projection is determined by the eigendecomposition of a modified gram
@@ -219,8 +220,16 @@ def __init__(
219
220
self .classifier = classifier
220
221
221
222
def fit (self , X , Y , W = None ):
222
- r"""Fit the model with X and Y. Depending on the dimensions of X,
223
- calls either `_fit_feature_space` or `_fit_sample_space`.
223
+ r"""Fit the model with X and Y. Note that W is taken from the
224
+ coefficients of a linear classifier fit between X and Y to compute
225
+ Z:
226
+
227
+ .. math::
228
+ \mathbf{Z} = \mathbf{X} \mathbf{W}
229
+
230
+ We then call either `_fit_feature_space` or `_fit_sample_space`,
231
+ using Z as our approximation of Y. Finally, we refit a classifier on
232
+ T and Y to obtain :math:`\mathbf{P}_{TZ}`.
224
233
225
234
Parameters
226
235
----------
@@ -237,24 +246,9 @@ def fit(self, X, Y, W=None):
237
246
Training data, where n_samples is the number of samples.
238
247
239
248
W : numpy.ndarray, shape (n_features, n_properties)
240
- Classification weights, optional when classifier=`precomputed`. If
249
+ Classification weights, optional when classifier= `precomputed`. If
241
250
not passed, it is assumed that the weights will be taken from a
242
251
linear classifier fit between :math:`\mathbf{X}` and :math:`\mathbf{Y}`
243
-
244
- Notes
245
- -----
246
- Note the relationship between :math:`\mathbf{X}`, :math:`\mathbf{Y}`,
247
- :math:`\mathbf{Z}`, and :math:`\mathbf{W}`. The classification weights
248
- :math:`\mathbf{W}`, obtained through a linear classifier fit between
249
- :math:`\mathbf{X}` and :math:`\mathbf{Y}`, are used to compute:
250
-
251
- .. math::
252
- \mathbf{Z} = \mathbf{X} \mathbf{W}
253
-
254
- Next, :math:`\mathbf{Z}` is used in either `_fit_feature_space` or
255
- `_fit_sample_space` as our approximation of :math:`\mathbf{Y}`.
256
- Finally, we refit a classifier on :math:`\mathbf{T}` and :math:`\mathbf{Y}`
257
- to obtain :math:`\mathbf{P}_{XZ}` and :math:`\mathbf{P}_{TZ}`
258
252
"""
259
253
X , Y = validate_data (self , X , Y , y_numeric = False )
260
254
check_classification_targets (Y )
0 commit comments