class_docstr: Unit test class for testing scikit-learn converter.
code: def test_classifier_string_classes(self):
      from keras.layers import Dense
      from keras.layers import Activation
  
      # Create a simple Keras model
      model = Sequential()
      model.add(Dense(32, input_dim=16))
      model.add(Activation("softmax"))
      classes = ["c%s" % i for i in range(32)]
  
      input_names = ["input"]
      output_names = ["prob_output"]
      expected_output_names = ["prob_output", "classLabel"]
      spec = keras.convert(
          model, input_names, output_names, class_labels=classes
      ).get_spec()
      self.assertIsNotNone(spec)
  
      # Test the model class
      self.assertIsNotNone(spec.description)
      self.assertTrue(spec.HasField("neuralNetworkClassifier"))
      self.assertFalse(spec.HasField("neuralNetwork"))
  
      # Test the inputs and outputs
      self.assertEquals(len(spec.description.input), len(input_names))
      six.assertCountEqual(
          self, input_names, [x.name for x in spec.description.input]
      )
      self.assertEquals(
          len(spec.description.output), len(expected_output_names)
      )
      self.assertEquals(
          expected_output_names,
          [x.name for x in spec.description.output],
      )
  
      # Check the types
      self.assertEquals(
          spec.description.output[0].type.WhichOneof("Type"),
          "dictionaryType",
      )
      self.assertEquals(
          spec.description.output[0].type.dictionaryType.WhichOneof(
              "KeyType"
          ),
          "stringKeyType",
      )
      self.assertEquals(
          spec.description.output[1].type.WhichOneof("Type"),
          "stringType",
      )
      self.assertTrue(
          spec.description.predictedFeatureName, "classLabel"
      )
      self.assertTrue(
          spec.description.predictedProbabilitiesName, "prob_output"
      )
  
      # Test the class parameters
      self.assertEqual(
          spec.WhichOneof("Type"),
          "neuralNetworkClassifier",
          "Expected a NN classifier model",
      )
      self.assertEqual(
          spec.neuralNetworkClassifier.WhichOneof("ClassLabels"),
          "stringClassLabels",
      )
      class_from_proto = list(
          spec.neuralNetworkClassifier.stringClassLabels.vector
      )
      six.assertCountEqual(self, classes, class_from_proto)
  
imports: import unittest
  from coremltools._deps import _HAS_KERAS_TF
  from coremltools.proto import FeatureTypes_pb2
  import pytest
  import six
label_desc: Use image node_id 21 for calling the KerasSingleLayerTest obj's underlying member method code with example usage: obj.test_classifier_string_classes() without return types