ML predictions Phase 4: SARIMA spending forecast with dual confidence bands
Replaces unused Prophet dependency (unrunnable without cmdstan) with SARIMA (statsmodels SARIMAX) as the primary spending forecast algorithm. Strategy: SARIMA(1,1,1)(1,0,1,12) for 12+ months of data, ARIMA(1,1,1) for 6-11 months, Holt-Winters for 3-5 months, simple average below that. Adds 95% confidence bands (1.96σ) alongside existing 80% (1.28σ). Extends forecast horizon from 3 to 6 months and actuals display from 6 to 12 months. Each category now carries an algorithm field surfaced as a badge in the UI. Frontend chart shows both confidence tiers as stacked bar overlays with a 3-month summary grid below. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
3b4787d8b9
commit
4572621f5d
4 changed files with 109 additions and 30 deletions
|
|
@ -4,8 +4,9 @@ export interface CategoryForecast {
|
|||
category_id: string;
|
||||
category_name: string;
|
||||
monthly_avg: number;
|
||||
algorithm: "sarima" | "holt_winters" | "average";
|
||||
actuals: { date: string; amount: number }[];
|
||||
forecast: { date: string; amount: number; lower: number; upper: number }[];
|
||||
forecast: { date: string; amount: number; lower: number; upper: number; lower_95: number; upper_95: number }[];
|
||||
}
|
||||
|
||||
export interface SpendingForecastResponse {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue