LostTech.TensorFlow : API Documentation

Type CategoricalCrossentropy

Namespace tensorflow.keras.losses

Parent LossFunctionWrapper

Interfaces ICategoricalCrossentropy

Computes the crossentropy loss between the labels and predictions.

Use this crossentropy loss function when there are two or more label classes. We expect labels to be provided in a `one_hot` representation. If you want to provide labels as integers, please use `SparseCategoricalCrossentropy` loss. There should be `# classes` floating point values per feature.

In the snippet below, there is `# classes` floating pointing values per example. The shape of both `y_pred` and `y_true` are `[batch_size, num_classes]`.

Usage: Usage with the `compile` API:
Show Example
cce = tf.keras.losses.CategoricalCrossentropy()
            loss = cce(
              [[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]],
              [[.9,.05,.05], [.05,.89,.06], [.05,.01,.94]])
            print('Loss: ', loss.numpy())  # Loss: 0.0945 

Methods

Properties

Public static methods

CategoricalCrossentropy NewDyn(ImplicitContainer<T> from_logits, ImplicitContainer<T> label_smoothing, ImplicitContainer<T> reduction, ImplicitContainer<T> name)

Initialize self. See help(type(self)) for accurate signature.

Public properties

object fn get; set;

string name get; set;

object PythonObject get;

string reduction get; set;