timesfm-ts - v1.0.0
    Preparing search index...

    Module hierarchical

    Hierarchical forecast reconciliation entry point.

    Forecasts every node independently with TimesFM, then reconciles the stacked base forecasts across the hierarchy using the selected strategy (MinT by default).

    Usage:

    import { TimesFMModel, createForecastConfig } from '@agentix-e/timesfm-core';
    import { reconcileForecast } from '@agentix-e/timesfm-hierarchical';

    const model = await TimesFMModel.fromPretrained({ modelPath });
    model.compile(createForecastConfig({ maxContext: 512, maxHorizon: 128 }));

    const result = await reconcileForecast(model, {
    hierarchy: {
    nodes: [
    { id: 'total', parentId: null },
    { id: 'west', parentId: 'total' },
    { id: 'east', parentId: 'total' },
    { id: 's1', parentId: 'west' },
    { id: 's2', parentId: 'west' },
    { id: 's3', parentId: 'east' },
    { id: 's4', parentId: 'east' },
    ],
    },
    inputs: {
    total: totalSeries,
    west: westSeries,
    east: eastSeries,
    s1: store1Series,
    s2: store2Series,
    s3: store3Series,
    s4: store4Series,
    },
    horizon: 24,
    reconcile: { strategy: 'mint' },
    });

    // result.reconciled.total.pointForecast — coherent aggregate
    // result.reconciled.s1.pointForecast — reconciled bottom-level

    Functions

    reconcileForecast