code: def get_predictions(
      learner: Union[
          "skll.learner.Learner", "skll.learner.voting.VotingLearner"
      ],
      xtest: np.ndarray,
  ) -> Dict[str, Any]:
      """
      Get predictions from the given learner (or meta-learner) for given features.
  
      The various types of predictions include:
  
      - "raw" predictions which are self-explanatory for regressors; for
        classifiers, these are the indices of the class labels, not the labels
        themselves.
      - "labels": for classifiers, these are the class labels; for regressors
        they are not applicable and represented as ``None``.
      - "probabilities": for classifiers, these are the class probabilities; for
        non-probabilistic classifiers or regressors, they are not applicable and
        represented as ``None``.
  
      Parameters
      ----------
      learner : Union[:class:`skll.learner.Learner`, :class:`skll.learner.voting.VotingLearner`]
          The already-trained ``Learner`` or ``VotingLearner`` instance that is
          used to generate the predictions.
      xtest : numpy.ndarray
          Numpy array of features on which the predictions are to be made.
  
      Returns
      -------
      prediction_dict : Dict[str, Any]
          Dictionary containing the three types of predictions as the keys
          and either ``None`` or a numpy array as the value.
  
      Raises
      ------
      NotImplementedError
          If the scikit-learn model does not implement ``predict_proba()`` to
          get the class probabilities.
      """
      # deferred import to avoid circular dependencies
      from skll.learner.voting import VotingLearner
  
      # initialize the prediction dictionary
      prediction_dict: Dict[str, Any] = {
          "raw": None,
          "labels": None,
          "probabilities": None,
      }
  
      # first get the raw predictions from the underlying scikit-learn model
      # this works for both classifiers and regressors
      yhat = learner.model.predict(xtest)
      prediction_dict["raw"] = yhat
  
      # next, if it's a classifier ...
      if learner.model_type._estimator_type == "classifier":
          # get the list of labels from the learner (or meta-learner)
          if isinstance(learner, VotingLearner):
              label_list = learner.learners[0].label_list
          else:
              label_list = learner.label_list
  
          # get the predicted class labels
          class_labels = np.array(
              [label_list[int(pred)] for pred in yhat]
          )
          prediction_dict["labels"] = class_labels
  
          # then get the class probabilities too if the learner
          # (or meta-learner) is probabilistic
          if (
              hasattr(learner, "probability") and learner.probability
          ) or (
              hasattr(learner, "voting") and learner.voting == "soft"
          ):
              try:
                  yhat_probs = learner.model.predict_proba(xtest)
              except NotImplementedError as e:
                  learner.logger.error(
                      f"Model type: {learner.model_type.__name__}\n"
                      f"Model: {learner.model}\n"
                  )
                  raise e
              else:
                  prediction_dict["probabilities"] = yhat_probs
  
      return prediction_dict
  
imports: from __future__ import annotations
  import inspect
  import logging
  import sys
  import time
  from collections import Counter, defaultdict
  from csv import DictWriter, excel_tab
  from functools import wraps
  from importlib import import_module
  from pathlib import Path
  from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Optional, Set, Tuple, Type, Union
  import joblib
  import numpy
  import scipy.sparse
  from sklearn.base import BaseEstimator, TransformerMixin
  from sklearn.feature_selection import SelectKBest
  from sklearn.metrics import accuracy_score, confusion_matrix, precision_recall_fscore_support
  from sklearn.model_selection import KFold, LeaveOneGroupOut, ShuffleSplit, StratifiedKFold
  from skll.data import FeatureSet
  from skll.metrics import _CUSTOM_METRICS, _PREDEFINED_CUSTOM_METRICS, use_score_func
  from skll.types import ComputeEvalMetricsResults, ConfusionMatrix, FeaturesetIterator, FoldMapping, IdType, IndexIterator, LabelType, PathOrStr, SparseFeatureMatrix
  from skll.utils.constants import CLASSIFICATION_ONLY_METRICS, CORRELATION_METRICS, REGRESSION_ONLY_METRICS, UNWEIGHTED_KAPPA_METRICS, WEIGHTED_KAPPA_METRICS
  from skll.version import VERSION
label_desc: Use image node_id 8 for calling a global function with example usage: get_predictions(learner, xtest) and returns: prediction_dict