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.1.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.1-py3-none-any.whl (117.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: predpca_py-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 576cdb28c10d5d6ea5ad82eb814e1ebe8a67cdef26498334f6cba255a4eec86f
MD5 3931e48195dbfde2b82692a9bc6bc792
BLAKE2b-256 d5333c2303b8feaf6d08595b6ea9b224e2b47868972a8bd2bb7e3309f5692354

See more details on using hashes here.

File details

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

File metadata

  • Download URL: predpca_py-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5311a73eac79a69f878fd0fa2eaa07b5c3f98f98f537793a3dac97522ed64c56
MD5 8cd1f0ef85da2f8708b1a50c69ef492d
BLAKE2b-256 6c834dc5fa29a5f1e982897c27abd6ddb0c3f62c8a916ea5e4325da46d10d124

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