Phi-Alpha PCA
Project description
Alpha-PCA
Alpha-PCA is more robust to outliers than standard PCA.
Standard PCA is a special case of alpha PCA (when alpha=1).
Usage
The model is inherited from a sklearn module and works the same way as the standard PCA.
It also supports PyTorch tensors (on cpu and GPU).
from alpha_pca import AlphaPCA
import torch
X = torch.randn(16, 10) # also works with numpy
pca = AlphaPCA(n_components=5, alpha=0.7, random_state=123) # alpha=1 -> standard PCA
pca.fit(X)
# to project X in the latent space
X_transformed = pca.transform(X) # (16, 10) -> (16, 5)
# fit inverse
X_ = pca.inverse_transform(X_transformed) # (16, 5) -> (16, 10)
# directly approximate X_ == inverse_transform(transform(X))
X_ = pca.approximate(X) # (16, 10) -> (16, 10)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
alpha-pca-0.0.1.tar.gz
(2.3 kB
view hashes)
Built Distribution
Close
Hashes for alpha_pca-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3015baddd9c7dd0ae6274f1bcd6a7b38f734c6340445badfa54a55f1fb8fc48f |
|
MD5 | 0e844faee7abc57a8fa9ebc8ee67d560 |
|
BLAKE2b-256 | 38c6a7b666eadb17936e479a3243186f99b181ec8c8796f9640850be5c7e73e9 |