Dolixe commited on
Commit
0b6f8af
·
verified ·
1 Parent(s): 0cd2523

upload latest app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -0
app.py CHANGED
@@ -39,8 +39,11 @@ async def predict(data: MarketData):
39
 
40
  # prediction[0] is the result for the first (and only) batch
41
  # We take the median (50th percentile) as our forecast
 
42
  # Shape is (samples, horizon)
43
  forecast = prediction[0].median(dim=0).values.tolist()
 
 
44
 
45
  # Calculate Confidence Score (Monte Carlo Agreement)
46
  # 1. Determine if the median predicts market going UP or DOWN
@@ -62,6 +65,8 @@ async def predict(data: MarketData):
62
 
63
  return {
64
  "forecast": forecast,
 
 
65
  "confidence": confidence_score,
66
  "horizon": data.horizon,
67
  "input_size": len(data.prices)
 
39
 
40
  # prediction[0] is the result for the first (and only) batch
41
  # We take the median (50th percentile) as our forecast
42
+ # We also take 10th and 90th percentiles for confidence bands
43
  # Shape is (samples, horizon)
44
  forecast = prediction[0].median(dim=0).values.tolist()
45
+ low_forecast = prediction[0].quantile(0.1, dim=0).tolist()
46
+ high_forecast = prediction[0].quantile(0.9, dim=0).tolist()
47
 
48
  # Calculate Confidence Score (Monte Carlo Agreement)
49
  # 1. Determine if the median predicts market going UP or DOWN
 
65
 
66
  return {
67
  "forecast": forecast,
68
+ "low": low_forecast,
69
+ "high": high_forecast,
70
  "confidence": confidence_score,
71
  "horizon": data.horizon,
72
  "input_size": len(data.prices)