gitbuyer_

genesiscode2026/prediction-audit-calibration-ledger

privatemain

Tamper-evident forecast recording, SHA-256 commitment verification and Brier-score calibration for models and agents.

README

Prediction Audit & Calibration Ledger

Tamper-evident forecast recording, verification and Brier-score calibration.


1. WHAT IS THIS?

The Prediction Audit & Calibration Ledger is a standalone Python library for quantitative funds, research desks, AI signal providers, and prediction markets to record pre-event forecasts in a continuous, tamper-evident cryptographic hash chain and score their realized accuracy using Brier scoring rules upon post-event resolution.

2. WHO IS IT FOR?

  • Quantitative researchers and algorithmic trading firms.
  • Prediction market operators and signal providers.
  • AI forecasting model evaluators seeking mathematical proof of model calibration.

3. WHAT PROBLEM DOES IT SOLVE?

Without pre-event cryptographic commitments, historical trading signals and prediction records are susceptible to "hindsight bias," cherry-picking, and retroactive tampering. Running full Web3 blockchain smart contracts for high-frequency predictions incurs prohibitive gas fees and leaks alpha publicly before execution. This ledger provides local, zero-gas, tamper-evident hash chaining.

4. WHY PAY FOR IT INSTEAD OF BUILDING IT?

  • Canonical Payload Serialization: Uses deterministic key sorting to guarantee that identical payloads always yield identical SHA-256 digests.
  • Tamper Evidence: Detects any retroactive field mutation, record deletion, or row reordering during chain traversal.
  • Calibrated Brier Scoring: Implements mathematically validated binary and multi-class Brier scoring algorithms ($BS = \sum (p_k - o_k)^2$).
  • Zero External Dependencies: Built 100% on Python 3.11+ standard library (hashlib, sqlite3, json, dataclasses).

5. WHAT IS VERIFIED?

  • 7 / 7 Automated Unit Tests Passed: Reference mathematical Brier scoring, pre-event commitments, mutation detection, deletion detection, row swapping, SQLite database reopen, and 1,000-record scale test.
  • Microsecond Execution: Traversal and verification of 1,000 chained entries completes in < 15 ms.

6. HOW DO I RUN IT?

# 1. Run the unit test suite
python3 -B tests/test_ledger.py

# 2. Run the interactive verification demonstration
python3 -B examples/verify_predictions.py

21 files

file contents open where the seller allows a preview; the rest is what you are buying