Skip to content

Commit e33524b

Browse files
committed
Trying mixing=1.0 for KPCovC/PCovC match
1 parent 480f029 commit e33524b

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

src/skmatter/decomposition/_kernel_pcovc.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424

2525
class KernelPCovC(LinearClassifierMixin, _BaseKPCov):
26-
r"""Kernel Principal Covariates Classification
26+
r"""Kernel Principal Covariates Classification, as described in [Jorgensen2025]_,
2727
determines a latent-space projection :math:`\mathbf{T}` which minimizes a combined
2828
loss in supervised and unsupervised tasks in the reproducing kernel Hilbert space
2929
(RKHS).
@@ -68,7 +68,7 @@ class KernelPCovC(LinearClassifierMixin, _BaseKPCov):
6868
0 < n_components < min(X.shape)
6969
If randomized :
7070
run randomized SVD by the method of Halko et al.
71-
71+
7272
classifier: {`LogisticRegression`, `LogisticRegressionCV`, `LinearSVC`, `LinearDiscriminantAnalysis`,
7373
`RidgeClassifier`, `RidgeClassifierCV`, `SGDClassifier`, `Perceptron`, `precomputed`}, default=None
7474
The classifier to use for computing
@@ -253,7 +253,7 @@ def fit(self, X, Y, W=None):
253253
self.classes_ = np.unique(Y)
254254

255255
K = super().fit(X)
256-
256+
257257
compatible_classifiers = (
258258
LogisticRegression,
259259
LogisticRegressionCV,

src/skmatter/decomposition/_kernel_pcovr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
class KernelPCovR(_BaseKPCov):
12-
r"""Kernel Principal Covariates Regression, as described in [Helfrecht2020]_
12+
r"""Kernel Principal Covariates Regression, as described in [Helfrecht2020]_,
1313
determines a latent-space projection :math:`\mathbf{T}` which minimizes a combined
1414
loss in supervised and unsupervised tasks in the reproducing kernel Hilbert space
1515
(RKHS).

tests/test_kernel_pcovc.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ def test_reconstruction_errors(self):
7979
prev_x_error = 10.0
8080

8181
for mixing in np.linspace(0, 1, 6):
82+
print(mixing)
8283
kpcovc = KernelPCovC(
8384
mixing=mixing,
8485
n_components=4,
@@ -369,7 +370,7 @@ def test_linear_matches_pcovc(self):
369370
n_components=2,
370371
)
371372

372-
kpcovc = KernelPCovC(kernel="linear", center=True, **hypers)
373+
kpcovc = KernelPCovC(kernel="linear", **hypers)
373374
kpcovc.fit(self.X, self.Y)
374375
K = kpcovc._get_kernel(self.X)
375376
print(K[:5, 0])
@@ -403,10 +404,10 @@ def test_linear_matches_pcovc(self):
403404
lk = np.linalg.norm(K - k) ** 2.0 / np.linalg.norm(K) ** 2.0
404405

405406
rounding = 3
406-
# self.assertEqual(
407-
# round(ly, rounding),
408-
# round(ly_ref, rounding),
409-
# )
407+
self.assertEqual(
408+
round(ly, rounding),
409+
round(ly_ref, rounding),
410+
)
410411

411412
self.assertEqual(
412413
round(lk, rounding),

0 commit comments

Comments
 (0)