class_docstr: When called, this ensemble will return the mode prediction from the entire list of underlying mixers.
  
  If there are multiple modes, the mode whose voting mixers have the highest score will be returned.
  
  NOTE: can only be used in categorical tasks.
docstr: If the predictions are unimodal, return the mode. If there are multiple modes, return the mode whose voting
  mixers have the highest score.
docstr_tok: ["If","the","predictions","are","unimodal",",","return","the","mode",".","If","there","are","multiple","modes",",","return","the","mode","whose","voting","mixers","have","the","highest","score","."]
code: def _pick_mode_highest_score(self, prediction: pd.Series):
      """If the predictions are unimodal, return the mode. If there are multiple modes, return the mode whose voting
      mixers have the highest score."""
      prediction_counts = prediction.value_counts()
  
      # If there is a clear winner, i.e. only one prediction
      if len(prediction_counts) == 1:
          return prediction_counts.index[0]
  
      counts = (
          prediction_counts.values
      )  # how many times all predictions have appeared
      max_count = np.max(
          counts
      )  # how many times the most frequent predictions have apppeared
  
      # most frequent predictions and how many times they appeared
      modes = prediction_counts[prediction_counts == max_count]
  
      modes_predictions = modes.index  # most frequent predictions
  
      # For each mode, get the sum of the scores of the predictors who voted for it
      modes_predictions_scores = {}
      for mode_prediction in modes_predictions:
          voting_mixers_name = prediction[
              prediction == mode_prediction
          ].index.tolist()
          modes_predictions_scores[mode_prediction] = np.sum(
              [
                  self.mixer_scores[mixer_name]
                  for mixer_name in voting_mixers_name
              ]
          )
  
      # Return the mode with the maximum sum of accuracies
      return max(
          modes_predictions_scores, key=modes_predictions_scores.get
      )
  
file_path: lightwood/lightwood/ensemble/mode_ensemble.py
imports: from typing import List, Optional, Dict
  import pandas
  import numpy
  from lightwood.mixer.base import BaseMixer
  from lightwood.ensemble.base import BaseEnsemble
  from lightwood.api.types import PredictionArguments
  from lightwood.data.encoded_ds import EncodedDs
  from type_infer.dtype import dtype
  from mindsdb_evaluator import evaluate_accuracies
  from type_infer.helpers import is_nan_numeric
  from lightwood.helpers.log import log
label_desc: Use image node_id 2 for calling the ModeEnsemble obj's underlying member method code with example usage: obj._pick_mode_highest_score(prediction) and returns: max, prediction_counts