Metadata-Version: 2.4
Name: universal-log-ts
Version: 7.9.1
Summary: UNIVERSAL_LOG — Domain-agnostic threshold detection, multi-channel structural breaks, and falsification
Author: Zackary Drasse-Ménard (FindPrint)
License-Expression: MIT
Project-URL: Homepage, https://findprint.github.io/2026-11-28/
Project-URL: Repository, https://github.com/FindPrint/2026-11-28
Project-URL: Documentation, https://github.com/FindPrint/2026-11-28/blob/main/LIVRE_BLANC.md
Project-URL: Issues, https://github.com/FindPrint/2026-11-28/issues
Keywords: threshold-detection,time-series,change-point,falsification,persistent-homology,complexity
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.20.0
Requires-Dist: pandas>=1.3.0
Requires-Dist: scipy>=1.7.0
Provides-Extra: viz
Requires-Dist: matplotlib>=3.6.0; extra == "viz"
Requires-Dist: seaborn>=0.12.0; extra == "viz"
Provides-Extra: full
Requires-Dist: ripser>=0.6.0; extra == "full"
Provides-Extra: bench
Requires-Dist: ruptures>=1.1.9; extra == "bench"
Requires-Dist: pyarrow>=14.0.0; extra == "bench"
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-cov>=3.0.0; extra == "dev"
Requires-Dist: flake8>=6.0.0; extra == "dev"
Requires-Dist: matplotlib>=3.6.0; extra == "dev"
Requires-Dist: seaborn>=0.12.0; extra == "dev"
Dynamic: license-file

# UNIVERSAL_LOG (v7.9.1)

[![CI/CD Pipeline](https://github.com/FindPrint/2026-11-28/actions/workflows/ci.yml/badge.svg)](https://github.com/FindPrint/2026-11-28/actions/workflows/ci.yml)
[![PyPI version](https://img.shields.io/pypi/v/universal-log-ts.svg)](https://pypi.org/project/universal-log-ts/)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.24637051.svg)](https://doi.org/10.5281/zenodo.24637051)
[![Release](https://img.shields.io/github/v/release/FindPrint/2026-11-28?label=release)](https://github.com/FindPrint/2026-11-28/releases/latest)
[![Python 3.10–3.12](https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12-blue.svg)](https://www.python.org/)
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/FindPrint/2026-11-28/blob/main/notebooks/01_quickstart_univariate.ipynb)
[![Live Showcase](https://img.shields.io/badge/showcase-GitHub%20Pages-0b6e4f.svg)](https://findprint.github.io/2026-11-28/)

**Domain-agnostic structural threshold, multi-regime, and multivariate break detection with multi-null falsification for time series.**

---

## Interactive Google Colab Notebooks (One-Click)

| Notebook | What You Can Run in 60 Seconds | Launch |
|---|---|---|
| [`notebooks/01_quickstart_univariate.ipynb`](notebooks/01_quickstart_univariate.ipynb) | Univariate Step vs Random Walk vs Smooth Ramp + Inline HTML5/SVG Report | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/FindPrint/2026-11-28/blob/main/notebooks/01_quickstart_univariate.ipynb) |
| [`notebooks/02_multi_regime_and_multivariate.ipynb`](notebooks/02_multi_regime_and_multivariate.ipynb) | Multi-Regime (`detect_multi_regime`) + `v7.8.0` Cholesky Multivariate Falsification (`scan_multivariate_channels`) | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/FindPrint/2026-11-28/blob/main/notebooks/02_multi_regime_and_multivariate.ipynb) |
| [`notebooks/03_pdac_immune_gradient_audit.ipynb`](notebooks/03_pdac_immune_gradient_audit.ipynb) | 4-Cohort PDAC Continuous Immune Gradient vs Discrete Subtype Audit | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/FindPrint/2026-11-28/blob/main/notebooks/03_pdac_immune_gradient_audit.ipynb) |
| [`monoliths/UNIVERSAL_LOG_v7.9.1_universal.ipynb`](monoliths/UNIVERSAL_LOG_v7.9.1_universal.ipynb) | Self-Contained Single-File Package Monolith (Zero External Install) | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/FindPrint/2026-11-28/blob/main/monoliths/UNIVERSAL_LOG_v7.9.1_universal.ipynb) |

---

## Overview

`UNIVERSAL_LOG` is a statistical instrument for detecting regime changes, abrupt jumps, slope breaks, multi-regime transitions, and synchronized multivariate breaks without domain priors. It combines vectorized sliding-window effect sizes, multi-channel structural detectors, permutation-based and Marriott–Pope `AR(1)`/`ARIMA`/Cholesky-multivariate falsification suites, walk-forward validation, and 29 complexity/topological estimators organized across levels **L1–L7**.

### Core Design Principles (v7)

- **P1 — Zero domain priors:** No domain names, domain lexicons, or domain-tuned heuristics in code.
- **P2 — No hand-tuned weights:** Inverse-variance stability weighting (`1 / (1 + CV)`), or equal weights.
- **P3 — Name-invariant direction & verdict:** Direction equals the empirical sign of Cohen's *d*, and all random null streams seed from canonical IEEE-754 numeric `values_hash_sha256` (so renaming columns or switching CSV/DataFrame leaves detector, cut, effect size, *p*-value, and Grade bit-for-bit invariant, verified at runtime).
- **P4 — No harmonic prior:** Uniform Monte Carlo and permutation nulls; harmonic jitter is an optional comparative ablation only.
- **P5 — Falsification first:** Every threshold faces permutation-corrected scans, `B=100` vectorized white-noise and shuffled-target nulls, physical-axis OLS + smooth quadratic curvature guard ($H_{0,\text{quad}}$), AR(1)/ARIMA/volatility surrogate nulls, split-half checks, multi-window stability, and expanding-window walk-forward persistence.
- **P6 — Effect + CI + *p*:** Never a bare score alone.
- **P7 — Full reproducibility:** Fixed seeds, input/code metadata, SHA-256 hashes, and deterministic outputs.
- **P8 — Calibrated diagnostic ($T_{\log}$):** $T_{\log}$ is explicitly calibrated against its temporal permutation null and serves strictly as a diagnostic, never as proof.

---

## Installation

### Requirements

- Python 3.10+
- `numpy`, `pandas`, `scipy` (core)
- `matplotlib`, `seaborn` (visualization)
- `pytest`, `pytest-cov` (testing)
- `ripser` (optional, for Vietoris-Rips `PersistentHomology`; autonomous `H0_UnionFind` fallback built-in since v7.6.0)

### Editable / Local Install

```bash
# Install from PyPI (import name: universal_log)
pip install universal-log-ts

# Or editable local install from source
pip install -r requirements.txt
pip install -e ".[dev]"
```

With optional persistent homology support:

```bash
pip install -e ".[dev,full]"
```

---

## Project Structure

```text
11-27-2026/
├── LIVRE_BLANC.md                   # Master living whitepaper ("monolithe pour tous", auto-synced)
├── universal_log/                   # Voie 3 (canonical): modular Python package (v7.9.1)
│   ├── __init__.py                  # Public API exports (15 symbols incl. detect_multi_regime & scan_multivariate_channels)
│   ├── __main__.py                  # Entry point for `python -m universal_log`
│   ├── cli.py                       # CLI argument parser & --describe-limits
│   ├── config.py                    # UniversalConfig & mode presets
│   ├── data.py                      # UniversalDataset loader, canonical values_hash, axis regularity & synthetic demos
│   ├── stats.py                     # Cohen's d, bootstrap CI, vectorized permutation tests
│   ├── estimators.py                # 29 complexity estimators (incl. autonomous H0_UnionFind) + calibrated T_log
│   ├── detection.py                 # Vectorized scans, 5 structural channels (physical-axis OLS + H0_quad), Cholesky MV surrogate
│   ├── falsification.py             # Falsification suite (B=100 nulls), AR(1)/ARIMA/vol surrogates, multi-regime, causal walk-forward, grading
│   ├── diagnostics.py               # Optional segmented MC + Step 1-4 suite
│   ├── levels.py                    # L1..L7 universal structural diagnostics (pre-holdout L7 boundaries & motifs)
│   ├── prediction.py                # Locked cross-study motif prediction (deduplicated replications, pre-holdout verified)
│   ├── pipeline.py                  # analyze() orchestration & exports
│   ├── report_html.py               # Self-contained offline HTML5/SVG report renderer (incl. multi-regime bands)
│   └── regression.py                # Built-in non-regression self-tests (29 checks)
├── tracks/                          # The analytical tracks (Voie 1, Voie 1.1, Voie 2, Voie 3 pointer)
│   ├── README.md                    # Comparative guide & CLI invocation for all tracks
│   ├── voie_1_holographique_v6.5.0/ # Voie 1: holographic 2-layer T_log, 3-anchor triangulation, CSD, L1-L7a/b
│   ├── voie_1_holographique_v6.6.0/ # Voie 1.1: calibrated double-null holographic track (30-60x faster, H0_UnionFind)
│   ├── voie_2_socle_p1_p8_v7.1.5/   # Voie 2: minimalist P1-P8 single-channel baseline + 3-cohort MC
│   └── voie_3_instrument_calibre_v7.8.0/ # Pointer to universal_log/ & monoliths/
├── monoliths/                       # Generated single-file Voie 3 monoliths (.py & .ipynb, v7.9.1)
├── notebooks/                       # 3 one-click Google Colab notebooks + exploration.ipynb
├── theory/                          # Theoretical T_log corpus (original concept + calibrated v7.4/v7.5)
├── docs/                            # GitHub Pages showcase, quickstart, testing, real-data, audits, and canonical T_log spec
├── tools/                           # Monolith builders, preprint PDF compiler, figures, SHA-256 manifest, whitepaper sync
├── UNIVERSAL_LOG_v7.1.5_universal.py # Backward-compatible CLI/import shim (delegates to v7.9.1)
├── datasets/                        # 9 synthetic benchmark CSVs + metadata
├── datasets_real/                   # 19 real non-synthetic empirical CSVs (+ occupancy) + metadata
├── datasets_holdout*/               # 10 chronological SHA-256 blind holdout cohorts (R, v731..v791)
├── tests/                           # Unit tests (58), SOTA & multi-regime vs ruptures benchmarks, MC calibrations, holdouts
├── .github/workflows/ci.yml         # Automated CI/CD pipeline
├── MANIFEST.sha256                  # Complete SHA-256 provenance manifest
├── pyproject.toml                   # Package configuration
├── pytest.ini                       # Pytest configuration
├── requirements.txt                 # Python dependencies
└── LICENSE                          # MIT License
```

---

## Usage

### Command Line

```bash
# Analyze a CSV / Parquet / JSON dataset
python -m universal_log --input datasets/demo_step.csv --mode fast --output results/demo_step

# Or via installed console script (after `pip install -e .`)
universal-log --input datasets/demo_step.csv --mode robust

# Specify explicit control and target columns
python -m universal_log --input data.csv --control time --target signal_1

# Run synthetic built-in demos
python -m universal_log --demo step
python -m universal_log --demo logistic
python -m universal_log --demo null

# Run built-in non-regression test suite
python -m universal_log --self-test

# Print frozen routing gates, stubs, surrogate rules, and non-claims
python -m universal_log --describe-limits
```

### Key CLI Flags

- `--input`: Path to CSV, Parquet, or JSON file.
- `--control`: Ordered control axis column name (auto-inferred if omitted).
- `--target`: Target variable column name (auto-inferred if omitted).
- `--mode`: Sampling preset: `fast`, `robust`, or `full`.
- `--detection-mode`: `auto` (selects among `level_shift`, `detrended_jump`, and `slope_break` when appropriate) or `mean` (raw level shift only).
- `--output`: Output directory (default: `./results_v7`).
- `--complexity-diagnostics`: Enable exploratory calibrated `T_log`, full-flux estimators, and `L7` sliding-window interactions (disabled by default on the standard `analyze()` path; required by `predict_universal()`). A single-pass `L5` pre/post-$T_0$ contrast across the 13 unique dimension estimators always runs on the default path as a non-voting descriptor.
- `--describe-limits`: Print frozen `DEFAULT_ROUTING_GATES`, estimator stubs, surrogate/grading limits, and non-claims.
- `--full-validation`: Enable heavy 3-cohort segmented MC + trajectory validation.
- `--harmonic-ablation`: Run optional harmonic-jitter robustness ablation.
- `--seed`: Random seed (default: `42`).

### Python API

```python
from universal_log import UniversalConfig, analyze

config = UniversalConfig(
    seed=42,
    mode="robust",
    detection_mode="auto",
    output_dir="./results_v7",
    verbose=True,
)

result = analyze("datasets/demo_step.csv", config=config)
print(result["grade"]["grade"], result["scan"]["control_value"])
```

---

## Execution Modes

| Mode | Bootstrap | Pairwise Permutations | Scan Permutations | MC Paths (`--full-validation`) |
|------|-----------|-----------------------|-------------------|--------------------------------|
| `fast` | 100 | 200 | 200 | 100 |
| `robust` | 300 | 500 | 500 | 200 |
| `full` | 1000 | 1000 | 1000 | 400 |

---

## Testing & Visualization

```bash
# Unit & integration tests
pytest -v

# Built-in non-regression checks
python -m universal_log --self-test

# Regenerate synthetic benchmark datasets
python tests/generate_test_datasets.py

# Run full synthetic benchmark suite and write reports to results/reports/
python tests/run_tests.py

# Run multi-mode stability comparison (fast vs robust)
python tests/run_multi_mode_tests.py

# Run cross-domain benchmark on 19 real non-synthetic empirical datasets + predict_universal() validation
python tests/run_real_datasets.py --mode fast

# Run frozen gate sensitivity ablation (+-10%, +-20%)
python tests/run_ablation.py --ablation

# Prepare blind SHA-256 holdout manifest (downloads, hashes code + data, NO analysis)
python tests/run_ablation.py --prepare-holdout

# Evaluate blind holdout ONCE (verifies code/data hashes, then runs analyze)
python tests/run_ablation.py --evaluate-holdout

# Render summary plots to results/visualizations/
python tests/visualize_results.py
```

---

## Outputs

Each `analyze()` run writes four files into `--output`:

1. **`results.json`**: Full structured output (`universal_contract`, `scan`, `level_shift_scan`, `structural_scans`, `cascade`, `levels` L1–L7, `falsification`, `walk_forward`, `grade`, `estimators_by_flux`, `t_log_target`, `invariance_rename_test`, `manifest`).
2. **`thresholds.csv`**: Central threshold $T_0$ and 5-point derivative cascade ($T_{-2}, T_{-1}, T_0, T_{+1}, T_{+2}$).
3. **`report.txt`**: Concise human-readable summary.
4. **`report.html`**: Self-contained interactive HTML5/SVG visual report (series + $T_0$ + cascade $T_{-2}\dots T_{+2}$ + active transformed view + null comparison + L1–L7 & estimators) directly openable offline in any browser.

---

## Disclaimer & Known Methodological Scope (`v7.9.1`)

**STATUS:** Threshold detection and falsification instrument.
- **NOT** scientific proof of a causal theory.
- **NOT** a medical diagnosis.
- **NOT** financial advice.
- **Walk-forward causal scope (`v7.9.1`, condition on missing data):** `walk_forward()` selects each split's window, detector channel, preprocessing, and threshold strictly on the past prefix `[:train_end]` (`strictly_causal = True`, `detector_selection_scope = "past_prefix_only"`). **Important condition for incomplete series:** because non-finite (`NaN`) rows are dropped upfront and expanding splits are computed by observation count (`edges = np.linspace(0, n, n_splits + 1)`), strict past invariance holds **for fixed retained-observation count and split boundaries** (mutating future finite values leaves finished splits bit-for-bit identical; turning future observations into missing `NaN` rows reduces `n` and shifts earlier split boundaries accordingly).
- **Pre-holdout L7 motifs (`v7.9.1`):** `L7` freezes segment boundaries, training threshold `train_t0_idx`, training informativeness, and candidate complementary pairs strictly before opening the held-out last segment (`segment_boundary_scope = "pre_holdout_prefix_only"`, `motif_selection_scope = "pre_holdout_segments_only"`), and `predict_universal()` rejects any pair peaking in the held-out segment or containing duplicate replications.
- **Known `slope_break` routing limitation on irregular cadence (scheduled for `v7.9.2`):** `within_regime_ar1()` detrends each half separately by **observation row index** rather than physical control coordinate `x`. On sharp low-noise slope breaks under highly irregular spacing (observed in `h10_pos_08_true_slope_irreg`), row-index detrending can inflate `phi_within` above the frozen gate `0.45` (`0.488` vs `0.077` with two physical-axis lines or `0.221` with a continuous physical-axis hinge), diverting routing away from `slope_break`. Head-to-head comparison of both physical-axis residual models across true breaks, smooth curves, and autocorrelated noise is scheduled for `v7.9.2`.

All detected thresholds (even Grade A) must be interpreted cautiously and replicated on independent data.

---

## Documentation & Governance

- [**5-Minute Quickstart (`docs/quickstart.md`)**](docs/quickstart.md) — `pip install universal-log-ts`, CLI, Python API, `detect_multi_regime()`, `scan_multivariate_channels()`, and grading rules (install `pip install "universal-log-ts[bench]"` for `ruptures` & Parquet `pyarrow`)
- [**Interactive GitHub Pages Showcase**](https://findprint.github.io/2026-11-28/) (`docs/index.html`) — 300 DPI figures + embedded interactive HTML5/SVG reports
- [**Preprint PDF (`paper/UNIVERSAL_LOG_v7.9.1_preprint.pdf`)**](paper/UNIVERSAL_LOG_v7.9.1_preprint.pdf) · [`paper/paper.md`](paper/paper.md) · [`paper/paper.bib`](paper/paper.bib) · [`paper/JOSS_CHECKLIST.md`](paper/JOSS_CHECKLIST.md) — JOSS/arXiv/OSF paper + 300 DPI figures + [`CITATION.cff`](CITATION.cff) / [`.zenodo.json`](.zenodo.json)
- [**v7.9.0 → v7.9.1 Comparison (910 Trajectories)**](results/v790_ablation/v791_before_after_report.md) · [**10th Blind Holdout (`v7.9.1`, 13/14)**](results/holdout_v791/holdout_v791_report.md) · [**v7.8.1 → v7.9.0 Attribution**](results/v790_ablation/v790_before_after_report.md) · [**9th Blind Holdout (`v7.9.0`, 12/13)**](results/holdout_v790/holdout_v790_report.md) · [**Corrected PDAC 40-Permutation Study**](results/pdac_immune_replication/pdac_immune_report.md)
- [**Archived External Technical Audit (`v7.8.0`)**](docs/audits/2026-11-29_audit_v7.8.0_d02275d.md) — Independent audit at commit `d02275d` (910 replayed trajectories + prioritized roadmap)
- [**Livre Blanc Complet (`LIVRE_BLANC.md`)**](LIVRE_BLANC.md) — Monolithe documentaire vivant (les 3 Voies, théorie `T_log`, résultats mesurés, journal)
- [Guide des 3 Voies (`tracks/README.md`)](tracks/README.md)
- [Spécification canonique `T_log` (`docs/tlog_spec.md`)](docs/tlog_spec.md)
- [T_log calibré v7.4.0 (`theory/calibrated/TLOG_calibrated_v7.4.0.md`)](theory/calibrated/TLOG_calibrated_v7.4.0.md) & [Concept original (`theory/original/TLog_original.txt`)](theory/original/TLog_original.txt)
- [Technical Documentation](docs/technical_documentation.md) · [Testing Guide](docs/testing_guide.md) · [Real Datasets Guide](docs/real_datasets_guide.md)
- [Contributing Guide (`CONTRIBUTING.md`)](CONTRIBUTING.md) · [Code of Conduct (`CODE_OF_CONDUCT.md`)](CODE_OF_CONDUCT.md)

---

## Citation

If you use `UNIVERSAL_LOG` (`universal-log-ts`) in your research, please cite the archived Zenodo release ([`CITATION.cff`](CITATION.cff)):

- **Concept DOI (all versions):** [`10.5281/zenodo.24637051`](https://doi.org/10.5281/zenodo.24637051)
- **Version DOIs:** `v7.9.0` [`10.5281/zenodo.24659825`](https://doi.org/10.5281/zenodo.24659825) · `v7.8.1` [`10.5281/zenodo.24656867`](https://doi.org/10.5281/zenodo.24656867) · `v7.8.0` [`10.5281/zenodo.24653639`](https://doi.org/10.5281/zenodo.24653639) · `v7.7.0` [`10.5281/zenodo.24651717`](https://doi.org/10.5281/zenodo.24651717) · `v7.6.0.post1` [`10.5281/zenodo.24637052`](https://doi.org/10.5281/zenodo.24637052)

```bibtex
@software{drasse_menard_2026_universal_log,
  author       = {Drasse-M{\'e}nard, Zackary},
  title        = {{UNIVERSAL\_LOG}: Domain-Agnostic Structural Threshold Detection and Multi-Null Falsification in Time Series},
  year         = 2026,
  publisher    = {Zenodo},
  version      = {v7.9.1},
  doi          = {10.5281/zenodo.24637051},
  url          = {https://doi.org/10.5281/zenodo.24637051}
}
```

---

## License

MIT License — see [LICENSE](LICENSE).
