feat: add autonomous paper-trading and calibration pipeline
This commit is contained in:
@@ -214,6 +214,32 @@ def main():
|
||||
print(f" 20-day: {a20:.1f}% (n={n20})")
|
||||
print()
|
||||
|
||||
|
||||
# baselines — what would naive strategies have scored on the same set?
|
||||
# this is the most important context for interpreting the model accuracy above
|
||||
eval_df = df[df["correct_10d"].notna()].copy()
|
||||
if len(eval_df) > 0:
|
||||
# 1. always-positive baseline — predict every event as bullish
|
||||
eval_df["always_pos_correct"] = eval_df["10d_return"].apply(lambda r: r > 0 if r is not None else None)
|
||||
always_pos = eval_df["always_pos_correct"].mean() * 100
|
||||
|
||||
# 2. random baseline — flip a coin for each prediction (analytic expectation = 50%)
|
||||
# we report the empirical positive rate of the underlying market over the test window
|
||||
# since random would converge to that for a balanced dataset
|
||||
market_up_rate = (eval_df["10d_return"] > 0).mean() * 100
|
||||
|
||||
# 3. always-negative baseline
|
||||
always_neg = ((eval_df["10d_return"] < 0).sum() / len(eval_df)) * 100
|
||||
|
||||
print("BASELINES (10-day, same evaluation set)")
|
||||
print(f" Always-positive: {always_pos:.1f}% (this is the bar to beat in a bull market)")
|
||||
print(f" Always-negative: {always_neg:.1f}%")
|
||||
print(f" Random (coin): 50.0% (analytic)")
|
||||
print(f" Market up rate: {market_up_rate:.1f}% (% of events where stock rose 10d later)")
|
||||
edge = a10 - always_pos
|
||||
print(f" MODEL EDGE vs always-positive: {edge:+.1f} percentage points")
|
||||
print()
|
||||
|
||||
# by magnitude
|
||||
print("BY MAGNITUDE (10-day accuracy)")
|
||||
for mag in sorted(df["magnitude"].dropna().unique()):
|
||||
|
||||
Reference in New Issue
Block a user