code: def finalize(self):
      # TODO: support raw string labels for multi-label.
      self.labels = sorted(list(self.labels))
  
      # Infer the num_classes if not specified.
      if not self.num_classes:
          if self.encoded:
              # Single column with 0s and 1s.
              if len(self.shape) == 1 or self.shape[1:] == [1]:
                  self.num_classes = 2
              else:
                  self.num_classes = self.shape[1]
          else:
              self.num_classes = len(self.labels)
  
      if self.num_classes < 2:
          raise ValueError(
              "Expect the target data for {name} to have "
              "at least 2 classes, but got {num_classes}.".format(
                  name=self.name, num_classes=self.num_classes
              )
          )
  
      # Check shape equals expected shape.
      expected = self.get_expected_shape()
      actual = self.shape[1:]
      if len(actual) == 0:
          actual = [1]
      if self.encoded and actual != expected:
          raise ValueError(
              "Expect the target data for {name} to have "
              "shape {expected}, but got {actual}.".format(
                  name=self.name,
                  expected=expected,
                  actual=self.shape[1:],
              )
          )
  
file_path: autokeras/autokeras/analysers/output_analysers.py
imports: import numpy
  from autokeras.engine import analyser
label_desc: Use image node_id 3 for calling the ClassificationAnalyser obj's underlying member method code with example usage: obj.finalize() without return types