MODULE REFERENCE

local

anomx.execution.local

Inspectable local experiments with chronological evaluation and Matplotlib.

This module has no platform, job-worker, Darts, or database dependency. Models remain responsible for fitting and inference; the executor records the split, metrics, timings, and outputs of a local experiment.

LocalExecutor

LocalExecutor(*, verbose: bool = True)

Run and inspect local models with a deliberately small execution contract.

forecast fits a model on a chronological training prefix and predicts the untouched suffix. fit_predict supports reconstruction and representation models on explicitly supplied train/test arrays or tables. Transformers fit on training data only. No platform service is required.

Signature parameters
ParameterTypeDefault
verbosekeyword onlyboolTrue

Members

forecastmethod
forecast(model: Any, series: TimeSeries, *, horizon: int | None = None, train_fraction: float = 0.8, transformer: Any = None, metrics: Mapping[str, Callable[..., Any]] | None = None, name: str | None = None) -> LocalResult

Fit and evaluate a deterministic model on a chronological holdout.

model implements fit(TimeSeries) and predict(n). horizon selects the test suffix; otherwise train_fraction chooses the split. Optional transformers implement fit_transform/transform/inverse_transform; metrics and saved predictions use the original data scale.

Signature parameters
ParameterTypeDefault
modelAnyrequired
seriesTimeSeriesrequired
horizonkeyword onlyint | NoneNone
train_fractionkeyword onlyfloat0.8
transformerkeyword onlyAnyNone
metricskeyword onlyMapping[str, Callable[..., Any]] | NoneNone
namekeyword onlystr | NoneNone

Returns LocalResult

fit_predictmethod
fit_predict(model: Any, train: Any, test: Any, *, family: str = 'reconstruction', name: str | None = None, metrics: Mapping[str, Callable[..., Any]] | None = None) -> LocalResult

Fit an array/table model and inspect held-out reconstructions or representations.

GenericModel can adapt sklearn estimators, callables, and PyTorch modules. For representation models supply metrics explicitly if desired; embedding coordinates are not compared to observation values as reconstruction errors.

Signature parameters
ParameterTypeDefault
modelAnyrequired
trainAnyrequired
testAnyrequired
familykeyword onlystr'reconstruction'
namekeyword onlystr | NoneNone
metricskeyword onlyMapping[str, Callable[..., Any]] | NoneNone

Returns LocalResult

LocalResult

LocalResult(name: str, family: str, train: Any, test: Any, prediction: Any, metrics: dict[str, float] = <factory: dict>, timings: dict[str, float] = <factory: dict>, metadata: dict[str, Any] = <factory: dict>)

One experiment's observations, predictions, metrics, and provenance.

prediction is a forecast, reconstruction, embedding, or score depending on family. Representation outputs need not share observation features; the executor only calculates default error metrics for forecasting and reconstruction. plot() returns ordinary Matplotlib axes and save() writes portable CSV/JSON, never executable model pickle files.

Signature parameters
ParameterTypeDefault
namestrrequired
familystrrequired
trainAnyrequired
testAnyrequired
predictionAnyrequired
metricsdict[str, float]<factory: dict>
timingsdict[str, float]<factory: dict>
metadatadict[str, Any]<factory: dict>

Members

nameattribute
familyattribute
trainattribute
testattribute
predictionattribute
metricsattribute
metrics: dict[str, float] = field(default_factory=dict)
timingsattribute
timings: dict[str, float] = field(default_factory=dict)
metadataattribute
metadata: dict[str, Any] = field(default_factory=dict)
plotmethod
plot(*, ax: Any = None, history: int = 100, max_components: int = 4, **kwargs: Any) -> Any

Plot a forecast/reconstruction against observations, or learned outputs.

history limits the training context shown before the held-out data. Pass ax to compose with existing Matplotlib figures. For multivariate output each component is rendered separately with a distinct label.

Signature parameters
ParameterTypeDefault
axkeyword onlyAnyNone
historykeyword onlyint100
max_componentskeyword onlyint4
**kwargsAny—

Returns Any

savemethod
save(directory: str | Path, *, plot: bool = False) -> Path

Save a receipt and tables to a dedicated local directory.

Existing filenames in this directory are replaced deliberately. Model objects and training data are not serialized; receipts include test and prediction data plus the split metadata needed to inspect the run.

Signature parameters
ParameterTypeDefault
directorystr | Pathrequired
plotkeyword onlyboolFalse

Returns Path