Skip to main content

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

# 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)

# 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

multipca-0.1.0-py3-none-any.whl (2.7 MB view details)

Uploaded Python 3

File details

Details for the file multipca-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: multipca-0.1.0-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

Hashes for multipca-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 06b03c1908c7458ff728145f5782ad25d045c3e8e027ee0e55f8ec9ec9c87bf4
MD5 c188233872af91f5b54c97049f874df8
BLAKE2b-256 783064dafe29d43520981090817476fd696b1ed230179867ce650858e338d86c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page