We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1f8ee6f commit f352ea4Copy full SHA for f352ea4
1 file changed
experiments/tvn.py
@@ -26,8 +26,10 @@ def fit(self, dmso_features: torch.Tensor):
26
"""
27
Fits the PCA model on the given DMSO feature set, storing the mean and components.
28
29
+ n_samples, n_features = dmso_features.shape
30
+ n_components = min(n_samples, n_features)
31
+ pca = PCA(n_components=n_components, whiten=self.whiten)
32
# Convert to numpy for sklearn PCA
- pca = PCA(n_components=dmso_features.shape[1], whiten=self.whiten)
33
pca.fit(dmso_features.cpu().numpy())
34
self.mean_ = torch.tensor(pca.mean_, dtype=torch.float32)
35
self.components_ = torch.tensor(pca.components_, dtype=torch.float32)
0 commit comments