Skip to main content

Metastable dynamics detection for complex systems

Project description

🧠 MetastableX

A Unified Computational Framework for Metastability and Critical Transitions in Complex Systems

Bridging statistical physics, machine learning and epidemiology to detect systemic instability in real-world dynamics.

⚙️ PyTorch • 📊 Time-Series • 🧠 Complex Systems • 🏥 Public Health • 🌍 Open Science


📌 Abstract

Complex systems—from biological organisms to healthcare infrastructures—operate near the edge of stability, where small perturbations can trigger large-scale transitions.

We introduce MetastableX, a computational framework for detecting:

  • metastable regimes
  • early warning signals
  • critical transitions

using time-series analysis, statistical physics, and machine learning.

The framework combines:

  • stochastic dynamical systems modeling
  • information-theoretic metrics
  • learned representations via neural networks

and is validated on real-world epidemiological data from SIH/SUS (Brazil).

We show that healthcare systems exhibit signatures consistent with marginal criticality, enabling early detection of systemic stress and potential collapse.


🧠 1. Introduction

Many natural and social systems exhibit nonlinear dynamics characterized by abrupt transitions.

Examples include:

  • cardiac arrhythmias
  • ecosystem collapse
  • financial crises
  • hospital overload

Traditional statistical approaches fail to capture these transitions because they rely on:

  • averages
  • linear correlations

Instead, such systems require a structural and dynamical analysis framework.


⚙️ 2. Theoretical Framework

2.1 Stochastic Dynamics

We model the system as:

$$ \frac{dx}{dt} = f(x) + \sigma \eta(t) $$

where:

  • $x(t)$ is the system state
  • $f(x)$ encodes deterministic dynamics
  • $\eta(t)$ is stochastic noise

2.2 Potential Landscape

The system can be represented through an effective potential:

$$ U(x) = -\frac{\sigma^2}{2}\log P(x) $$

Interpretation:

Regime Landscape
Stable deep wells
Metastable shallow wells
Critical flattened

2.3 Criticality Condition

We hypothesize that complex systems operate near:

$$ \lambda \approx 0 $$

where $\lambda$ is the Lyapunov exponent, defining the boundary between:

  • order ($\lambda < 0$)
  • chaos ($\lambda > 0$)

2.4 Information-Theoretic Principle

We define an informational optimality condition:

$$ \max (H + F) $$

where:

  • $H$ = Shannon entropy
  • $F$ = Fisher information

This condition corresponds to maximum structural adaptability.


⚠️ 3. Early Warning Signals

Variance

$$ \sigma^2 = \frac{1}{N}\sum (x_i - \mu)^2 $$

Autocorrelation

$$ AC_1 = \frac{ \sum (x_t-\mu)(x_{t-1}-mu) }{ \sum (x_t-\mu)^2 } $$

Interpretation

Signal Meaning
↑ Variance instability
↑ Autocorrelation critical slowing down

🧬 4. Information Geometry

Entropy

$$ H = -\sum p_i \log p_i $$

Fisher Information

$$ F = \int \frac{(\nabla p)^2}{p} dx $$

Together, they define a statistical manifold where:

  • entropy → exploration
  • Fisher → curvature

🤖 5. Machine Learning Formulation

MetastableX extends classical physics with a learned representation:

features = metastable_features(x)
y_pred = model(features)

The model learns:

  • latent regime transitions
  • nonlinear instability patterns
  • hidden structural signals

🏥 6. Application to Health Systems

Healthcare systems behave as complex adaptive systems.

We model hospitalization dynamics using:

  • SIH/SUS data
  • municipal time series
  • population-normalized rates

6.1 Data Source

SIH/SUS — Brazilian Hospital Information System

Each record corresponds to a hospitalization (AIH).


6.2 Rate Definition

$$ Rate = \frac{\text{Hospitalizations}}{\text{Population}} \times 10^4 $$


6.3 Structural Monitoring

For each municipality we compute:

  • variance
  • autocorrelation
  • entropy
  • metastable score

📊 7. Results

Empirical analysis shows that:

  • hospital systems exhibit metastable regimes
  • transitions are preceded by early warning signals
  • critical phases correspond to system overload risk

🧠 8. Interpretation

We interpret healthcare systems as operating near:

marginal criticality

This enables:

  • adaptability
  • responsiveness
  • but also vulnerability to collapse

🌍 9. Implications

MetastableX enables:

  • early detection of hospital stress
  • structural monitoring of public health systems
  • real-time systemic risk assessment

⚙️ 10. Implementation

Installation

pip install metastablex

Usage

from metastablex import MetastableModel

model = MetastableModel()
model.fit(series)

score = model.predict(series)

📊 11. Dashboard

The framework includes an interactive dashboard for:

  • time-series visualization
  • regime classification
  • risk ranking

🧱 12. Architecture

metastablex/
├── ml/
├── physics/
├── regimes/
├── model.py

🔬 13. Scientific Contributions

This work contributes:

  • a unified framework for metastability detection
  • integration of physics + ML + epidemiology
  • empirical validation on large-scale health data

🚀 14. Future Work

  • multiscale modeling
  • spatial epidemiology
  • digital twin of health systems
  • real-time surveillance

👨‍🔬 Author

Lucas Amaral Dourado

  • Medical Student — Federal University of Tocantins
  • Biomedical Engineering Student — UNINTER

📜 License

MIT License


MetastableX — Toward a physics of complex adaptive systems

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

metastablex-0.1.1.tar.gz (24.2 kB view details)

Uploaded Source

Built Distribution

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

metastablex-0.1.1-py3-none-any.whl (36.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: metastablex-0.1.1.tar.gz
  • Upload date:
  • Size: 24.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for metastablex-0.1.1.tar.gz
Algorithm Hash digest
SHA256 52d043d37367fa4753727a3efb3f3ce10178867c123f83bf50622c52ebcdb8ee
MD5 0cfb0d57d4204270a61a2b32e33e57af
BLAKE2b-256 c45b7710539910f9866ca1789953010a83c5cd5cc6759e02c3969508835b0d94

See more details on using hashes here.

File details

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

File metadata

  • Download URL: metastablex-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 36.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for metastablex-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 61c8b93dd578d6e02718c3be9e8363c429ef31283c7972ee33331ecd973d3361
MD5 52dda3c976ac77e430891109dbe17894
BLAKE2b-256 0ba2190ee2a30576f7fcb05a7ba494786a388c0dcb667bacdc7ae95802cf9448

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