All Projects

Time-Series Forecasting App

Live Demo
Role
Full-Stack Architecture, ML & AI Engineering
Read
4 min read
Table of Contents
  1. Project Overview
  2. Problem Statement
  3. Solution Architecture
  4. Technical Deep Dives
    1. Concurrent Go ML Engine & Bootstrap Uncertainty Bounds
    2. Strict Chronological Splitting & Zero Data Leakage
    3. Real-Time WebSocket Telemetry & 3D Phase-Space Attractors
    4. Gemma 4 & Gemini 4 AI Co-Pilot, Live Feeds & Run Diffing
  5. Algorithm & Benchmarks
  6. Architecture Trade-Offs
  7. Project Results

Project Overview

A workbench-first time-series forecasting, temporal data mining, and Gemma 4 / Gemini 4 AI platform. Built to benchmark how classical and ensemble ML algorithms learn temporal patterns across four synthetic regimes (Periodic, Noisy, Trending, and Irregular), user-uploaded datasets (CSV/JSON/ARFF/PDF), and live Open-Meteo city telemetry, it pairs 3D phase-space attractor visualization and residual error plots with side-by-side run comparison and an Ask AI drawer.

Problem Statement

Real-world temporal signals frequently exhibit non-stationarity, stochastic noise, and abrupt structural shocks that violate naive autoregressive continuity assumptions. Decomposing an empirical signal into its constituent temporal drivers:

y(t) = T(t) + S(t) + I(t) + ε(t)

Standard machine learning pipelines often suffer from catastrophic data leakage when random shuffling corrupts chronological causality, or choke under the latency demands of real-time streaming feature extraction. Building a dependable forecasting workbench requires sub-50ms concurrent feature extraction, strict out-of-sample chronological evaluation, and multi-model uncertainty estimation combining classical algorithms with generative AI reasoning.

Solution Architecture

The platform employs a decoupled, multi-runtime architecture: Next.js 15 App Router renders the reactive client workbench and 3D phase-space canvas, a Node.js 22 server manages persistent WebSocket telemetry streaming and PostgreSQL storage with automatic zero-config fallback, and a concurrent Go engine executes high-throughput feature extraction and bootstrap confidence calculations.

Live architecture & logic flow
Service Data store External
WS / REST schema cache parallel compute regime prompts residuals & metrics Next.js 15 UI & 3D Canvas Node.js & WebSocket Gateway PostgreSQL & pg-mem Go ML & Mining Engine Gemma 4 & Gemini 4 AI Bootstrap CI & Evaluations
Click or focus any node to inspect architectural details.
Interactive 3D Phase-Space Attractor
Real-time 3D delay-coordinate embedding (x(t), y(t), z(t)). Drag to orbit the manifold or switch regimes to inspect trajectory stability.

Technical Deep Dives

Concurrent Go ML Engine & Bootstrap Uncertainty Bounds

  • Engineered a dedicated Go microservice (go-signal-engine) that transforms raw time series into normalized feature matrices using concurrent goroutines.
  • Extracts multi-step lag variables (lag_1 through lag_10), rolling statistics (mean, variance, min, max, EWMA α = 0.3), momentum, and temporal autocorrelation spectra.
  • Trains four distinct forecasters: Naive Baseline (ŷt = yt−1), L2 Ridge Linear Regression, Random Forest (25 bootstrapped decision trees with feature subsampling), and Gradient Boosting (35 additive stagewise trees).
  • Computes 200-iteration residual bootstrap distributions to establish non-parametric 95% confidence intervals, providing realistic uncertainty intervals without assuming Gaussian error normality.

Strict Chronological Splitting & Zero Data Leakage

  • Enforces rigorous temporal partitioning: the earliest 70% of observations form the Training set, the subsequent 15% serve as Validation, and the final 15% are held out as the unseen Out-of-Sample Test set.
  • Fit-transform isolation: StandardScaler parameters (μ, σ) are calculated strictly on the training partition and applied forward to validation and test partitions, preventing future lookahead leakage.
  • Evaluates models using Mean Absolute Error (MAE), Root Mean Squared Error (RMSE), and Mean Absolute Percentage Error (MAPE) against pure out-of-sample observations.

Real-Time WebSocket Telemetry & 3D Phase-Space Attractors

  • Maintains a persistent full-duplex WebSocket gateway (/ws/signals) streaming 1.2-second live signal ticks, step predictions, and anomaly alerts.
  • Implements delay coordinate embedding in three dimensions (t, yt−1, yt) using an interactive Canvas/WebGL viewer to reveal hidden limit cycles, chaotic strange attractors, and noise-induced orbital degradation.
  • Detects structural shocks and transient spikes using dynamic Z-score thresholds (|Z| > 2.35σ) and stationarity variance-ratio tests.

Gemma 4 & Gemini 4 AI Co-Pilot, Live Feeds & Run Diffing

  • Integrates Google DeepMind gemma-4-31b-it and gemini-4-argon via the official @google/genai SDK Interactions API (client.interactions.create), leveraging strict JSON schema formatting with explicit Live API vs. Fallback status indicators.
  • Powers an interactive Ask AI slide-over drawer alongside regime classification, model trade-off justifications, and 5-step-ahead forecasts with 95% confidence bounds.
  • Includes a zero-key Open-Meteo live telemetry connector (7 days of hourly temperature, solar irradiance, wind speed, and humidity), residual error subplots, side-by-side Run History & Diff comparison, and CSV/JSON export.
  • Dual-engine execution: Includes a deterministic TypeScript parity engine alongside the Go worker, enabling zero-config instant startup and CI test runs without requiring local Docker or Go installations.

Algorithm & Complexity Benchmarks

Rolling Feature Extraction

vs O(N·W) naive recompute
Time: O(N) Space: O(W)

Single-pass EWMA and rolling moments across 10 lag steps.

200-Iter Residual Bootstrap CI

vs O(B · N) single-thread
Time: O(B · N / P) Space: O(B)

Parallelized across P Go goroutines for sub-45ms non-parametric bounds.

Architecture Trade-Offs

Concurrent Feature & Bootstrap Engine

Chosen: Go Microservice + Goroutines Over: Pure Python / FastAPI Worker

Goroutines execute lag-matrix extraction and 200-iteration residual bootstrap resampling in <45ms with predictable low memory overhead, avoiding GIL bottlenecks.

Zero-Config Local Persistence

Chosen: PostgreSQL with pg-mem Fallback Over: Mandatory External Managed DB

Preserves full SQL relational schemas in production while booting instantly in-memory during CI or local evaluation without external credentials.

Project Results

Sub-50ms Latency

Go compute engine executes signal synthesis, feature extraction, 4 model fits, and 200 bootstrap iterations in under 45ms.

Zero Leakage Guarantee

Strict chronological partitioning ensures genuine out-of-sample validation across all evaluation metrics.

Resilient Dual Engine

Zero-configuration fallback to in-memory PostgreSQL (pg-mem) and TypeScript engine allows complete local development without external service dependencies.

Keyboard Shortcuts

Global Navigation

  • Open Command Palette Cmd / CtrlK
  • Toggle Bruce's AI Assistant Shell ~or`
  • Show keyboard shortcuts ?
  • Close active modal or dialog Esc

Case Studies & Diagrams

  • Jump to next article section J
  • Jump to previous article section K
  • Inspect focused architecture node Enter / Space

Interactive Shell

  • Autocomplete commands, routes, & slugs Tab
  • Cycle command history ↑↓