Skip to content
AdaptiveMotorControlLabPublic

About

Learn governing equations from latent dynamics using aligned, noisy observations. NeurIPS 2026.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

Repository files navigation

DYSCO

Extracting Governing Equations from Latent Dynamics via Multi-View Contrastive Learning

Paolo Muratore and Mackenzie Weygandt Mathis · EPFL · NeurIPS 2026

DYSCO learns a shared encoder and a continuous-time vector field from multiple noisy observations of the same trajectory. Fit it to synchronized recordings, encode a new trial, forecast in latent space, and inspect the fitted differential equations. The equations are expressed in learned coordinates. Under the paper’s assumptions, an affine change of coordinates relates them to the underlying system.

Project page · NeurIPS poster · Paper on arXiv · Runnable examples

Play back a held-out reach and its decoded hand path, or compare the recovered phase portraits and baseline scores for synthetic systems. Motor-cortex playback · Synthetic results

Ground-truth phase portraits above their affine-aligned DYSCO reconstructions for Lorenz, winner-take-all, Duffing and double-well systems.

Installation

Use Python 3.11 or newer and PyTorch 2.9 or newer. The following installs the package and the examples from source.

git clone https://github.com/AdaptiveMotorControlLab/dysco.git
cd dysco
python -m venv .venv
source .venv/bin/activate
python -m pip install .
python examples/oscillator.py

A first fit

Four recordings below share a latent oscillator and a mixing matrix. Each has a fresh draw of sensor noise. Three recordings supply training views, and the fourth is held out.

import numpy as np
import torch
from dysco import fit

torch.manual_seed(7)
rng = np.random.default_rng(7)
dt = 0.05
time = np.arange(240) * dt
state = np.column_stack([np.cos(time), np.sin(time)])
sensors = state @ rng.normal(size=(2, 8))
views = sensors + 0.12 * rng.normal(size=(4, *sensors.shape))

model = fit(views[:3], dt=dt, latent_dim=2, degree=1, steps=100)
with torch.no_grad():
    z = model.encode(views[3])           # (240, 2)
    velocity = model.vector_field(z)     # (240, 2)
    forecast = model.rollout(z[0], 10)   # (11, 2), including the initial state
print(*model.equations(), sep="\n")

The short CPU fit illustrates the interface. The paper uses larger experiments. When comparing a learned field against ground truth, fit a coordinate alignment on training data and evaluate on held-out trajectories.

Your data

Input Shape Meaning
One trajectory with repeated views (view, time, feature) Equal sampling interval and corresponding times in a shared observation space
Multiple trajectories (group, view, time, feature) Each group contains repetitions of its own trajectory
Observed inputs (time, control) or (group, time, control) One input vector at each sampling time, shared across repetitions within a group

Pass NumPy arrays or PyTorch tensors. The array interface expects rectangular groups. Window sampling stays within each group. The model estimates observation means and scales from the training views and applies them when encoding new data.

  • dt sets the physical time between samples. window counts time nodes including both endpoints. num_views sets how many distinct repetitions to draw per training window.
  • degree sets the polynomial degree. model.equations(threshold=0.01) hides small coefficients when printing. It leaves the learned vector field intact.
  • For observed forcing, pass controls=u to fit. This interface learns an additive linear input term. Supply the corresponding control at every state for field evaluation, and all steps + 1 control nodes for a rollout. The controlled example includes two distinct input paths.
  • The fitted object is a PyTorch module. To restore its parameters, construct AlignedDynamics(observed_dim, latent_dim, dt, degree, control_dim) with the fitting settings and load its state_dict(). The observation scaling is part of that state.

Configurable training

The Python interface reuses the submitted encoder, symbolic polynomial basis and three-block contrastive objective. It adds an array sampler and uses Adam with a KDE potential. The original configurable trainer includes the synthetic observer, field libraries, optimizer schedule and Lorenz reference configurations.

dysco-train config/smoke/lorenz-cpu.yaml --dry_run
dysco-train config/gauss/lorenz.yaml
dysco-train config/spike/lorenz.yaml

The first command generates a small local dataset and runs one CPU training batch. The Gaussian and spiking examples use GPU-oriented settings. Generated trajectories, checkpoints and run logs are written under the paths specified in each configuration.

CEBRA integration

A companion implementation exposes an aligned-trial estimator as cebra.DYSCO. The upstream draft includes the solver, equation inspection, checkpoint tests and an offline Lorenz example. CEBRA pull request #317

Citation

@inproceedings{muratore2026dysco,
  author = {Muratore, Paolo and Mathis, Mackenzie Weygandt},
  title = {Extracting Governing Equations from Latent Dynamics
           via Multi-View Contrastive Learning},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://arxiv.org/abs/2606.13260}
}

Apache License 2.0

About

Learn governing equations from latent dynamics using aligned, noisy observations. NeurIPS 2026.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages