code: def test_robust_max_multiclass_symmetric(
      num_classes: int, num_points: int, tol: float, epsilon: float
  ) -> None:
      """
      This test is based on the observation that for
      symmetric inputs the class predictions must have equal probability.
      """
      rng = np.random.RandomState(1)
      p = 1.0 / num_classes
      X = tf.ones((num_points, 1), dtype=default_float())
      F = tf.ones((num_points, num_classes), dtype=default_float())
      Y = tf.convert_to_tensor(
          rng.randint(num_classes, size=(num_points, 1)),
          dtype=default_float(),
      )
  
      likelihood = MultiClass(num_classes)
      likelihood.invlink.epsilon = tf.convert_to_tensor(
          epsilon, dtype=default_float()
      )
  
      mu, _ = likelihood.predict_mean_and_var(X, F, F)
      pred = likelihood.predict_log_density(X, F, F, Y)
      variational_expectations = likelihood.variational_expectations(
          X, F, F, Y
      )
  
      expected_mu: AnyNDArray = (
          p * (1.0 - epsilon) + (1.0 - p) * epsilon / (num_classes - 1)
      ) * np.ones((num_points, 1))
      expected_log_density = np.log(expected_mu)
  
      # assert_allclose() would complain about shape mismatch
      assert np.allclose(mu, expected_mu, tol, tol)
      assert np.allclose(pred, expected_log_density, 1e-3, 1e-3)
  
      validation_variational_expectation = p * np.log(1.0 - epsilon) + (
          1.0 - p
      ) * np.log(epsilon / (num_classes - 1))
      assert_allclose(
          variational_expectations,
          np.ones((num_points,)) * validation_variational_expectation,
          tol,
          tol,
      )
  
file_path: GPflow/tests/gpflow/likelihoods/test_multiclass.py
imports: import numpy
  import pytest
  import tensorflow
  from check_shapes import inherit_check_shapes
  from numpy.testing import assert_allclose
  from gpflow.base import AnyNDArray, TensorType
  from gpflow.config import default_float, default_int
  from gpflow.likelihoods import Bernoulli, MultiClass, RobustMax, Softmax
  from gpflow.utilities import to_default_float, to_default_int
label_desc: Use image node_id 3 for calling a global function with example usage: test_robust_max_multiclass_symmetric(num_classes, num_points, tol, epsilon) without return types