Skip to main content

PredPCA: Predictive Principal Component Analysis

Project description

Predictive principal component analysis (PredPCA) - Python Implementation

DOI

Overview

Predictive principal component analysis (PredPCA) is an analytically solvable unsupervised learning scheme that extracts the most informative components for predicting future inputs. It is a convex optimization and can find the analytical expressions of optimal weight matrices and encoding dimensionality that provide the global minimum of the squared test prediction error.

This repository involves Python scripts for PredPCA, which is a Python implementation of the original MATLAB code repository.

Paper

"Dimensionality reduction to maximize prediction generalization capability" Takuya Isomura, Taro Toyoizumi Nature Machine Intelligence 3, 434–446 (2021). https://doi.org/10.1038/s42256-021-00306-1 Preprint version is available at https://arxiv.org/abs/2003.00470

Copyright

Original MATLAB implementation: Copyright (C) 2020 Takuya Isomura (RIKEN Center for Brain Science) Python implementation: Copyright (C) 2024 Araya Inc.

Example Notebooks

The following Colab notebooks provide explanations and usage examples of PredPCA:

MNIST Example
MNIST

Handwritten digits sequence (Fig.2)

ALOI Example
ALOI

Rotating objects sequence (Fig.3)

Nonlinear Example
Nonlinear

Nonlinear time series (Suppl. Fig.1)

Contents

predpca/
├── predpca.py  # Core functions for PredPCA
├── aloi/       # Demo with the ALOI rotating 3D object video dataset (Fig.3 in the paper)
├── bdd100k/    # Demo with the BDD100K naturalistic driving video dataset (Fig.4 in the paper)
├── mnist/      # Demo with the MNIST handwritten digit image dataset (Fig.2 in the paper)
└── nonlinear/  # Demo with nonlinear time series data (Supplementary Fig.1 in the paper)

See each directory for more details.

Installation

It is recommended to use a virtual environment for installation. This project has been tested with Python 3.10.

  1. Create and activate a virtual environment (venv for example)

    python -m venv venv
    source venv/bin/activate  # On Windows, use venv\Scripts\activate.ps1 or activate.bat
    
  2. Install dependencies

  • FFmpeg
    • Install from the official download links or package managers, e.g.
      • Windows: winget install ffmpeg
      • macOS: brew install ffmpeg
      • Ubuntu: sudo apt install ffmpeg
  • (optional) PyTorch and Torchvision
    • These packages are required if you want to run the BDD100K demo (predpca/bdd100k/) or model comparison experiments (predpca/*/main_compare_models.py).
    • Install from the official website.
  • (optional) deeptime
    • This package is required if you want to run the model comparison experiments.
    • pip install deeptime
  1. Install the package
  • Option 1: Install from PyPI
    pip install predpca-py
    
  • Option 2: Install from source (for developers)
    git clone https://github.com/takuyaisomura/predpca-py.git
    cd predpca-py
    pip install -e .
    

License

This project is covered under the GNU General Public License v3.0.

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

predpca_py-0.1.2.tar.gz (93.7 kB view details)

Uploaded Source

Built Distribution

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

predpca_py-0.1.2-py3-none-any.whl (117.4 kB view details)

Uploaded Python 3

File details

Details for the file predpca_py-0.1.2.tar.gz.

File metadata

  • Download URL: predpca_py-0.1.2.tar.gz
  • Upload date:
  • Size: 93.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for predpca_py-0.1.2.tar.gz
Algorithm Hash digest
SHA256 e022c90746c932ee6f754c94a31899fe275e256142b38a33f29f22dd4bc0fef8
MD5 0233c65813d1bbb8457518d4746b9705
BLAKE2b-256 004be7dc48b73395a2e3d8f3b44858bd6a718e5a6bf517dccf570bb8708c66e2

See more details on using hashes here.

File details

Details for the file predpca_py-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: predpca_py-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 117.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for predpca_py-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7feef3eb137cf6a710df56819f29be0c9f7a6931c2d71f2353425c0d60ce547a
MD5 3079f7dcb56e1e2cad757d00b278bd4b
BLAKE2b-256 b9511218cd00e33d995885aeb2882f473c20b3553e05e8a4de4e7a54acfb8609

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