mirror of
https://github.com/SHOGGOTH-SECTOR/sica-fondt.git
synced 2026-11-29 00:15:11 +00:00
M3b: scale prediction bounds by horizon
This commit is contained in:
@@ -325,6 +325,19 @@ bounded_ten(Value0, Width0, Value, Lower, Upper) :-
|
||||
clamp_value(L0, 0.0, 10.0, Lower),
|
||||
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(promotion, 0.50).
|
||||
phase_code(distribution, 0.75).
|
||||
@@ -337,100 +350,109 @@ regime_code(bullish, 1.0).
|
||||
sociological_prediction(
|
||||
sentiment_index,
|
||||
state(Sentiment,Dispersion,_,_,_,_,_,_,_),
|
||||
_,
|
||||
Horizon,
|
||||
Value,Lower,Upper,Label
|
||||
) :- !,
|
||||
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),
|
||||
sentiment_label(Sentiment, Label).
|
||||
|
||||
sociological_prediction(
|
||||
herd_threshold,
|
||||
state(_,Dispersion,_,Volatility,_,_,_,_,_),
|
||||
_,
|
||||
Horizon,
|
||||
Value,Lower,Upper,herd_activation
|
||||
) :- !,
|
||||
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).
|
||||
|
||||
sociological_prediction(
|
||||
strategy_distribution,
|
||||
state(_,Dispersion,_,_,_,Shares,_,_,_),
|
||||
_,
|
||||
Horizon,
|
||||
Value,Lower,Upper,Label
|
||||
) :- !,
|
||||
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).
|
||||
|
||||
sociological_prediction(
|
||||
cascade_probability,
|
||||
state(_,Dispersion,_,Volatility,ExposureRate,_,_,_,_),
|
||||
_,
|
||||
Horizon,
|
||||
Value,Lower,Upper,complex_contagion
|
||||
) :- !,
|
||||
adaptive_confidence_bound(0.35, Volatility, Dispersion, Threshold),
|
||||
E2 is ExposureRate*ExposureRate,
|
||||
T2 is Threshold*Threshold,
|
||||
( 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).
|
||||
|
||||
sociological_prediction(
|
||||
coordination_stability,
|
||||
state(_,Dispersion,_,Volatility,_,_,_,MfgStability,_),
|
||||
_,
|
||||
Horizon,
|
||||
Value,Lower,Upper,coordination
|
||||
) :- !,
|
||||
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).
|
||||
|
||||
sociological_prediction(
|
||||
opinion_cluster_count,
|
||||
state(_,Dispersion,_,Volatility,_,_,_,_,Opinions),
|
||||
_,
|
||||
Horizon,
|
||||
Value,Lower,Upper,clusters
|
||||
) :- !,
|
||||
adaptive_confidence_bound(0.35, Volatility, Dispersion, Bound),
|
||||
opinion_cluster_count(Opinions, Bound, Count),
|
||||
length(Opinions, N),
|
||||
Value is float(Count),
|
||||
L0 is max(1, Count-1),
|
||||
U0 is min(N, Count+1),
|
||||
Lower is float(L0),
|
||||
Upper is float(U0).
|
||||
horizon_scale(Horizon, Scale),
|
||||
L0 is max(1.0, Value-Scale),
|
||||
U0 is min(float(N), Value+Scale),
|
||||
Lower = L0,
|
||||
Upper = U0.
|
||||
|
||||
sociological_prediction(
|
||||
pump_dump_phase,
|
||||
state(Sentiment,Dispersion,PriceShift,_,ExposureRate,_,_,_,_),
|
||||
_,
|
||||
Horizon,
|
||||
Value,Lower,Upper,Phase
|
||||
) :- !,
|
||||
VolumeRatio is 1.0 + 2.0*ExposureRate,
|
||||
pump_phase(PriceShift, VolumeRatio, Sentiment, Phase),
|
||||
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).
|
||||
|
||||
sociological_prediction(
|
||||
mfg_equilibrium_stability,
|
||||
state(_,Dispersion,_,_,_,_,_,MfgStability,_),
|
||||
_,
|
||||
Horizon,
|
||||
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).
|
||||
|
||||
sociological_prediction(
|
||||
narrative_regime,
|
||||
state(Sentiment,Dispersion,PriceShift,_,_,_,_,_,_),
|
||||
_,
|
||||
Horizon,
|
||||
Value,Lower,Upper,Label
|
||||
) :- !,
|
||||
narrative_label(Sentiment, PriceShift, Label),
|
||||
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).
|
||||
|
||||
Reference in New Issue
Block a user