Custom Extensions#

Back to reference

macroforecast supports custom work by accepting ordinary Python callables at the stage that owns the behavior. There is no separate custom registry and no YAML wrapper requirement. A custom function must return the same object shape that the next stage already expects.

Use this section when a built-in loader, cleaning step, feature transform, model, search rule, diagnostic, or artifact is not enough.

Pages#

Page

Use it for

Custom Flow

End-to-end custom workflow and stage-local design rule.

custom_dataset

In-memory panels, custom CSV/Parquet loaders, frequency and metadata contracts.

custom_preprocess

Direct preprocessing callables and runner-safe custom preprocessing steps.

custom_features

Direct custom feature transforms and fitted feature-spec steps.

custom_model

User estimators, fit return objects, model specs, model ensembles, and search spaces.

custom_window_selection_forecasting

Custom sample policies, hyperparameter search algorithms, and forecast combinations.

custom_evaluation_tests

Custom scalar metrics, custom forecast-comparison tests, and custom evaluation slices.

custom_interpretation_analysis

Custom model interpretation, feature diagnostics, and forecast diagnostics.

custom_output

Saving custom tables, dictionaries, notes, diagnostics, and manifests.

Flow Contract#

Stage

Custom entry point

Must return

Data

mf.data.custom_dataset, mf.data.load_custom_csv, mf.data.load_custom_parquet

DataBundle with canonical panel and metadata.

Preprocessing

mf.preprocessing.custom_preprocess, mf.preprocessing.custom_preprocess_step

PreprocessedData or a preprocessing step dictionary.

Feature engineering

mf.feature_engineering.custom_features, mf.feature_engineering.custom_step

Feature DataFrame or feature step dictionary.

Models

mf.models.custom_model, mf.model_ensemble.custom_model_ensemble

ModelSpec.

Windows and selection

mf.window.custom_stage_policy, mf.model_selection.custom_search

StagePolicy or SearchSpec.

Forecasting

mf.forecasting.custom_combination

CombinationSpec.

Evaluation and tests

callable metric, mf.tests.custom_test, custom aggregation mapping

Metric columns, TestResult, or EvaluationReport tables.

Interpretation and analysis

mf.interpretation.custom_interpretation, mf.feature_analysis.custom_feature_diagnostic, mf.forecast_analysis.custom_forecast_diagnostic

Schema-tagged DataFrame.

Output

mf.output.write_artifacts({...})

Files plus ArtifactManifest.