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)
# Find the optimal alpha via a reconstruction loss
best_alpha = pca.compute_optimal_alpha(X, n_components=5)
Metadata
Release files for alpha-pca 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| alpha-pca-1.0.2.tar.gz | 6.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| alpha_pca-1.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.6 kB
Release files / alpha-pca-1.0.2.tar.gz
| Download URL | alpha-pca-1.0.2.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
567bc5ac1a192f53f0ee8b2521e03be7630d632a6f3b5f4c5777c74014603402
|
|
BLAKE2b-256 checksum How to use checksums |
41c1a9df3acc621ef5d24355ba1aa0928615e8e7be63fa23229831a11f59161c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.13
|
Release files / alpha_pca-1.0.2-py3-none-any.whl
| Download URL | alpha_pca-1.0.2-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d735d6718d5f943b4596716c41fc3e65ab1efd79b191d5ffc5825fd572c5ee29
|
|
BLAKE2b-256 checksum How to use checksums |
75720773a1130049fafa8e14af6c6259351df88a63c8a0ab9870c7b0e0dcaaf9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.13
|