LostTech.TensorFlow : API Documentation

Type StructuralEnsembleRegressor

Namespace tensorflow.contrib.timeseries

Parent StateSpaceRegressor

Interfaces IStructuralEnsembleRegressor

An Estimator for structural time series models.

"Structural" refers to the fact that this model explicitly accounts for structure in the data, such as periodicity and trends.

`StructuralEnsembleRegressor` is a state space model. It contains components for modeling level, local linear trends, periodicity, and mean-reverting transients via a moving average component. Multivariate series are fit with full covariance matrices for observation and latent state transition noise, each feature of the multivariate series having its own latent components.

Note that unlike `ARRegressor`, `StructuralEnsembleRegressor` is sequential, and so accepts variable window sizes with the same model.

For training, `RandomWindowInputFn` is recommended as an `input_fn`. Model state is managed through `ChainingStateManager`: since state space models are inherently sequential, we save state from previous iterations to get approximate/eventual consistency while achieving good performance through batched computation.

For evaluation, either pass a significant chunk of the series in a single window (e.g. set `window_size` to the whole series with `WholeDatasetInputFn`), or use enough random evaluation iterations to cover several passes through the whole dataset. Either method will ensure that stale saved state has been flushed.

Methods

Properties

Public static methods

StructuralEnsembleRegressor NewDyn(object periodicities, object num_features, ImplicitContainer<T> cycle_num_latent_values, ImplicitContainer<T> moving_average_order, ImplicitContainer<T> autoregressive_order, object exogenous_feature_columns, object exogenous_update_condition, ImplicitContainer<T> dtype, object anomaly_prior_probability, object optimizer, object model_dir, object config, ImplicitContainer<T> head_type)

Initialize the Estimator.
Parameters
object periodicities
The expected periodicity of the data (for example 24 if feeding hourly data with a daily periodicity, or 60 * 24 if feeding minute-level data with daily periodicity). Either a scalar or a list. This parameter can be any real value, and does not control the size of the model. However, increasing this without increasing `num_values_per_cycle` will lead to smoother periodic behavior, as the same number of distinct values will be cycled through over a longer period of time.
object num_features
The dimensionality of the time series (one for univariate, more than one for multivariate).
ImplicitContainer<T> cycle_num_latent_values
Along with `moving_average_order` and `num_features`, controls the latent state size of the model. Square matrices of size `num_features * (moving_average_order + cycle_num_latent_values + 3)` are created and multiplied, so larger values may be slow. The trade-off is with resolution: cycling between a smaller number of latent values means that only smoother functions can be modeled.
ImplicitContainer<T> moving_average_order
Controls model size (along with `cycle_num_latent_values` and `autoregressive_order`) and the number of steps before transient deviations revert to the mean defined by the period and level/trend components.
ImplicitContainer<T> autoregressive_order
Each contribution from this component is a linear combination of this many previous contributions. Also helps to determine the model size. Learning autoregressive coefficients typically requires more steps and a smaller step size than other components.
object exogenous_feature_columns
A list of tf.feature_columns (for example tf.feature_column.embedding_column) corresponding to exogenous features which provide extra information to the model but are not part of the series to be predicted. Passed to `tf.compat.v1.feature_column.input_layer`.
object exogenous_update_condition
A function taking two Tensor arguments, `times` (shape [batch size]) and `features` (a dictionary mapping exogenous feature keys to Tensors with shapes [batch size,...]), and returning a boolean Tensor with shape [batch size] indicating whether state should be updated using exogenous features for each part of the batch. Where it is False, no exogenous update is performed. If None (default), exogenous updates are always performed. Useful for avoiding "leaky" frequent exogenous updates when sparse updates are desired. Called only during graph construction. See the "known anomaly" example for example usage.
ImplicitContainer<T> dtype
The floating point data type to compute with. float32 may be faster, but can be problematic for larger models and longer time series.
object anomaly_prior_probability
If not None, the model attempts to automatically detect and ignore anomalies during training. This parameter then controls the prior probability of an anomaly. Values closer to 0 mean that points will be discarded less frequently. The default value (None) means that anomalies are not discarded, which may be slightly faster.
object optimizer
The optimization algorithm to use when training, inheriting from tf.train.Optimizer. Defaults to Adam with step size 0.02.
object model_dir
See `Estimator`.
object config
See `Estimator`.
ImplicitContainer<T> head_type
The kind of head to use for the model (inheriting from `TimeSeriesRegressionHead`).

Public properties

object config get;

object config_dyn get;

object model_dir get;

object model_dir_dyn get;

object model_fn get;

object model_fn_dyn get;

object params get;

object params_dyn get;

object PythonObject get;