rztdl.dl.components.losses.primitive package

Submodules

rztdl.dl.components.losses.primitive.binary_cross_entropy module

@created on: 2020-01-13,
@author: shubham,
@version: v0.0.1

Description:

Sphinx Documentation Status: Complete

class rztdl.dl.components.losses.primitive.binary_cross_entropy.BinaryCrossentropy(name: str, labels: typing.Union[str, tensorflow.python.framework.ops.Tensor], predictions: typing.Union[str, tensorflow.python.framework.ops.Tensor], sample_weight: float = 1.0, apply_sigmoid: bool = False, label_smoothing: float = 0, outputs: str = None)[source]

Bases: rztdl.dl.components.losses.loss.Loss

Computes the cross-entropy loss between true labels and predicted labels

Parameters:
  • name (str) – component name
  • sample_weight (float) – Optional sample_weight acts as a coefficient for the loss.
  • apply_sigmoid (bool) – Whether to apply sigmoid or not
  • label_smoothing (float) – Float in [0, 1]. When > 0, label values are smoothed, meaning the confidence on label values are relaxed. e.g. label_smoothing=0.2 means that we will use a value of 0.1 for label 0 and 0.9 for label 1”
  • labels (Union[str, Tensor]) – Truth values
  • predictions (Union[str, Tensor]) – Predicted values
  • outputs (Optional[str]) – output of component
call(inputs, training, **kwargs)[source]
create(labels, predictions)[source]
parameter_validation(label_smoothing)[source]
validate(labels, predictions)[source]

rztdl.dl.components.losses.primitive.categorical_cross_entropy module

@created on: 2020-01-13,
@author: shubham,
@version: v0.0.1

Description:

Sphinx Documentation Status: Complete

class rztdl.dl.components.losses.primitive.categorical_cross_entropy.CategoricalCrossentropy(name: str, labels: typing.Union[str, tensorflow.python.framework.ops.Tensor], predictions: typing.Union[str, tensorflow.python.framework.ops.Tensor], apply_softmax: bool = False, label_smoothing: float = 0, sample_weight: float = 1.0, outputs: str = None)[source]

Bases: rztdl.dl.components.losses.loss.Loss

Computes the crossentropy loss between the labels and predictions.

Parameters:
  • name (str) – Component name
  • labels (Union[str, Tensor]) – Tensor of true targets
  • predictions (Union[str, Tensor]) – Tensor of predicted targets
  • apply_softmax (bool) – Whether to apply softmax or not
  • label_smoothing (float) – Float in [0, 1]. If > 0 then smooth the labels
  • sample_weight (float) – Optional sample_weight acts as a coefficient for the loss. If a scalar is provided, then the loss is simply scaled by the given value. If sample_weight is a tensor of size [batch_size], then the total loss for each sample of the batch is rescaled by the corresponding element in the sample_weight vector
  • outputs (Optional[str]) – Output tensor
call(inputs, training, **kwargs)[source]
create(labels, predictions)[source]
parameter_validation(label_smoothing)[source]
validate(labels, predictions)[source]

rztdl.dl.components.losses.primitive.mse_loss module

@created on: 16/12/19,
@author: Umesh Kumar,
@version: v0.0.1

Description:

Sphinx Documentation Status: Complete

class rztdl.dl.components.losses.primitive.mse_loss.MeanSquaredError(name: str, predictions: typing.Union[str, tensorflow.python.framework.ops.Tensor], labels: typing.Union[str, tensorflow.python.framework.ops.Tensor], outputs: str = None)[source]

Bases: rztdl.dl.components.losses.loss.Loss

Mean Square Error

Parameters:
  • name (str) – Name of instance
  • predictions (Union[str, Tensor]) – Predictions Tensor
  • labels (Union[str, Tensor]) – Labels Tensor
  • outputs (Optional[str]) – Output Tensor
call(inputs, training, **kwargs)[source]
create(predictions, labels)[source]
validate(predictions, labels)[source]

rztdl.dl.components.losses.primitive.rmse_loss module

@created on: 2020-01-13,
@author: shubham,
@version: v0.0.1

Description:

Sphinx Documentation Status: Complete

class rztdl.dl.components.losses.primitive.rmse_loss.RootMeanSquaredError(name: str, predictions: typing.Union[str, tensorflow.python.framework.ops.Tensor], labels: typing.Union[str, tensorflow.python.framework.ops.Tensor], outputs: str = None)[source]

Bases: rztdl.dl.components.losses.primitive.mse_loss.MeanSquaredError

Root Mean Squared Error

Calculates RMSE :type name: str :param name: Component name :type predictions: Union[str, Tensor] :param predictions: predicted values :type labels: Union[str, Tensor] :param labels: Ground truth values :type outputs: Optional[str] :param outputs: Output Tensor

call(inputs, training, **kwargs)[source]

Does square root over mse :param inputs: List of [y_true, y_pred] :param training: Tells whether in training or not :param kwargs: :return: RMSE value

validate(predictions, labels)[source]

Module contents

@created on: 16/12/19,
@author: Umesh Kumar,
@version: v0.0.1

Description:

Sphinx Documentation Status: Complete