Public API¶
This page documents the main top-level imports exposed by foreblocks.
Recommended import surface¶
from foreblocks import (
ForecastingModel,
Trainer,
ModelEvaluator,
TimeSeriesHandler,
TimeSeriesDataset,
create_dataloaders,
ModelConfig,
TrainingConfig,
LSTMEncoder,
LSTMDecoder,
GRUEncoder,
GRUDecoder,
TransformerEncoder,
TransformerDecoder,
AttentionLayer,
)
Core classes¶
ForecastingModel¶
The core forecasting wrapper. It supports:
directautoregressiveseq2seqtransformer_seq2seq
Typical constructor roles:
encoderanddecoderfor recurrent or transformer workflowsheadfor direct forecasting- preprocessing and normalization injection points
- optional attention module
Trainer¶
The main training orchestrator. It handles:
- training and validation loops
- early stopping
- scheduler stepping
- gradient accumulation
- optional MLTracker integration
- optional NAS-aware training
- optional conformal support
ModelEvaluator¶
Post-training utility for:
- batch prediction
- metrics computation
- rolling cross-validation
- training-curve visualization
TimeSeriesHandler¶
Preprocessing and windowing pipeline for raw multivariate series.
Use it when your raw data starts as [T, D] and you want the library to build training windows.
Model blocks¶
Recurrent blocks¶
LSTMEncoderLSTMDecoderGRUEncoderGRUDecoder
Transformer blocks¶
TransformerEncoderTransformerDecoderAttentionLayer
Utility exports¶
create_dataloaders¶
Builds train and validation PyTorch dataloaders from NumPy arrays.
TimeSeriesDataset¶
Dataset wrapper used by the dataloader helper.
ModelConfig and TrainingConfig¶
Dataclasses for model-level and training-level configuration.
TrainingConfig is the canonical trainer configuration surface and now covers:
- core optimization settings
- MLTracker experiment naming
- NAS settings
- conformal prediction settings
Guidance¶
- Prefer top-level imports unless you are modifying internals.
- Treat deep imports as implementation details unless a subsystem guide explicitly recommends them.
foretoolsdoes not currently expose an equally stable top-level import surface. For those utilities, prefer the documented deep imports in the dedicatedForetoolspages.- If you are unsure which config fields matter for your run, start with Configuration and then move to Troubleshooting if the first training loop fails.