diff --git a/TODO.txt b/TODO.txt index 6ff9e9c..34c7eb1 100644 --- a/TODO.txt +++ b/TODO.txt @@ -14,6 +14,7 @@ Do we want to cover cross-lingual quantification natively in QuaPy, or does it m Current issues: ========================================== +SVMperf-based learners do not remove temp files in __del__? In binary quantification (hp, kindle, imdb) we used F1 in the minority class (which in kindle and hp happens to be the negative class). This is not covered in this new implementation, in which the binary case is not treated as such, but as an instance of single-label with 2 labels. Check diff --git a/quapy/classification/methods.py b/quapy/classification/methods.py index d6f2a45..dfbd86f 100644 --- a/quapy/classification/methods.py +++ b/quapy/classification/methods.py @@ -26,8 +26,10 @@ class PCALR(BaseEstimator): def fit(self, X, y): self.learner.fit(X, y) - self.pca = TruncatedSVD(self.n_components).fit(X, y) - # embedded = self.pca.transform(X) + nF = X.shape[1] + self.pca = None + if nF > self.n_components: + self.pca = TruncatedSVD(self.n_components).fit(X, y) self.classes_ = self.learner.classes_ return self @@ -40,4 +42,6 @@ class PCALR(BaseEstimator): return self.learner.predict_proba(X) def transform(self, X): + if self.pca is None: + return X return self.pca.transform(X)