LostTech.TensorFlow : API Documentation

Type ARModel

Namespace tensorflow_estimator.python.estimator.canned.timeseries.ar_model

Parent TimeSeriesModel

Interfaces IARModel

Public instance methods

Tensor loss_op(IGraphNodeBase targets, IDictionary<string, object> prediction_ops)

Create loss_op.

object loss_op_dyn(object targets, object prediction_ops)

Create loss_op.

object prediction_ops(IEnumerable<PythonClassContainer> times, int values, object exogenous_regressors)

Compute model predictions given input data.
Parameters
IEnumerable<PythonClassContainer> times
A [batch size, self.window_size] integer Tensor, the first self.input_window_size times in each part of the batch indicating input features, and the last self.output_window_size times indicating prediction times.
int values
A [batch size, self.input_window_size, self.num_features] Tensor with input features.
object exogenous_regressors
A [batch size, self.window_size, self.exogenous_size] Tensor with exogenous features.
Returns
object
Tuple (predicted_mean, predicted_covariance), where each element is a Tensor with shape [batch size, self.output_window_size, self.num_features].

object prediction_ops(IEnumerable<PythonClassContainer> times, PythonClassContainer values, object exogenous_regressors)

Compute model predictions given input data.
Parameters
IEnumerable<PythonClassContainer> times
A [batch size, self.window_size] integer Tensor, the first self.input_window_size times in each part of the batch indicating input features, and the last self.output_window_size times indicating prediction times.
PythonClassContainer values
A [batch size, self.input_window_size, self.num_features] Tensor with input features.
object exogenous_regressors
A [batch size, self.window_size, self.exogenous_size] Tensor with exogenous features.
Returns
object
Tuple (predicted_mean, predicted_covariance), where each element is a Tensor with shape [batch size, self.output_window_size, self.num_features].

object prediction_ops(IndexedSlices times, int values, object exogenous_regressors)

Compute model predictions given input data.
Parameters
IndexedSlices times
A [batch size, self.window_size] integer Tensor, the first self.input_window_size times in each part of the batch indicating input features, and the last self.output_window_size times indicating prediction times.
int values
A [batch size, self.input_window_size, self.num_features] Tensor with input features.
object exogenous_regressors
A [batch size, self.window_size, self.exogenous_size] Tensor with exogenous features.
Returns
object
Tuple (predicted_mean, predicted_covariance), where each element is a Tensor with shape [batch size, self.output_window_size, self.num_features].

object prediction_ops(IndexedSlices times, PythonClassContainer values, object exogenous_regressors)

Compute model predictions given input data.
Parameters
IndexedSlices times
A [batch size, self.window_size] integer Tensor, the first self.input_window_size times in each part of the batch indicating input features, and the last self.output_window_size times indicating prediction times.
PythonClassContainer values
A [batch size, self.input_window_size, self.num_features] Tensor with input features.
object exogenous_regressors
A [batch size, self.window_size, self.exogenous_size] Tensor with exogenous features.
Returns
object
Tuple (predicted_mean, predicted_covariance), where each element is a Tensor with shape [batch size, self.output_window_size, self.num_features].

object prediction_ops(int times, int values, object exogenous_regressors)

Compute model predictions given input data.
Parameters
int times
A [batch size, self.window_size] integer Tensor, the first self.input_window_size times in each part of the batch indicating input features, and the last self.output_window_size times indicating prediction times.
int values
A [batch size, self.input_window_size, self.num_features] Tensor with input features.
object exogenous_regressors
A [batch size, self.window_size, self.exogenous_size] Tensor with exogenous features.
Returns
object
Tuple (predicted_mean, predicted_covariance), where each element is a Tensor with shape [batch size, self.output_window_size, self.num_features].

object prediction_ops(int times, PythonClassContainer values, object exogenous_regressors)

Compute model predictions given input data.
Parameters
int times
A [batch size, self.window_size] integer Tensor, the first self.input_window_size times in each part of the batch indicating input features, and the last self.output_window_size times indicating prediction times.
PythonClassContainer values
A [batch size, self.input_window_size, self.num_features] Tensor with input features.
object exogenous_regressors
A [batch size, self.window_size, self.exogenous_size] Tensor with exogenous features.
Returns
object
Tuple (predicted_mean, predicted_covariance), where each element is a Tensor with shape [batch size, self.output_window_size, self.num_features].

object prediction_ops(IGraphNodeBase times, int values, object exogenous_regressors)

Compute model predictions given input data.
Parameters
IGraphNodeBase times
A [batch size, self.window_size] integer Tensor, the first self.input_window_size times in each part of the batch indicating input features, and the last self.output_window_size times indicating prediction times.
int values
A [batch size, self.input_window_size, self.num_features] Tensor with input features.
object exogenous_regressors
A [batch size, self.window_size, self.exogenous_size] Tensor with exogenous features.
Returns
object
Tuple (predicted_mean, predicted_covariance), where each element is a Tensor with shape [batch size, self.output_window_size, self.num_features].

object prediction_ops(IGraphNodeBase times, PythonClassContainer values, object exogenous_regressors)

Compute model predictions given input data.
Parameters
IGraphNodeBase times
A [batch size, self.window_size] integer Tensor, the first self.input_window_size times in each part of the batch indicating input features, and the last self.output_window_size times indicating prediction times.
PythonClassContainer values
A [batch size, self.input_window_size, self.num_features] Tensor with input features.
object exogenous_regressors
A [batch size, self.window_size, self.exogenous_size] Tensor with exogenous features.
Returns
object
Tuple (predicted_mean, predicted_covariance), where each element is a Tensor with shape [batch size, self.output_window_size, self.num_features].

object prediction_ops(PythonClassContainer times, int values, object exogenous_regressors)

Compute model predictions given input data.
Parameters
PythonClassContainer times
A [batch size, self.window_size] integer Tensor, the first self.input_window_size times in each part of the batch indicating input features, and the last self.output_window_size times indicating prediction times.
int values
A [batch size, self.input_window_size, self.num_features] Tensor with input features.
object exogenous_regressors
A [batch size, self.window_size, self.exogenous_size] Tensor with exogenous features.
Returns
object
Tuple (predicted_mean, predicted_covariance), where each element is a Tensor with shape [batch size, self.output_window_size, self.num_features].

object prediction_ops(PythonClassContainer times, PythonClassContainer values, object exogenous_regressors)

Compute model predictions given input data.
Parameters
PythonClassContainer times
A [batch size, self.window_size] integer Tensor, the first self.input_window_size times in each part of the batch indicating input features, and the last self.output_window_size times indicating prediction times.
PythonClassContainer values
A [batch size, self.input_window_size, self.num_features] Tensor with input features.
object exogenous_regressors
A [batch size, self.window_size, self.exogenous_size] Tensor with exogenous features.
Returns
object
Tuple (predicted_mean, predicted_covariance), where each element is a Tensor with shape [batch size, self.output_window_size, self.num_features].

object prediction_ops_dyn(object times, object values, object exogenous_regressors)

Compute model predictions given input data.
Parameters
object times
A [batch size, self.window_size] integer Tensor, the first self.input_window_size times in each part of the batch indicating input features, and the last self.output_window_size times indicating prediction times.
object values
A [batch size, self.input_window_size, self.num_features] Tensor with input features.
object exogenous_regressors
A [batch size, self.window_size, self.exogenous_size] Tensor with exogenous features.
Returns
object
Tuple (predicted_mean, predicted_covariance), where each element is a Tensor with shape [batch size, self.output_window_size, self.num_features].

void random_model_parameters(object seed)

object random_model_parameters_dyn(object seed)

Public static methods

ARModel NewDyn(object periodicities, object input_window_size, object output_window_size, object num_features, ImplicitContainer<T> prediction_model_factory, ImplicitContainer<T> num_time_buckets, ImplicitContainer<T> loss, object exogenous_feature_columns)

Constructs an auto-regressive model.
Parameters
object periodicities
periodicities of the input data, in the same units as the time feature (for example 24 if feeding hourly data with a daily periodicity, or 60 * 24 if feeding minute-level data with daily periodicity). Note this can be a single value or a list of values for multiple periodicities.
object input_window_size
Number of past time steps of data to look at when doing the regression.
object output_window_size
Number of future time steps to predict. Note that setting it to > 1 empirically seems to give a better fit.
object num_features
number of input features per time step.
ImplicitContainer<T> prediction_model_factory
A callable taking arguments `num_features`, `input_window_size`, and `output_window_size` and returning a tf.keras.Model. The `Model`'s `call()` takes two arguments: an input window and an output window, and returns a dictionary of predictions. See `FlatPredictionModel` for an example. Example usage:

```python model = ar_model.ARModel( periodicities=2, num_features=3, prediction_model_factory=functools.partial( FlatPredictionModel, hidden_layer_sizes=[10, 10])) ```

The default model computes predictions as a linear function of flattened input and output windows.
ImplicitContainer<T> num_time_buckets
Number of buckets into which to divide (time % periodicity). This value multiplied by the number of periodicities is the number of time features added to the model.
ImplicitContainer<T> loss
Loss function to use for training. Currently supported values are SQUARED_LOSS and NORMAL_LIKELIHOOD_LOSS. Note that for NORMAL_LIKELIHOOD_LOSS, we train the covariance term as well. For SQUARED_LOSS, the evaluation loss is reported based on un-scaled observations and predictions, while the training loss is computed on normalized data (if input statistics are available).
object exogenous_feature_columns
A list of tf.feature_columns (for example tf.feature_column.embedding_column) corresponding to features which provide extra information to the model but are not part of the series to be predicted.

Public properties

DType dtype get; set;

IList<object> exogenous_feature_columns get;

object exogenous_feature_columns_dyn get;

Nullable<int> exogenous_size get; set;

object input_window_size get; set;

string loss get; set;

object NORMAL_LIKELIHOOD_LOSS_dyn get; set;

object num_features get; set;

object output_window_size get; set;

object PythonObject get;

object SQUARED_LOSS_dyn get; set;

object window_size get; set;

Public fields

string SQUARED_LOSS

return string

string NORMAL_LIKELIHOOD_LOSS

return string