Skip to main content

Probabilistic Learning on Manifolds (PLoM)

Project description

PLoM: Probabilistic Learning on Manifolds

A modern Python library for generative modeling on manifolds.

This package is the object-oriented Python implementation of the PLoM algorithm, accompanying the research by Soize and Ghanem, 2016 and Soize and Ghanem, 2020.

Overview

PLoM generates replicas of a given dataset (training data) where the small data challenge (small $N$) is exacerbated by high-dimensional data (large $n$). The training set is construed as a graph in $R^n$ with $N$-vertices, and each replica itself a graph that shares key features with the training set.

PLoM constraints the generated samples to the diffusion manifold of the training data. The diffusion coordinates provide an embedding of the initial data into an m-dimensional Euclidean space that preserves geometric structure over multiple scales. The samples are generated through a projected Ito stochastic differential equation whose invariant measure is constrained to the diffusion manifold (the span of the diffusion coordinates).

New in version 2.0:

  • Object-Oriented API: Familiar fit / sample interface compatible with scikit-learn.
  • Efficiency: Optimized C++ backend for potential gradients and memory-efficient distance calculations.
  • Reproducibility: Robust random state management for parallel execution.

Installation

You can install the package directly using pip:

pip install pyplom

Or install from source in editable mode (recommended for development):

git clone https://github.com/philippe-hawi/PLoM.git
cd PLoM
pip install -e .

Note: This package includes compiled C++ extensions for performance.


Quick Start

The new API replaces the old dictionary-based workflow with a cleaner class-based approach.

1. Basic Usage

import numpy as np
from plom import PLoM

# 1. Load Data (N samples x n_features)
X_train = np.loadtxt('data/training_data.txt')

# 2. Initialize Model
model = PLoM(
    use_pca=True,              # Enable/Disable pipeline stages
    use_dmaps=True,
    pca_method='cum_energy',   # PCA configuration
    pca_cum_energy=0.99,
    dmaps_epsilon='auto',      # Auto-tune kernel bandwidth
    ito_steps='auto',          # Number of SDE integration steps
    n_jobs=1,                  # Parallel processing option
    verbose=1                  # 0, 1, 2
)

# 3. Fit the Manifold
model.fit(X_train)

# 4. Generate New Samples
# Returns (n_samples * N) points
X_new = model.sample(n_samples=1)

print(f"Generated data shape: {X_new.shape}")

2. Saving and Loading Models

# Save the trained model
model.save("my_plom_model.pkl")

# Load it later
from plom import PLoM
loaded_model = PLoM.load("my_plom_model.pkl")
samples = loaded_model.sample(n_samples=5)

Key Parameters

The PLoM class manages the entire pipeline. Key arguments include:

  • Pipeline Control: use_scaling, use_pca, use_dmaps (bools) to toggle specific stages.
  • PCA: pca_method ('cum_energy', 'eigv_cutoff', 'pca_dim') controls dimensionality reduction.
  • Diffusion Maps: dmaps_epsilon ('auto' or float) sets the kernel bandwidth; dmaps_m_override forces a specific manifold dimension.
  • Sampling: ito_steps (int) controls the length of the random walk; n_jobs sets the number of CPU cores.

Legacy Code

If you are looking for the original dictionary-based implementation (v0.7.0 and earlier), it has been moved to the PLoM-Legacy repository.

To install the legacy version alongside this new version:

git clone https://github.com/philippe-hawi/PLoM-Legacy.git
cd PLoM-Legacy
pip install -e 

Dependencies

  • Python 3.8+
  • numpy >= 1.20
  • scipy >= 1.7
  • joblib >= 1.1
  • matplotlib (optional, for plotting helpers)

References

  1. Soize, C., & Ghanem, R. (2016). Data-driven probability concentration and sampling on manifold. Journal of Computational Physics, 321, 242-258.
  2. Soize, C., & Ghanem, R. (2020). Physics-constrained non-Gaussian probabilistic learning on manifolds. arXiv preprint arXiv:2002.12653.

Examples

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

pyplom-2.0.0.tar.gz (1.3 MB view details)

Uploaded Source

Built Distribution

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

pyplom-2.0.0-py3-none-any.whl (1.3 MB view details)

Uploaded Python 3

File details

Details for the file pyplom-2.0.0.tar.gz.

File metadata

  • Download URL: pyplom-2.0.0.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pyplom-2.0.0.tar.gz
Algorithm Hash digest
SHA256 19a8f66bb760c8929c8e1d3bc1ef28df2e7caee4c8d84174219b22a502686a46
MD5 74346dc2dcae3e1aa6293ec995979e74
BLAKE2b-256 620f04552424c6363a776f706731174d0345935fc9d2441e26b4aae126995575

See more details on using hashes here.

File details

Details for the file pyplom-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: pyplom-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pyplom-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e066d1ada6b263ed83fc6fe8cde160e6eb5e3886f7a5aa28d4301398da828ae5
MD5 1cd886e4567575439be17e51a624f90b
BLAKE2b-256 ff2305513ea2ee1e73a59c434449791ecdd9429ef569bce092dd19f0ae227123

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