Rackio LSTM
rackio_AI.RackioLSTM(*args, **kwargs)Documentation here
call(self, *args, **kwargs)Wraps call, applying pre- and post-processing steps.
Arguments:
args: Positional arguments to be passed to self.call.
*kwargs: Keyword arguments to be passed to self.call.
Returns: Output tensor(s).
Note:
- The following optional keyword arguments are reserved for specific uses:
* training: Boolean scalar tensor of Python boolean indicating
whether the call is meant for training or inference.
* mask: Boolean input mask.
- If the layer's call method takes a mask argument (as some Keras
layers do), its default value will be set to the mask generated
for inputs by the previous layer (if input did come from
a layer that generated a corresponding mask, i.e. if it came from
a Keras layer with masking support.
Raises:
ValueError: if the layer's call method returns None (an invalid value).
RuntimeError: if super().init() was not called in the constructor.
compile(self, optimizer=Configures the model for training.
Parameters
- :param optimizer: String (name of optimizer) or optimizer instance.
- tf.keras.optimizers.Adam: Optimizer that implements the Adam algorithm.
- tf.keras.optimizers.Adadelta: Optimizer that implements the Adadelta algorithm.
- tf.keras.optimizers.Adagrad: Optimizer that implements the Adagrad algorithm.
- tf.keras.optimizers.Adamax: Optimizer that implements the Adamax algorithm.
- tf.keras.optimizers.Ftrl: Optimizer that implements the FTRL algorithm.
- tf.keras.optimizers.Nadam: Optimizer that implements the Nadam algorithm.
- tf.keras.optimizers.RMSprop: Optimizer that implements the RMSprop algorithm.
- tf.keras.optimizers.SGD: Optimizer that implements the SGD algorithm.
-
:param loss: String (name of objective function), objective function or tf.keras.losses.Loss instance. See tf.keras.losses. An objective function is any callable with the signature loss = fn(y_true, y_pred), where y_true = ground truth values with shape = [batch_size, d0, .. dN], except sparse loss functions such as sparse categorical crossentropy where shape = [batch_size, d0, .. dN-1]. y_pred = predicted values with shape = [batch_size, d0, .. dN]. It returns a weighted loss float tensor. If a custom Loss instance is used and reduction is set to NONE, return value has the shape [batch_size, d0, .. dN-1] ie. per-sample or per-timestep loss values; otherwise, it is a scalar. If the model has multiple outputs, you can use a different loss on each output by passing a dictionary or a list of losses. The loss value that will be minimized by the model will then be the sum of all individual losses.
Classes
- tf.keras.losses.BinaryCrossentropy Computes the cross-entropy loss between true labels and predicted labels.
- tf.keras.losses.CategoricalCrossentropy Computes the crossentropy loss between the labels and predictions.
- tf.keras.losses.CategoricalHinge Computes the categorical hinge loss between y_true and y_pred.
- tf.keras.losses.CosineSimilarity Computes the cosine similarity between labels and predictions.
- tf.keras.losses.Hinge Computes the hinge loss between y_true and y_pred.
- tf.keras.losses.Huber Computes the Huber loss between y_true and y_pred.
- tf.keras.losses.KLDivergence Computes Kullback-Leibler divergence loss between y_true and y_pred.
- tf.keras.losses.LogCosh Computes the logarithm of the hyperbolic cosine of the prediction error.
- tf.keras.losses.MeanAbsoluteError Computes the mean of absolute difference between labels and predictions.
- tf.keras.losses.MeanAbsolutePercentageError Computes the mean absolute percentage error between y_true and y_pred.
- tf.keras.losses.MeanSquaredError Computes the mean of squares of errors between labels and predictions.
- tf.keras.losses.MeanSquaredLogarithmicError Computes the mean squared logarithmic error between y_true and y_pred.
- tf.keras.losses.Poisson Computes the Poisson loss between y_true and y_pred.
- tf.keras.losses.Reduction Types of loss reduction.
- tf.keras.losses.SparseCategoricalCrossentropy Computes the crossentropy loss between the labels and predictions.
- tf.keras.losses.SquaredHinge Computes the squared hinge loss between y_true and y_pred.
Functions
- KLD(...): Computes Kullback-Leibler divergence loss between y_true and y_pred.
- MAE(...): Computes the mean absolute error between labels and predictions.
- MAPE(...): Computes the mean absolute percentage error between y_true and y_pred.
- MSE(...): Computes the mean squared error between labels and predictions.
- MSLE(...): Computes the mean squared logarithmic error between y_true and y_pred.
- binary_crossentropy(...): Computes the binary crossentropy loss.
- categorical_crossentropy(...): Computes the categorical crossentropy loss.
- categorical_hinge(...): Computes the categorical hinge loss between y_true and y_pred.
- cosine_similarity(...): Computes the cosine similarity between labels and predictions.
- deserialize(...): Deserializes a serialized loss class/function instance.
- get(...): Retrieves a Keras loss as a function/Loss class instance.
- hinge(...): Computes the hinge loss between y_true and y_pred.
- huber(...): Computes Huber loss value.
- kl_divergence(...): Computes Kullback-Leibler divergence loss between y_true and y_pred.
- kld(...): Computes Kullback-Leibler divergence loss between y_true and y_pred.
- kullback_leibler_divergence(...): Computes Kullback-Leibler divergence loss between y_true and y_pred.
- log_cosh(...): Logarithm of the hyperbolic cosine of the prediction error.
- logcosh(...): Logarithm of the hyperbolic cosine of the prediction error.
- mae(...): Computes the mean absolute error between labels and predictions.
- mape(...): Computes the mean absolute percentage error between y_true and y_pred.
- mean_absolute_error(...): Computes the mean absolute error between labels and predictions.
- mean_absolute_percentage_error(...): Computes the mean absolute percentage error between y_true and y_pred.
- mean_squared_error(...): Computes the mean squared error between labels and predictions.
- mean_squared_logarithmic_error(...): Computes the mean squared logarithmic error between y_true and y_pred.
- mse(...): Computes the mean squared error between labels and predictions.
- msle(...): Computes the mean squared logarithmic error between y_true and y_pred.
- poisson(...): Computes the Poisson loss between y_true and y_pred.
- serialize(...): Serializes loss function or Loss instance.
- sparse_categorical_crossentropy(...): Computes the sparse categorical crossentropy loss.
- squared_hinge(...): Computes the squared hinge loss between y_true and y_pred.
-
:param metrics: List of metrics to be evaluated by the model during training and testing. Each of this can be a string (name of a built-in function), function or a tf.keras.metrics.Metric instance. See tf.keras.metrics. Typically you will use metrics=['accuracy']. A function is any callable with the signature result = fn(y_true, y_pred). To specify different metrics for different outputs of a multi-output model, you could also pass a dictionary, such as metrics={'output_a': 'accuracy', 'output_b': ['accuracy', 'mse']}. You can also pass a list (len = len(outputs)) of lists of metrics such as metrics=[['accuracy'], ['accuracy', 'mse']] or metrics=['accuracy', ['accuracy', 'mse']]. When you pass the strings 'accuracy' or 'acc', we convert this to one of tf.keras.metrics.BinaryAccuracy, tf.keras.metrics.CategoricalAccuracy, tf.keras.metrics.SparseCategoricalAccuracy based on the loss function used and the model output shape. We do a similar conversion for the strings 'crossentropy' and 'ce' as well.
- :param loss_weights: Optional list or dictionary specifying scalar coefficients (Python floats) to weight the loss contributions of different model outputs. The loss value that will be minimized by the model will then be the weighted sum of all individual losses, weighted by the loss_weights coefficients. If a list, it is expected to have a 1:1 mapping to the model's outputs. If a dict, it is expected to map output names (strings) to scalar coefficients.
- :param weighted_metrics: List of metrics to be evaluated and weighted by sample_weight or class_weight during training and testing.
- :param run_eagerly: Bool. Defaults to False. If True, this Model's logic will not be wrapped in a tf.function. Recommended to leave this as None unless your Model cannot be run inside a tf.function.
- :param steps_per_execution: Int. Defaults to 1. The number of batches to run during each tf.function call. Running multiple batches inside a single tf.function call can greatly improve performance on TPUs or small models with a large Python overhead. At most, one full epoch will be run each execution. If a number larger than the size of the epoch is passed, the execution will be truncated to the size of the epoch. Note that if steps_per_execution is set to N, Callback.on_batch_begin and Callback.on_batch_end methods will only be called every N batches (i.e. before/after each tf.function execution).
- :param kwargs: Arguments supported for backwards compatibility only.
Raise
- ValueError: In case of invalid arguments for optimizer, loss or metrics.
fit(self, *training_data, validation_data=None, epochs=3, callbacks=[Trains the model for a fixed number of epochs (iterations on a dataset).
Parameters
- :param x: Input data. It could be:
- A Numpy array (or array-like), or a list of arrays (in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors (in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors, if the model has named inputs.
- A tf.data dataset. Should return a tuple of either (inputs, targets) or (inputs, targets, sample_weights).
- A generator or tf.keras.utils.Sequence returning (inputs, targets) or (inputs, targets, sample_weights). A more detailed description of unpacking behavior for iterator types (Dataset, generator, Sequence) is given below.
- :param y: Target data. Like the input data x, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with x (you cannot have Numpy inputs and tensor targets, or inversely). If x is a dataset, generator, or keras.utils.Sequence instance, y should not be specified (since targets will be obtained from x).
predict(self, x, **kwargs)Documentation here
evaluate(self, x=None, y=None, **kwargs)Documentation here