feat: signal math upgrade — probabilistic, regime-aware scoring pipeline
Implement full probabilistic signal processing pipeline gated behind probabilistic_scoring_enabled feature flag in risk_configs: - Bayesian log-likelihood accumulator with Beta posterior and entropy - Regime detector (trend-following, panic, mean-reversion, uncertainty) - Source accuracy tracker with per-source historical prediction accuracy - Sigmoid confidence gate replacing binary gate - Information gain surprise weighting for rare events - Adaptive recency decay with event-specific half-lives - Regime multiplier replacing market context multiplier - Weighted disagreement entropy for contradiction detection - Multiplicative macro exposure with conditional integration - Graph-distance attenuated competitive signal propagation - Exponentially weighted momentum with volatility scaling - Expected value recommendation gate All changes backward-compatible: flag=false preserves exact current behavior. New outputs stored in existing JSONB columns (no schema changes except source_accuracy table via migration 034). Tests: 26 property-based tests (14 correctness properties), 99 unit tests, 1789 total tests passing with zero regressions.
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
-- Source accuracy tracking table for historical prediction accuracy per source.
|
||||
--
|
||||
-- Stores per-source accuracy metrics (fraction of correct directional calls)
|
||||
-- used by the probabilistic scoring pipeline to weight source credibility.
|
||||
-- See Requirement 4.5: source accuracy metrics stored with source identifier,
|
||||
-- accuracy ratio, sample count, and last updated timestamp.
|
||||
|
||||
CREATE TABLE IF NOT EXISTS source_accuracy (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
source_id VARCHAR(200) NOT NULL,
|
||||
accuracy_ratio FLOAT NOT NULL DEFAULT 0.5,
|
||||
sample_count INTEGER NOT NULL DEFAULT 0,
|
||||
last_updated TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
UNIQUE(source_id)
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_source_accuracy_source ON source_accuracy(source_id);
|
||||
Reference in New Issue
Block a user