fix in PCALR
This commit is contained in:
parent
3d544135f1
commit
2586e6ed7d
1
TODO.txt
1
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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue