Skip to content

About

The repository implements the **Internal Controller Identification (ICI)** identification framework, covering the context-enriched extension (a single certified model for a family of environments) and the PAC-Bayesian training objective.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

Neural Closed-Loop Identification of Nonlinear Systems with Stability and Generalization Guarantees

Code accompanying

Neural Closed-Loop Identification of Nonlinear Systems with Stability and Generalization Guarantees Laura Meroi, Mahrokh G. Boroujeni, Leonardo Massai, Giancarlo Ferrari-Trecate Institute of Mechanical Engineering, EPFL — submitted to Automatica

The repository implements Internal Controller Identification (ICI): a complete parameterization of the nonlinear systems stabilized by a given controller, so that every model reachable by training is certified to be stabilized by the data-collection controller. It also covers the context-enriched extension (a single certified model for a family of environments) and the PAC-Bayesian training objective.

Installation

conda create -n ici python=3.12
conda activate ici
pip install -r requirements.txt

The certified state-space cores come from neural-ssm, which requirements.txt installs from git; without it the import of models fails with ModuleNotFoundError: No module named 'neural_ssm'. Everything runs on CPU: the models are small enough that CPU beats GPU, and the scripts set PYTORCH_FORCE_CPU=1 themselves.

Layout

One entry point per experiment, each with a docstring explaining the setup and a subcommand per artifact:

file section artifacts
exp1_unstable_scalar.py 6.2 Table 2, Figure 4
exp2_partial_observation.py 6.3 Table 3, Figures 5–6
exp3_context_aware_ici.py 6.4 Figures 7–9
exp4_pac_bayes.py 6.5 Figures 10–11

What each experiment shows

6.2 — Feedback-stabilized unstable scalar system. An open-loop unstable plant is operated under a controller that satisfies the hypotheses of Theorem 1 globally. The certificate holds for every value of the parameters, hence for whatever model training returns, whereas an uncertified method is stabilized or not depending on the model that particular run produced. The randomization is therefore over training runs: every strategy is retrained from 40 seeds and each resulting model is redeployed in feedback with K.

6.3 — Point-mass robot under partial observation. Only the position is measured and the measurement noise is AR(1), so the feedback correlates the input with the noise: this is the setting where a criterion that simulates the model on the recorded input is classically biased. Four strategies are compared across an excitation sweep and a noise sweep. The indirect ICI criterion never sees the input --- the loop cancellation reduces it to fitting S(r) --- and degrades most gracefully as the noise grows.

6.4 — Generalization across environments. The robot now moves in a family of friction fields built from random "sticky patches". Two models share the same certified core and differ only in whether they receive the local drag scale as context. Context cannot simply be appended to the inputs, since contextual signals are bounded but generally not in l_p; it enters through bounded, strictly causal channels that leave the certified gain finite. At test time the context is read at the model's own predicted position, with no oracle access to the environment.

6.5 — PAC-Bayesian identification under data scarcity. With few noisy trajectories, empirical-risk minimization over the certified parameterization overfits: the training loss falls below the measurement-noise floor, i.e. the model memorizes the noise realization. PAC-Bayesian training over the same parameterization keeps a small train-test gap and returns a non-vacuous certificate, using an informative prior transferred from a nominal plant.

Supporting code:

simulations/      one script per experiment (table above). Each reads top to bottom as
                  Setup / Shared helpers / Training / Test / Figures and tables
utils/figures_exp*.py
                  the plotting code of each experiment: it owns the presentation choices
                  (colours, legend labels, line styles) and receives the evaluated results,
                  so changing how a figure looks never touches how a number is produced
models/           operators (ContractiveREN, SSMOperator, UnstableSSM, RNN/LSTM baselines),
                  plants, controllers, closed-loop interconnection, SVGD wrapper
utils/            helpers and config.py (device selection)
datasets/         trajectory dataset used by the PAC-Bayes experiment
inference_algs/   SVGD and the prior/posterior distributions
saved_results/    one folder per experiment, matching simulations/: the published figures
                  and tables, plus the checkpoints needed to regenerate them

The scripts resolve the repository root from their own location, so they can be run from any working directory, as long as the layout above is kept intact.

Reproducing the paper

Each script runs end to end with no arguments and writes its figures and tables into the matching saved_results/ folder:

python simulations/exp1_unstable_scalar.py      # Table 2, Figure 4
python simulations/exp2_partial_observation.py  # Table 3, Figures 5 and 6
python simulations/exp3_context_aware_ici.py    # Figures 7, 8 and 9
python simulations/exp4_pac_bayes.py            # Figures 10 and 11

Each script starts with a single flag:

TRAINING = False      # False: load the saved models.  True: retrain from scratch.

With TRAINING = False (the default) the stored checkpoints are loaded, the test phase runs, and the published figures and tables are regenerated in seconds. Setting it to True retrains that experiment first and then does exactly the same evaluation --- expect a few hours for Experiments 1 and 4, about an hour for Experiment 3, and roughly a day for the full campaign of Experiment 2.

About

The repository implements the **Internal Controller Identification (ICI)** identification framework, covering the context-enriched extension (a single certified model for a family of environments) and the PAC-Bayesian training objective.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages