{
  "method": "AMD_BLOCK",
  "slug": "amd-block",
  "title": "AMD block: average smoothing scales",
  "summary": "Several fixed moving-average windows are evaluated on the prefix, then averaged with equal weights. The next step uses phase-wise means of the detrended prefix. The frames expose those buckets, their cumulative averages and the repeated seasonal output. The source architecture's adaptive weighting is represented here by a nonlearned, equal-weight average of fixed smoothers.",
  "steps": [
    {
      "title": "Compute several smooth trends",
      "text": "Several fixed moving-average windows are evaluated on the prefix, then averaged with equal weights."
    },
    {
      "title": "Average equal seasonal phases",
      "text": "Subtract the trend on the fitting prefix. Group samples by index modulo the specified period and average each phase bucket."
    },
    {
      "title": "Repeat the phase template",
      "text": "Tile the fitted phase means over the record. The suffix does not update the template in this prefix configuration."
    },
    {
      "title": "Inspect the derived residual",
      "text": "Compute input minus the implemented trend and seasonal estimate. This residual is part of a retrospective decomposition, not a forecast score."
    }
  ],
  "parameters": [
    {
      "name": "multiscale_windows",
      "effect": "Sets the windows whose trends are equally averaged; this standalone operator does not learn scale weights."
    },
    {
      "name": "primary_period",
      "effect": "Defines phase buckets in samples; the fitting prefix must contain enough cycles for an interpretable average."
    },
    {
      "name": "fit_scope / train_fraction",
      "effect": "Explicitly selects a two-thirds prefix in this example; it does not create a rolling forecasting evaluation."
    }
  ],
  "cautions": [
    "The source architecture's adaptive weighting is represented here by a nonlearned, equal-weight average of fixed smoothers.",
    "Prefix fitting is a fixed fitting convention. It does not certify rolling causality or an out-of-sample prediction experiment.",
    "A repeated phase template assumes that the fitted seasonal shape remains useful over the displayed suffix.",
    "The residual is derived by subtraction; exact reconstruction does not validate the scientific interpretation of either component."
  ],
  "references": [
    {
      "title": "Implemented DeTime operator",
      "url": "https://github.com/systems-mechanobiology/DeTime/blob/main/src/detime/methods/neural_blocks/neural_block_portfolio.py"
    },
    {
      "title": "Hu et al. (2024), Adaptive Multi-Scale Decomposition Framework for Time Series Forecasting",
      "url": "https://arxiv.org/abs/2406.03751"
    }
  ],
  "trace_kind": "computed_operator_trace",
  "trace_note": "Intermediate arrays are computed with the implemented operator helpers. The final trend, season and residual are checked against public decompose(). The animation explains this standalone experimental block; its source architecture is cited for provenance.",
  "input_note": "Deterministic synthetic teaching signal; not a benchmark.",
  "example_config": {
    "method": "AMD_BLOCK",
    "params": {
      "primary_period": 24,
      "fit_scope": "prefix",
      "train_fraction": 0.6666666666666666,
      "multiscale_windows": [
        13,
        25,
        49
      ]
    },
    "backend": "python"
  },
  "checks": {
    "public_method_executed": true,
    "method_output_max_abs_errors": {
      "trend": 0.0,
      "season": 0.0,
      "residual": 0.0
    },
    "reconstruction_max_abs_error": 4.440892098500626e-16,
    "validation_scope": "One deterministic teaching input; no benchmark claim.",
    "fit_end": 96
  },
  "source_files": [
    "src/detime/methods/neural_blocks/neural_block_portfolio.py"
  ],
  "frames": 32,
  "duration_ms": 12050,
  "poster_frame": 15,
  "width": 1280,
  "height": 820,
  "artifacts": {
    "gif": {
      "file": "amd-block.gif",
      "bytes": 354512,
      "sha256": "863fda873f8c64fcb72890b44d39195b2c1cb1ca5ac11eaa0320b33699ee2296"
    },
    "poster": {
      "file": "amd-block.png",
      "bytes": 130403,
      "sha256": "7023b168469580b3a8dd11aa67f7bda927b5ad2863d6787e97408e868dce8410"
    },
    "data": {
      "file": "amd-block.npz",
      "bytes": 9503,
      "sha256": "1f0e56a4e44b4342d36e4d8f744ba48ae66d36cb7db3af5d78e61d0900fe9cb0"
    }
  },
  "source_arrays": {
    "observed": [
      144
    ],
    "trend_candidates": [
      3,
      144
    ],
    "trend": [
      144
    ],
    "detrended": [
      144
    ],
    "prefix_phase_matrix": [
      4,
      24
    ],
    "raw_template": [
      144
    ],
    "season": [
      144
    ],
    "residual": [
      144
    ],
    "fit_end": []
  },
  "render_provenance": {
    "python_version": "3.12.14",
    "dependencies": {
      "numpy": "2.3.5",
      "scipy": "1.17.0",
      "statsmodels": "0.15.0",
      "matplotlib": "3.10.8",
      "Pillow": "12.3.0",
      "PyWavelets": "1.10.0",
      "EMD-signal": "1.10.0",
      "vmdpy": "0.2",
      "PySDKit": "0.5.0"
    },
    "source_hashes": {
      "scripts/generate_method_animations.py": "f62989af55a7e48495c24afcfee31751d3785e5f78bb4b900bef23a429deaa84",
      "scripts/method_animations/common.py": "73ad7e8b4e5b67f87d13e59adab2c93e983fe1aaf06ee627d22cb7c7e696016a",
      "scripts/method_animations/neural.py": "fc1c2a73490391f0f863ede52e38f12924cc1fec572b7188356a2308216716e6",
      "src/detime/backends.py": "7432dcf59e382580dfb32f1f57e61ff71a30567c049b35243e24e3644523eda6",
      "src/detime/core.py": "d95b348cd8b16b56d18840965579c947a11628d969dd6c32c4af7723f5a027f4",
      "src/detime/methods/neural_blocks/neural_block_portfolio.py": "2aab635b9927d1d42bbcd8e0b4f37cb9fcdcf85cbd0331b5011621b495c4acfa",
      "src/detime/registry.py": "e934ffca17880cefe5add728aa497e63ea811d7ae43abec1ea498de718094066"
    }
  }
}
