code: def _build_transformer(
      num_classes,
      maxlen,
      max_features,
      features,
      loss_func="categorical_crossentropy",
      activation="softmax",
      metrics=["accuracy"],
      verbose=1,
      preproc=None,
  ):
      if not isinstance(preproc, tpp.TransformersPreprocessor):
          raise ValueError(
              "preproc must be instance of %s"
              % (str(tpp.TransformersPreprocessor))
          )
  
      if loss_func == "mse":
          if preproc.get_classes():
              raise Exception(
                  "This is supposed to be regression problem, but preproc.get_classes() is not empty. "
                  + "Something went wrong.  Please open a GitHub issue."
              )
              if len(preproc.get_classes()) != num_classes:
                  raise Exception(
                      "Number of labels from preproc.get_classes() is not equal to num_classes. "
                      + "Something went wrong. Please open GitHub issue."
                  )
      else:
          if not preproc.get_classes():
              raise Exception(
                  "This is supposed to be a classification problem, but preproc.get_classes() is empty. "
                  + "Something went wrong.  Please open a GitHub issue."
              )
      return (
          preproc.get_regression_model(metrics=metrics)
          if loss_func == "mse"
          else preproc.get_classifier(metrics=metrics)
      )
  
file_path: ktrain/ktrain/text/models.py
imports: from ..None import utils
  from ..imports import *
  from .None import preprocessor
label_desc: Use image node_id 8 for calling a global function with example usage: _build_transformer(num_classes, maxlen, max_features, features, loss_func, activation, metrics, verbose, preproc) and returns: unknown