A package for multiPCA
Project description
multipca
A Python package for Multi-way Principal Component Analysis (Multiway PCA) with confidence intervals.
Citation
If you use this package in your research, please cite:
@article{ouyang2023multiway,
title={On the Multiway Principal Component Analysis},
author={Ouyang, Jialin and Yuan, Ming},
journal={Annals of Statistics (to appear)},
year={2023},
url={https://arxiv.org/abs/2302.07216}
}
Installation
Requires Python ≥ 3.9. We recommend using a virtual environment:
# Create and activate virtual environment (optional but recommended)
python -m venv .venv
source .venv/bin/activate # On Windows, use `.venv\Scripts\activate`
# Install package
pip install multipca
Quick Start
The package includes an example Citibike dataset that demonstrates multiway PCA analysis of bike sharing patterns in NYC. Here's how to get started:
import multipca
import matplotlib.pyplot as plt
# Load the example Citibike data (shape: 24 hours × 35 stations × 522 days)
array = multipca.load_citibike_example()
# MPCA with confidence intervals
results = multipca.mpca_CI(array, r=4)
# Plot the first component's daily pattern with confidence bands
multipca.CI_band_plot(results, rank=1, mode=1)
plt.show()
# If you only need components without confidence intervals
components = multipca.mpca(array, r=4)
For more examples including World Bank economic indicators analysis, check out examples/citibike_worldbank.ipynb in the GitHub repository.
Documentation
Full documentation is available in the GitHub repository.
Examples
Check out the example notebook for:
- Detailed usage examples
- Plotting functions
- Real-world applications with Citibike and World Bank data
Features
- Multiway PCA implementation
- Confidence intervals for components
- Visualization tools:
- Component plots with confidence bands
- Loading plots
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file multipca-0.1.2.tar.gz.
File metadata
- Download URL: multipca-0.1.2.tar.gz
- Upload date:
- Size: 2.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f301afda1556f29a0dab32e26776c3b4580095a27f4787570f5110a41b777524
|
|
| MD5 |
71c9a8c05a28d7d8d5e365ca5dcc85e9
|
|
| BLAKE2b-256 |
8ef10e0b33d8b1fb691f46f0846c47c0332c55bc03bb94122cd126720474f8e4
|
File details
Details for the file multipca-0.1.2-py3-none-any.whl.
File metadata
- Download URL: multipca-0.1.2-py3-none-any.whl
- Upload date:
- Size: 2.7 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a5d189597a9c819aab0757b9bd84d58eec7b0188cc980babf4b14bc1df33c95
|
|
| MD5 |
bc648ea5a568185afe882586e073a2eb
|
|
| BLAKE2b-256 |
bea9da41f0377c6f4c573a3da2e9a45b9e4468a9c49205970cffeb543d825582
|