Type TimeSeriesModel
Namespace tensorflow_estimator.python.estimator.canned.timeseries.model
Parent PythonObjectContainer
Interfaces ITimeSeriesModel
Methods
- define_loss
- define_loss
- define_loss_dyn
- generate
- generate_dyn
- get_batch_loss
- get_batch_loss
- get_batch_loss
- get_batch_loss
- get_batch_loss
- get_batch_loss
- get_batch_loss_dyn
- get_start_state
- get_start_state_dyn
- initialize_graph
- initialize_graph_dyn
- predict
Properties
Public instance methods
object define_loss(IDictionary<object, object> features, string mode)
object define_loss(object features, string mode)
object define_loss_dyn(object features, object mode)
void generate(object number_of_series, object series_length, object model_parameters, object seed)
object generate_dyn(object number_of_series, object series_length, object model_parameters, object seed)
Sample synthetic data from model parameters, with optional substitutions. Returns `number_of_series` possible sequences of future values, sampled from
the generative model with each conditioned on the previous. Samples are
based on trained parameters, except for those parameters explicitly
overridden in `model_parameters`. For distributions over future observations, see predict().
Parameters
-
object
number_of_series - Number of time series to create.
-
object
series_length - Length of each time series.
-
object
model_parameters - A dictionary mapping model parameters to values, which replace trained parameters when generating data.
-
object
seed - If specified, return deterministic time series according to this value.
Returns
-
object
- A dictionary with keys TrainEvalFeatures.TIMES (mapping to an array with shape [number_of_series, series_length]) and TrainEvalFeatures.VALUES (mapping to an array with shape [number_of_series, series_length, num_features]).
object get_batch_loss(object features, string mode, PythonClassContainer state)
object get_batch_loss(object features, string mode, IGraphNodeBase state)
object get_batch_loss(IDictionary<object, object> features, string mode, IEnumerable<object> state)
object get_batch_loss(IDictionary<object, object> features, string mode, IGraphNodeBase state)
object get_batch_loss(IDictionary<object, object> features, string mode, PythonClassContainer state)
object get_batch_loss(object features, string mode, IEnumerable<object> state)
object get_batch_loss_dyn(object features, object mode, object state)
Computes predictions and a loss.
Parameters
-
object
features - A dictionary (such as is produced by a chunker) with the following key/value pairs (shapes are given as required for training): TrainEvalFeatures.TIMES: A [batch size, self.window_size] integer Tensor with times for each observation. To train on longer sequences, the data should first be chunked. TrainEvalFeatures.VALUES: A [batch size, self.window_size, self.num_features] Tensor with values for each observation. When evaluating, `TIMES` and `VALUES` must have a window size of at least self.window_size, but it may be longer, in which case the last window_size - self.input_window_size times (or fewer if this is not divisible by self.output_window_size) will be evaluated on with non-overlapping output windows (and will have associated predictions). This is primarily to support qualitative evaluation/plotting, and is not a recommended way to compute evaluation losses (since there is no overlap in the output windows, which for window-based models is an undesirable bias).
-
object
mode - The tf.estimator.ModeKeys mode to use (TRAIN or EVAL).
-
object
state - Unused
Returns
-
object
- A model.ModelOutputs object.
ValueTuple<Tensor, object, object> get_start_state()
Returns a tuple of state for the start of the time series. For example, a mean and covariance. State should not have a batch
dimension, and will often be TensorFlow Variables to be learned along with
the rest of the model parameters.
object get_start_state_dyn()
Returns a tuple of state for the start of the time series. For example, a mean and covariance. State should not have a batch
dimension, and will often be TensorFlow Variables to be learned along with
the rest of the model parameters.
void initialize_graph(object input_statistics)
Define ops for the model, not depending on any previously defined ops.
Parameters
-
object
input_statistics - A math_utils.InputStatistics object containing input statistics. If None, data-independent defaults are used, which may result in longer or unstable training.
object initialize_graph_dyn(object input_statistics)
Define ops for the model, not depending on any previously defined ops.
Parameters
-
object
input_statistics - A math_utils.InputStatistics object containing input statistics. If None, data-independent defaults are used, which may result in longer or unstable training.
IDictionary<string, object> predict(IDictionary<object, object> features)
Computes predictions multiple steps into the future.
Parameters
-
IDictionary<object, object>
features - A dictionary with the following key/value pairs:
Returns
-
IDictionary<string, object>
- A dictionary with keys, "mean", "covariance". The values are Tensors of shape [batch_size, predict window size, num_features] and correspond to the values passed in `TIMES`.