Skip to main content

Structural dynamics framework 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 • 🤖 LLM


📌 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 integrates:

  • statistical physics (energy, entropy, criticality)
  • machine learning (HMM, clustering, prediction)
  • epidemiology (DATASUS, COVID detection, SIR modeling)
  • AI interpretation (local LLM)

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


🧠 1. Introduction

Most real-world systems are not static — they are dynamical, nonlinear, and unstable.

Healthcare systems, in particular, exhibit:

  • regime shifts
  • overload cascades
  • systemic collapse under stress (e.g., COVID-19)

MetastableX treats epidemiology not as dashboards, but as:

a dynamical system evolving through regimes


⚙️ 2. Theoretical Framework

2.1 Stochastic Dynamics

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


2.2 Energy Landscape

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


2.3 Criticality

$$ \lambda \approx 0 $$


2.4 Information Principle

$$ \max (H + F) $$


⚠️ 3. Early Warning Signals

  • Variance ↑ → instability
  • Autocorrelation ↑ → critical slowing down
  • Entropy ↑ → disorder

🧬 4. Core Implementations

🧠 Hidden Markov Models (HMM)

  • Detect latent epidemiological regimes
  • Identify transitions (pre-critical → critical → collapse)
  • Works at municipality level

⚡ Phase Transition Detection

  • Automatic rupture detection using ruptures

  • Detects:

    • outbreaks
    • structural breaks
    • COVID onset

🌪 Entropy Analysis

  • Rolling entropy over time
  • Measures system disorder
  • Peaks indicate instability

📉 Critical Slowing Down

  • Variance + autocorrelation increase
  • Early warning of collapse before events

🔗 Temporal Clustering (MetastableX core)

  • Groups time-series into regimes
  • Identifies recurring epidemiological patterns

🏥 5. Epidemiological Layer

📊 DATASUS Integration

  • SIH/SUS real data ingestion
  • Multi-state and multi-year analysis
  • Municipality-level resolution

🦠 COVID Detection

  • CID-based filtering (U07, B34)

  • Detects pandemic as:

    • phase transition
    • entropy spike
    • regime shift

📍 CID Filtering

  • Filter dashboard by disease

  • Enables:

    • disease-specific analysis
    • risk stratification

🏆 National Ranking

  • Ranking by:

    • municipality
    • CID
    • normalized rates

⚙️ SIR + ML Modeling

  • Classical epidemiological modeling:

$$ S \rightarrow I \rightarrow R $$

  • Combined with machine learning for:

    • prediction
    • anomaly detection

🤖 6. LLM Interpretation Layer

Local AI (Llama3 via Ollama)

  • Fully offline
  • No API required

Capabilities

  • 🧠 Explain epidemiological dynamics

  • 📊 Translate metrics into natural language

  • 📋 Generate scientific reports

  • 🔍 Interpret:

    • entropy
    • HMM states
    • outbreaks
    • transitions

Pipeline

data → physics → ML → regimes → metrics → LLM → explanation

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.5.tar.gz (33.5 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.5-py3-none-any.whl (51.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: metastablex-0.1.5.tar.gz
  • Upload date:
  • Size: 33.5 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.5.tar.gz
Algorithm Hash digest
SHA256 a102a9292513b2cc325207ceeaba2e059b36785678832b02b6a8ebe31613bfb2
MD5 2b44578ff35179557fa231277dcd0915
BLAKE2b-256 0d2e34312729f603d1a0b6b3e0a8522c490de423f537e4add821ff9d762a69d2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: metastablex-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 51.5 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 131127b71600b3a0e6ec3ffabb80e1cdac791bc13fc2459724b931af32ccd9e1
MD5 6134e7a462c10ec774c9212bc6352221
BLAKE2b-256 21e3c5dda9aaa7bd9089b8e0093b1c983dae588846999a830a606d3f4590cf90

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