๐Ÿ” Identifiability ๐Ÿ“ State-Space Models ๐Ÿ”ฌ Zenodo โœ๏ธ Medium ๐Ÿ Python 3.8+ ๐Ÿ“ฆ PyPI Ready

Identifiability Diagnostic

Framework for Regime-Switching State-Space Models

Can you learn the rules from the data alone?

Enterprise-grade unsupervised pre-training diagnostic system for identifying practical identifiability boundaries in 2-regime switching state-space models. Uses Observable Moment Matrix + SVD to determine whether regime parameters are identifiable from observations alone.

>85% test coverage. Full type hints. Production-ready.

"The circularity trap: You need to know the true model to train a model that learns the true model."

In regime-switching systems, you observe transitions but never directly observe which regime you're in. This creates a fundamental question: Given your data and interventions, can you actually identify the regime parameters? Or are you chasing a ghost? Identifiability Diagnostic answers this before you waste compute.

Seven-Step Diagnostic Pipeline

The framework implements a rigorous mathematical pipeline to determine identifiability:

[1] Compute First-Order Innovations
    dy_t = y_t - y_{t-1}
    
[2] Lift to Feature Space
    v_t = [dy_t, dy_{t-1}]^T
    
[3] Align Interventional Context
    Match intervention levels u to innovation timeline
    
[4] Construct Moment Matrix
    M โˆˆ โ„^{|U| ร— 4} with conditional covariances
    M_ij = Cov(v_t | u_t = u_i)
    
[5] Execute SVD
    M = U ฮฃ V^T (Singular Value Decomposition)
    
[6] Compute Metrics
    ฯƒ_2 (second singular value)
    Effective rank
    Condition number
    
[7] Deploy Gate
    if ฯƒ_2 > ฯ„ (5.12e-17):  IDENTIFIABLE โœ“
    else:                     NON-IDENTIFIABLE โœ—

Mathematical Foundation

For regime-switching model:

$$y_t = a_{s_t} y_{t-1} + b_{s_t} u_t + c_{s_t} u_t y_{t-1} + \eta_t$$

where s_t โˆˆ {0, 1} denotes regime, and u_t is exogenous intervention. The Observable Moment Matrix captures the covariance structure stratified by intervention level.

Key Decision Rule: The second singular value ฯƒโ‚‚ is the identifiability gating metric. If ฯƒโ‚‚ exceeds threshold, regime parameters are identifiable from data alone.

Why This Works

Approach Strength Weakness
Train & Pray No pre-checks needed 100 hours of compute wasted on unidentifiable problem
Theoretical Analysis Mathematically rigorous Requires hand-solving for each problem (weeks of work)
Observable Moment Matrix Automatic, <130ms per check Limited to SSM regime switching (but that's the target domain)

Key Features

๐ŸŽฏ SVD-Based Analysis

Automatically detects parameter identifiability via singular value spectrum of Observable Moment Matrix.

๐Ÿ”„ Regime-Switching Support

Full support for multi-regime autoregressive processes with exogenous interventions.

๐Ÿ“Š Comprehensive Metrics

Effective rank, condition numbers, singular values, and deployment decisions all computed automatically.

๐Ÿ›ก๏ธ Production-Grade

Full type hints, error handling, logging, and >85% test coverage. Ready for enterprise deployment.

๐Ÿš€ CI/CD Ready

GitHub Actions workflows, automated testing across Python 3.8โ€“3.11, multi-platform (Linux, macOS, Windows).

๐Ÿ“ฆ PyPI Package

Easy installation, full dependency management, semantic versioning, and regular updates.

Performance & Benchmarks

Benchmark results on Intel i7 @ 3.6GHz:

Task Data Size Time
Data Generation (T=100k) 100,000 observations ~50 ms
Pipeline Execution 100,000 observations ~80 ms
Full Diagnostic Cycle 100,000 observations ~130 ms
Parametric Sweep (5 ฮต values) 500,000 observations ~650 ms

Quality Metrics

Test Coverage

>85%

Type Hints

100%

Python Versions

3.8โ€“3.11

Platforms

3/3 โœ“

Installation & Quick Start

Install from PyPI

pip install identifiability-diagnostic

Or Install from Source

git clone https://github.com/prakulhiremath/identifiability-diagnostic.git
cd identifiability-diagnostic
pip install -e .

Development Installation

pip install -e ".[dev]"

Basic Usage

from identifiability_diagnostic import (
    RegimeSwitchingGenerator,
    PretrainingDiagnosticPipeline
)
from identifiability_diagnostic.utils.config import load_config

# Load configuration
config = load_config('config/parameters.yaml')

# Generate synthetic data
generator = RegimeSwitchingGenerator(config)
y, u = generator.generate(epsilon=1e-3, symmetric=False)

# Run diagnostic pipeline
pipeline = PretrainingDiagnosticPipeline(config)
metrics = pipeline.run(y, u)

# Interpret results
print(f"ฯƒ_2 = {metrics['sigma_2']:.4e}")
print(f"Decision: {metrics['deploy_decision']}")
print(f"Identifiable: {metrics['identifiable']}")

Command-Line Interface

# Run parametric sweep
python main.py --config config/parameters.yaml --log-level INFO

# Run with custom epsilon values
python main.py --epsilon 1e-5 1e-4 1e-3 1e-2 1e-1

# Test mode (smaller dataset)
python main.py --test --verbose

# Symmetric control only
python main.py --symmetric-only

Configuration

Default configuration in config/parameters.yaml:

simulation:
  T: 100000              # Time series length
  seed: 42               # Random seed
  sigma_n: 0.5           # Process noise std dev
  regime_0:
    a: 0.90              # AR coefficient regime 0
    b: 1.0               # Intervention coupling
    c: 0.0               # Bilinear term
  regime_1:
    a: 0.90              # AR coefficient regime 1
    b: 1.0
    c: 0.2               # Asymmetric bilinear!

diagnostic:
  u_levels: [-2, -1, 0, 1, 2]     # Intervention grid
  threshold_tau: 5.12e-17         # Gating threshold

Testing & Code Quality

Run All Tests

pytest tests/ -v --cov=src/identifiability_diagnostic

Test Suite Coverage

Code Quality

Project Structure

identifiability-diagnostic/
โ”œโ”€โ”€ .github/workflows/           # CI/CD configurations
โ”œโ”€โ”€ src/
โ”‚   โ””โ”€โ”€ identifiability_diagnostic/
โ”‚       โ”œโ”€โ”€ __init__.py
โ”‚       โ”œโ”€โ”€ core/                # Core algorithms
โ”‚       โ”‚   โ”œโ”€โ”€ data_generator.py
โ”‚       โ”‚   โ”œโ”€โ”€ pipeline.py
โ”‚       โ”‚   โ””โ”€โ”€ metrics.py
โ”‚       โ”œโ”€โ”€ utils/               # Utilities
โ”‚       โ”‚   โ”œโ”€โ”€ config.py
โ”‚       โ”‚   โ””โ”€โ”€ logging.py
โ”‚       โ””โ”€โ”€ exceptions.py
โ”œโ”€โ”€ tests/
โ”‚   โ”œโ”€โ”€ unit/                    # Unit tests (20+)
โ”‚   โ””โ”€โ”€ integration/             # Integration tests (10+)
โ”œโ”€โ”€ examples/                    # Usage examples
โ”œโ”€โ”€ config/
โ”‚   โ””โ”€โ”€ parameters.yaml          # Default config
โ”œโ”€โ”€ main.py                      # CLI entry point
โ”œโ”€โ”€ setup.py                     # Package setup
โ”œโ”€โ”€ pyproject.toml              # Modern packaging
โ”œโ”€โ”€ requirements.txt            # Dependencies
โ””โ”€โ”€ README.md

Citation

@software{identifiability_diagnostic_2024,
  title={Identifiability Diagnostic Framework for 
         Regime-Switching Models},
  author={Prakul S. Hiremath},
  year={2026},
  url={https://github.com/prakulhiremath/
       identifiability-diagnostic}
}

Identifiability Diagnostic Framework โ€” Regime-Switching State-Space Model Analysis

MIT License ยท Python 3.8+ ยท SVD-Based Analysis ยท Open Source

"Know before you train."