From 98d93de804f88a5b8e523ac069115870f8919bd5 Mon Sep 17 00:00:00 2001 From: JonyWater <30627347+JonyWater@users.noreply.github.com> Date: Tue, 26 Sep 2023 14:36:08 +0300 Subject: [PATCH] PPCA.fit() returns self Following standard practice for estimators Note for further developments: make this a subclass of sklearn's BaseEstimator and TransformerMixin --- ppca/_ppca.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ppca/_ppca.py b/ppca/_ppca.py index 45e5f2b..0dcc251 100644 --- a/ppca/_ppca.py +++ b/ppca/_ppca.py @@ -108,6 +108,9 @@ def fit(self, data, d=None, tol=1e-4, min_obs=10, verbose=False): self.eig_vals = vals self._calc_var() + # to allow using this as a part of sklearn's pipeline + return self + def transform(self, data=None): if self.C is None: