class_docstr: Implements the Weighted Kappa loss function.
  
  Weighted Kappa loss was introduced in the
  [Weighted kappa loss function for multi-class classification
  of ordinal data in deep learning]
  (https://www.sciencedirect.com/science/article/abs/pii/S0167865517301666).
  Weighted Kappa is widely used in Ordinal Classification Problems.
  The loss value lies in $ [-\infty, \log 2] $, where $ \log 2 $
  means the random prediction.
  
  Usage:
  
  >>> kappa_loss = tfa.losses.WeightedKappaLoss(num_classes=4)
  >>> y_true = tf.constant([[0, 0, 1, 0], [0, 1, 0, 0],
  ...                  [1, 0, 0, 0], [0, 0, 0, 1]])
  >>> y_pred = tf.constant([[0.1, 0.2, 0.6, 0.1], [0.1, 0.5, 0.3, 0.1],
  ...                  [0.8, 0.05, 0.05, 0.1], [0.01, 0.09, 0.1, 0.8]])
  >>> loss = kappa_loss(y_true, y_pred)
  >>> loss
  <tf.Tensor: shape=(), dtype=float32, numpy=-1.1611925>
  
  Usage with `tf.keras` API:
  
  >>> model = tf.keras.Model()
  >>> model.compile('sgd', loss=tfa.losses.WeightedKappaLoss(num_classes=4))
  
  <... outputs should be softmax results
  if you want to weight the samples, just multiply the outputs
  by the sample weight ...>
code: def call(self, y_true, y_pred):
      y_true = tf.cast(y_true, dtype=self.col_label_vec.dtype)
      y_pred = tf.cast(y_pred, dtype=self.weight_mat.dtype)
      batch_size = tf.shape(y_true)[0]
      cat_labels = tf.matmul(y_true, self.col_label_vec)
      cat_label_mat = tf.tile(cat_labels, [1, self.num_classes])
      row_label_mat = tf.tile(self.row_label_vec, [batch_size, 1])
      if self.weightage == "linear":
          weight = tf.abs(cat_label_mat - row_label_mat)
      else:
          weight = (cat_label_mat - row_label_mat) ** 2
      numerator = tf.reduce_sum(weight * y_pred)
      label_dist = tf.reduce_sum(y_true, axis=0, keepdims=True)
      pred_dist = tf.reduce_sum(y_pred, axis=0, keepdims=True)
      w_pred_dist = tf.matmul(
          self.weight_mat, pred_dist, transpose_b=True
      )
      denominator = tf.reduce_sum(tf.matmul(label_dist, w_pred_dist))
      denominator /= tf.cast(batch_size, dtype=denominator.dtype)
      loss = tf.math.divide_no_nan(numerator, denominator)
      return tf.math.log(loss + self.epsilon)
  
file_path: addons/tensorflow_addons/losses/kappa_loss.py
imports: from typing import Optional
  import tensorflow
  from typeguard import typechecked
  from tensorflow_addons.utils.types import Number
label_desc: Use image node_id 2 for calling the WeightedKappaLoss obj's underlying member method code with example usage: obj.call(y_true, y_pred) and returns: tf