M3b: scale prediction bounds by horizon

This commit is contained in:
2026-10-19 19:56:35 -07:00
parent 7008f4484c
commit 6bcd98194a
+43 -21
View File
@@ -325,6 +325,19 @@ bounded_ten(Value0, Width0, Value, Lower, Upper) :-
clamp_value(L0, 0.0, 10.0, Lower), clamp_value(L0, 0.0, 10.0, Lower),
clamp_value(U0, 0.0, 10.0, Upper). clamp_value(U0, 0.0, 10.0, Upper).
horizon_scale(current, 0.50).
horizon_scale(hourly, 0.65).
horizon_scale(tick_hourly, 0.65).
horizon_scale(daily, 0.80).
horizon_scale(weekly, 1.00).
horizon_scale(monthly, 1.20).
horizon_scale(annual, 1.50).
horizon_scale(five_year, 1.80).
horizon_width(Horizon, BaseWidth, Width) :-
horizon_scale(Horizon, Scale),
Width is BaseWidth * Scale.
phase_code(accumulation, 0.25). phase_code(accumulation, 0.25).
phase_code(promotion, 0.50). phase_code(promotion, 0.50).
phase_code(distribution, 0.75). phase_code(distribution, 0.75).
@@ -337,100 +350,109 @@ regime_code(bullish, 1.0).
sociological_prediction( sociological_prediction(
sentiment_index, sentiment_index,
state(Sentiment,Dispersion,_,_,_,_,_,_,_), state(Sentiment,Dispersion,_,_,_,_,_,_,_),
_, Horizon,
Value,Lower,Upper,Label Value,Lower,Upper,Label
) :- !, ) :- !,
Raw is (Sentiment + 1.0) * 5.0, Raw is (Sentiment + 1.0) * 5.0,
Width is 0.5 + 4.0*Dispersion, BaseWidth is 0.5 + 4.0*Dispersion,
horizon_width(Horizon, BaseWidth, Width),
bounded_ten(Raw, Width, Value, Lower, Upper), bounded_ten(Raw, Width, Value, Lower, Upper),
sentiment_label(Sentiment, Label). sentiment_label(Sentiment, Label).
sociological_prediction( sociological_prediction(
herd_threshold, herd_threshold,
state(_,Dispersion,_,Volatility,_,_,_,_,_), state(_,Dispersion,_,Volatility,_,_,_,_,_),
_, Horizon,
Value,Lower,Upper,herd_activation Value,Lower,Upper,herd_activation
) :- !, ) :- !,
adaptive_confidence_bound(0.35, Volatility, Dispersion, Value), adaptive_confidence_bound(0.35, Volatility, Dispersion, Value),
Width is 0.10 + 0.20*Dispersion, BaseWidth is 0.10 + 0.20*Dispersion,
horizon_width(Horizon, BaseWidth, Width),
bounded_unit(Value, Width, Value, Lower, Upper). bounded_unit(Value, Width, Value, Lower, Upper).
sociological_prediction( sociological_prediction(
strategy_distribution, strategy_distribution,
state(_,Dispersion,_,_,_,Shares,_,_,_), state(_,Dispersion,_,_,_,Shares,_,_,_),
_, Horizon,
Value,Lower,Upper,Label Value,Lower,Upper,Label
) :- !, ) :- !,
dominant_strategy(Shares, Label, Dominant), dominant_strategy(Shares, Label, Dominant),
Width is 0.05 + 0.20*Dispersion, BaseWidth is 0.05 + 0.20*Dispersion,
horizon_width(Horizon, BaseWidth, Width),
bounded_unit(Dominant, Width, Value, Lower, Upper). bounded_unit(Dominant, Width, Value, Lower, Upper).
sociological_prediction( sociological_prediction(
cascade_probability, cascade_probability,
state(_,Dispersion,_,Volatility,ExposureRate,_,_,_,_), state(_,Dispersion,_,Volatility,ExposureRate,_,_,_,_),
_, Horizon,
Value,Lower,Upper,complex_contagion Value,Lower,Upper,complex_contagion
) :- !, ) :- !,
adaptive_confidence_bound(0.35, Volatility, Dispersion, Threshold), adaptive_confidence_bound(0.35, Volatility, Dispersion, Threshold),
E2 is ExposureRate*ExposureRate, E2 is ExposureRate*ExposureRate,
T2 is Threshold*Threshold, T2 is Threshold*Threshold,
( E2 + T2 =< 0.0 -> Raw = 0.0 ; Raw is E2/(E2+T2) ), ( E2 + T2 =< 0.0 -> Raw = 0.0 ; Raw is E2/(E2+T2) ),
Width is 0.05 + 0.25*Dispersion, BaseWidth is 0.05 + 0.25*Dispersion,
horizon_width(Horizon, BaseWidth, Width),
bounded_unit(Raw, Width, Value, Lower, Upper). bounded_unit(Raw, Width, Value, Lower, Upper).
sociological_prediction( sociological_prediction(
coordination_stability, coordination_stability,
state(_,Dispersion,_,Volatility,_,_,_,MfgStability,_), state(_,Dispersion,_,Volatility,_,_,_,MfgStability,_),
_, Horizon,
Value,Lower,Upper,coordination Value,Lower,Upper,coordination
) :- !, ) :- !,
Raw is MfgStability * (1.0-Dispersion) * (1.0-0.25*Volatility), Raw is MfgStability * (1.0-Dispersion) * (1.0-0.25*Volatility),
Width is 0.05 + 0.20*Dispersion, BaseWidth is 0.05 + 0.20*Dispersion,
horizon_width(Horizon, BaseWidth, Width),
bounded_unit(Raw, Width, Value, Lower, Upper). bounded_unit(Raw, Width, Value, Lower, Upper).
sociological_prediction( sociological_prediction(
opinion_cluster_count, opinion_cluster_count,
state(_,Dispersion,_,Volatility,_,_,_,_,Opinions), state(_,Dispersion,_,Volatility,_,_,_,_,Opinions),
_, Horizon,
Value,Lower,Upper,clusters Value,Lower,Upper,clusters
) :- !, ) :- !,
adaptive_confidence_bound(0.35, Volatility, Dispersion, Bound), adaptive_confidence_bound(0.35, Volatility, Dispersion, Bound),
opinion_cluster_count(Opinions, Bound, Count), opinion_cluster_count(Opinions, Bound, Count),
length(Opinions, N), length(Opinions, N),
Value is float(Count), Value is float(Count),
L0 is max(1, Count-1), horizon_scale(Horizon, Scale),
U0 is min(N, Count+1), L0 is max(1.0, Value-Scale),
Lower is float(L0), U0 is min(float(N), Value+Scale),
Upper is float(U0). Lower = L0,
Upper = U0.
sociological_prediction( sociological_prediction(
pump_dump_phase, pump_dump_phase,
state(Sentiment,Dispersion,PriceShift,_,ExposureRate,_,_,_,_), state(Sentiment,Dispersion,PriceShift,_,ExposureRate,_,_,_,_),
_, Horizon,
Value,Lower,Upper,Phase Value,Lower,Upper,Phase
) :- !, ) :- !,
VolumeRatio is 1.0 + 2.0*ExposureRate, VolumeRatio is 1.0 + 2.0*ExposureRate,
pump_phase(PriceShift, VolumeRatio, Sentiment, Phase), pump_phase(PriceShift, VolumeRatio, Sentiment, Phase),
phase_code(Phase, Raw), phase_code(Phase, Raw),
Width is 0.05 + 0.15*Dispersion, BaseWidth is 0.05 + 0.15*Dispersion,
horizon_width(Horizon, BaseWidth, Width),
bounded_unit(Raw, Width, Value, Lower, Upper). bounded_unit(Raw, Width, Value, Lower, Upper).
sociological_prediction( sociological_prediction(
mfg_equilibrium_stability, mfg_equilibrium_stability,
state(_,Dispersion,_,_,_,_,_,MfgStability,_), state(_,Dispersion,_,_,_,_,_,MfgStability,_),
_, Horizon,
Value,Lower,Upper,mfg Value,Lower,Upper,mfg
) :- !, ) :- !,
Width is 0.05 + 0.20*Dispersion, BaseWidth is 0.05 + 0.20*Dispersion,
horizon_width(Horizon, BaseWidth, Width),
bounded_unit(MfgStability, Width, Value, Lower, Upper). bounded_unit(MfgStability, Width, Value, Lower, Upper).
sociological_prediction( sociological_prediction(
narrative_regime, narrative_regime,
state(Sentiment,Dispersion,PriceShift,_,_,_,_,_,_), state(Sentiment,Dispersion,PriceShift,_,_,_,_,_,_),
_, Horizon,
Value,Lower,Upper,Label Value,Lower,Upper,Label
) :- !, ) :- !,
narrative_label(Sentiment, PriceShift, Label), narrative_label(Sentiment, PriceShift, Label),
regime_code(Label, Raw), regime_code(Label, Raw),
Width is 0.05 + 0.20*Dispersion, BaseWidth is 0.05 + 0.20*Dispersion,
horizon_width(Horizon, BaseWidth, Width),
bounded_unit(Raw, Width, Value, Lower, Upper). bounded_unit(Raw, Width, Value, Lower, Upper).