code: def run_classifier_model(self, workspace):
      src_objects = workspace.get_objects(self.object_name.value)
      classifier = self.get_classifier()
      class_labels = self.get_bin_labels()
      if self.get_classifier_type() == "Rules":
          class_id_dict = dict(
              (j, i) for i, j in enumerate(class_labels, 1)
          )
      else:
          class_id_dict = dict(zip(class_labels, classifier.classes_))
      if src_objects.count >= 1:
          if self.get_classifier_type() == "Rules":
              # Working with CPA rules.
              probabilities = classifier.score(workspace.measurements)
              if len(probabilities) > 0:
                  is_not_nan = numpy.any(~numpy.isnan(probabilities), 1)
                  predicted_classes = (
                      numpy.argmax(
                          probabilities[is_not_nan], 1
                      ).flatten()
                      + 1
                  )
              else:
                  predicted_classes = []
          else:
              # Working with a CPA sklearn-based model
              features = self.split_feature_names(
                  self.get_classifier_features(),
                  workspace.object_set.get_object_names(),
              )
  
              feature_vector = numpy.column_stack(
                  [
                      workspace.measurements[
                          object_name,
                          self.rules.Rule.return_fuzzy_measurement_name(
                              workspace.measurements.get_measurement_columns(),
                              object_name,
                              feature_name,
                              False,
                              self.allow_fuzzy,
                          ),
                      ]
                      for object_name, feature_name in features
                  ]
              )
  
              if (
                  hasattr(classifier, "scaler")
                  and classifier.scaler is not None
              ):
                  feature_vector = classifier.scaler.transform(
                      feature_vector
                  )
              numpy.nan_to_num(feature_vector, copy=False)
              predicted_classes = classifier.predict(feature_vector)
              probabilities = classifier.predict_proba(feature_vector)
      else:
          predicted_classes = []
          probabilities = numpy.array([[0] * len(class_labels)])
      m = workspace.measurements
  
      m.add_measurement(
          self.object_name.value,
          f"{M_CATEGORY}_Class",
          [class_labels[i - 1] for i in predicted_classes],
      )
  
      class_counts = []
      for index, label in enumerate(class_labels):
          class_count = numpy.count_nonzero(
              predicted_classes == class_id_dict[label]
          )
          class_counts.append(class_count)
          m.add_measurement(
              IMAGE, f"{M_CATEGORY}_{FF_COUNT % label}", class_count
          )
          m.add_measurement(
              self.object_name.value,
              f"{M_CATEGORY}_Probability_{label}",
              probabilities[:, index],
          )
      if self.create_class_sets.value:
          for group in self.desired_classes:
              target_id = class_id_dict[group.class_name.value]
              hits = predicted_classes == target_id
              indexes = numpy.flatnonzero(hits) + 1
  
              #
              # Create an array that maps label indexes to their new values
              # All labels to be deleted have a value in this array of zero
              #
              new_object_count = len(indexes)
              max_label = numpy.max(src_objects.segmented)
              label_indexes = numpy.zeros((max_label + 1,), int)
              label_indexes[indexes] = numpy.arange(
                  1, new_object_count + 1
              )
              #
              # Loop over both the primary and additional objects
              #
              target_labels = src_objects.segmented.copy()
              #
              # Reindex the labels of the old source image
              #
              target_labels[target_labels > max_label] = 0
              target_labels = label_indexes[target_labels]
              #
              # Make a new set of objects - retain the old set's unedited
              # segmentation for the new and generally try to copy stuff
              # from the old to the new.
              #
              target_objects = Objects()
              target_objects.segmented = target_labels
              target_objects.unedited_segmented = (
                  src_objects.unedited_segmented
              )
              #
              # Remove the filtered objects from the small_removed_segmented
              # if present. "small_removed_segmented" should really be
              # "filtered_removed_segmented".
              #
              small_removed = src_objects.small_removed_segmented.copy()
              small_removed[
                  (target_labels == 0) & (src_objects.segmented != 0)
              ] = 0
              target_objects.small_removed_segmented = small_removed
              if src_objects.has_parent_image:
                  target_objects.parent_image = src_objects.parent_image
              workspace.object_set.add_objects(
                  target_objects, group.class_objects_name.value
              )
  
              self.add_measurements(
                  workspace,
                  self.object_name.value,
                  group.class_objects_name.value,
              )
  
      if self.show_window:
          workspace.display_data.identities = class_id_dict
          object_labels = src_objects.segmented.copy()
          object_labels = numpy.insert(predicted_classes, 0, 0)[
              object_labels
          ]
  
          workspace.display_data.input_objects = src_objects.segmented
          workspace.display_data.labeled_classes = object_labels
          workspace.display_data.class_counts = class_counts
  
imports: import functools
  import os
  import numpy
  from cellprofiler.modules import _help
  from cellprofiler.utilities.rules import Rules
  from cellprofiler_core.constants.measurement import COLTYPE_FLOAT, M_LOCATION_CENTER_X, M_LOCATION_CENTER_Y, COLTYPE_VARCHAR, C_COUNT, C_CHILDREN, C_LOCATION, C_NUMBER, C_PARENT, FTR_OBJECT_NUMBER, FTR_CENTER_X, FTR_CENTER_Y, FTR_CENTER_Z
  from cellprofiler_core.constants.measurement import COLTYPE_INTEGER
  from cellprofiler_core.constants.measurement import IMAGE
  from cellprofiler_core.image import Image
  from cellprofiler_core.module import Module
  from cellprofiler_core.object import Objects
  from cellprofiler_core.preferences import get_default_colormap, get_headless
  from cellprofiler_core.setting import Binary
  from cellprofiler_core.setting import Divider
  from cellprofiler_core.setting import HiddenCount
  from cellprofiler_core.setting import Measurement
  from cellprofiler_core.setting import SettingsGroup
  from cellprofiler_core.setting import ValidationError
  from cellprofiler_core.setting.choice import Choice
  from cellprofiler_core.setting.do_something import DoSomething
  from cellprofiler_core.setting.do_something import RemoveSettingButton
  from cellprofiler_core.setting.subscriber import LabelSubscriber
  from cellprofiler_core.setting.text import Alphanumeric, Directory, Filename, LabelName
  from cellprofiler_core.setting.text import Float
  from cellprofiler_core.setting.text import ImageName
  from cellprofiler_core.setting.text import Integer
  from cellprofiler_core.setting.text import Text
  from cellprofiler_core.constants.measurement import FF_CHILDREN_COUNT
  from cellprofiler_core.constants.measurement import FF_COUNT
  from cellprofiler_core.constants.measurement import FF_PARENT
  from cellprofiler_core.module.image_segmentation import ImageSegmentation
label_desc: Use image node_id 15 for calling the ClassifyObjects obj's underlying member method code with example usage: obj.run_classifier_model(workspace) without return types