kats.models.metalearner.get_metadata module¶
A module for computing the meta-data of time series.
This module contains the class for computing the meta-data of time series. The meta-data of a time series is consists of three parts: 1) time series features; 2) the best hyper-parameters of each candidate models and their corresponding errors; and 3) the best model.
- class kats.models.metalearner.get_metadata.GetMetaData(data: kats.consts.TimeSeriesData, all_models: Dict[str, Any] = {'arima': <class 'kats.models.arima.ARIMAModel'>, 'holtwinters': <class 'kats.models.holtwinters.HoltWintersModel'>, 'prophet': <class 'kats.models.prophet.ProphetModel'>, 'sarima': <class 'kats.models.sarima.SARIMAModel'>, 'stlf': <class 'kats.models.stlf.STLFModel'>, 'theta': <class 'kats.models.theta.ThetaModel'>}, all_params: Dict[str, Any] = {'arima': <class 'kats.models.arima.ARIMAParams'>, 'holtwinters': <class 'kats.models.holtwinters.HoltWintersParams'>, 'prophet': <class 'kats.models.prophet.ProphetParams'>, 'sarima': <class 'kats.models.sarima.SARIMAParams'>, 'stlf': <class 'kats.models.stlf.STLFParams'>, 'theta': <class 'kats.models.theta.ThetaParams'>}, min_length: int = 30, scale: bool = True, method: kats.consts.SearchMethodEnum = <SearchMethodEnum.RANDOM_SEARCH_UNIFORM: 2>, executor: Optional[Any] = None, error_method: str = 'mae', num_trials: int = 5, num_arms: int = 4, **kwargs)[source]¶
Bases:
object
A class for generate meta-data of time series.
- The meta-data of time series contains three components:
Time series feature vector, such as entropy, seasonal features, ACF/PACF based features.
Best hyper-parameters for each candidate models and their corresponding errors for a time series data.
Best model for a time series data.
This class provides tune_executor and get_meta_dat.
- data¶
kats.consts.TimeSeriesData
object representing the input time series data.
- all_models¶
Optional; A dictionary of candidate model classes. Default dictionary includes models of ARIMA, SARIMA, HoltWinters, Prophet, Theta, and STLF.
- all_params¶
Optional; A dictionary of the corresponding candidate model parameter classes. Default includes model parameter classes of ARIMA, SARIMA, HoltWinters, Prophet, Theta, and STLF.
- min_length¶
Optional; An integer for the minimal length of a time series. Time series data whose length is shorter than min_length will be excluded. Default is 30.
- scale¶
Optional; A boolean to specify whether or not to rescale the time series data by its maximum values. Default is True. Default is True.
- method¶
Optional; A SearchMethodEnum object defining the search method for hyper-parameters tuning. Default is random search in the default parameter space.
- executor¶
Optional; A callable parallel executor for tuning individual candidate models in parallel. Default is the native implementation with Python’s multiprocessing.
- error_method¶
Optional; A string for error metric used for model evaluation. Can be ‘mape’, ‘smape’, ‘mae’, ‘mase’, ‘mse’, or ‘rmse’. Default is ‘mae’.
- num_trials¶
Optional; An integer for the number of trials in hyper-parameter search. Default is 5.
- num_arms¶
Optional; An integer for the number of arms in hyper-parameter search. Default is 4.
- Sample Usage:
>>> TSdata = TimeSeriesData(data) >>> MD = GetMetaData(data=TSdata) >>> hpt_res = MD.tune_executor() >>> my_meta_data = MD.get_meta_data() # Get meta-data, hyper-parameter searching method and error metric.
- get_meta_data() → Dict[str, Any][source]¶
Get meta data, as well as search method and type of error metric
Meta data includes time series features, best hyper-params for each candidate models, and best model.
- Returns
A dictionary storing the best hyper-parameters and the errors for each candidate model, the features of the time series data, the hyper-parameter searching method, the error metric used for model evaluation and the corresponding best model.