ts_benchmark.baselines.time_series_library package
The following module is the adapter required for embedding the models in time series library into TFB.
ts_benchmark.baselines.time_series_library.adapters_for_transformers module
Functions
|
Generate model factory information for creating Transformer Adapters model adapters. |
|
Classes
|
|
|
- class TransformerAdapter(model_name, model_class, **kwargs)[source]
Bases:
ModelBase- batch_forecast(horizon: int, batch_maker: BatchMaker, **kwargs) numpy.ndarray[source]
Make predictions by batch.
- Parameters:
horizon – The length of each prediction.
batch_maker – Make batch data used for prediction.
- Returns:
An array of predicted results.
- forecast(horizon: int, train: pandas.DataFrame) numpy.ndarray[source]
Make predictions.
- Parameters:
horizon – The predicted length.
testdata – Time series data used for prediction.
- Returns:
An array of predicted results.
- forecast_fit(train_valid_data: pandas.DataFrame, train_ratio_in_tv: float) ModelBase[source]
Train the model.
- Parameters:
train_data – Time series data used for training.
train_ratio_in_tv – Represents the splitting ratio of the training set validation set. If it is equal to 1, it means that the validation set is not partitioned.
- Returns:
The fitted model object.
- property model_name
Returns the name of the model.
- generate_model_factory(model_name: str, model_class: type, required_args: dict) Dict[source]
Generate model factory information for creating Transformer Adapters model adapters.
- Parameters:
model_name – Model name.
model_class – Model class.
required_args – The required parameters for model initialization.
- Returns:
A dictionary containing model factories and required parameters.