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.3.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.3-py3-none-any.whl (51.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: metastablex-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 6ab4c219a0b6091faf9046c03f60e7bb9e8f3d58c854db64cc2e1836e844df71
MD5 d92fd85d81af4dca76a4969409c458a2
BLAKE2b-256 6d8c7d1f7ce834138343a4738faba57eb4410233e52691dc2666f3ea333d8e65

See more details on using hashes here.

File details

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

File metadata

  • Download URL: metastablex-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2dbeee3f1960c176646082ecd3ef175f67e2732448149cb28ab104692d8ebfdf
MD5 0f8d6c262dcc7f80e9827f3cf671f975
BLAKE2b-256 2351fa36938beb03f9f3a0179a03c3e6ab01c48398cf2effa043f34604b89e66

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