class_docstr: Wrap ``VotingClassifier`` and ``VotingRegressor`` from scikit-learn.
  
  Note that this class does not inherit from the ``Learner`` class but rather
  uses different ``Learner`` instances underlyingly.
  
  Parameters
  ----------
  learner_names : List[str]
      List of the learner names that will participate in the voting process.
  voting : Optional[str], default="hard"
      One of "hard" or "soft". If "hard", the predicted class labels
      are used for majority rule voting. If "soft", the predicted class
      label is based on the argmax of the sums of the predicted
      probabilities from each of the underlying learnrs. This parameter
      is only relevant for classification.
  custom_learner_path : Optional[:class:`skll.types.PathOrStr`], default=None
      Path to a Python file containing the definitions of any custom
      learners. Any and all custom learners in ``estimator_names`` must
      be defined in this file. If the custom learner does not inherit
      from an already existing scikit-learn estimator, it must explicitly
      define an `_estimator_type` attribute indicating whether it's a
      "classifier" or a "regressor".
  feature_scaling : str, default="none"
      How to scale the features, if at all for each estimator. Options are
      -  "with_std": scale features using the standard deviation
      -  "with_mean": center features using the mean
      -  "both": do both scaling as well as centering
      -  "none": do neither scaling nor centering
  pos_label : Optional[:class:`skll.types.LabelType`], default=None
      A string denoting the label of the class to be
      treated as the positive class in a binary classification
      setting, for each estimator. If ``None``, the class represented
      by the label that appears second when sorted is chosen as the
      positive class. For example, if the two labels in data are "A"
      and "B" and ``pos_label`` is not specified, "B" will
      be chosen as the positive class.
  min_feature_count : int, default=1
      The minimum number of examples a feature must have a nonzero
      value in to be included, for each estimator.
  model_kwargs_list : Optional[List[Dict[str, Any]]], default=None
      A list of dictionaries of keyword arguments to pass to the
      initializer for each of the estimators. There's a one-to-one
      correspondence between the order of this list and the order
      of the ``learner_names`` list.
  sampler_list : Optional[List[str]], default=None
      The samplers to use for kernel approximation, if desired, for each
      estimator. Valid values are:
      -  "AdditiveChi2Sampler"
      -  "Nystroem"
      -  "RBFSampler"
      -  "SkewedChi2Sampler"
      There's a one-to-one correspondence between the order of this list
      and the order of the ``learner_names`` list.
  sampler_kwargs_list : Optional[List[Dict[str, Any]]], default=None
      A list of dictionaries of keyword arguments to pass to the
      initializer for the specified sampler, one per estimator.
      There's a one-to-one correspondence between the order of this
      list and the order of the ``learner_names`` list.
  logger : Optional[logging.Logger], default=None
      A logging object. If ``None`` is passed, get logger from ``__name__``.
docstr: Generate predictions with meta-estimator.
  
  Compute the predictions from the meta-estimator and, optionally, the
  underlying estimators on given ``FeatureSet``. The predictions are
  also written to disk if ``prediction_prefix`` is not ``None``.
  
  For regressors, the returned and written-out predictions are identical.
  However, for classifiers:
  
  - if ``class_labels`` is ``True``, class labels are returned as well as
    written out.
  
  - if ``class_labels`` is ``False`` and the classifier is probabilistic
    (i.e., ``self.probability`` is ``True``), class probabilities are
    returned as well as written out.
  
  - if ``class_labels`` is ``False`` and the classifier is non-probabilistic
    (i.e., ``self..probability`` is ``False``), class indices are returned
    and class labels are written out. This option is generally only
    meant for SKLL-internal use.
  
  Parameters
  ----------
  examples : :class:`skll.data.featureset.FeatureSet`
      The ``FeatureSet`` instance to predict labels for.
  prediction_prefix : Optional[str], default=None
      If saving the predictions, this is the prefix that will be used for
      the filename. It will be followed by ``"_predictions.tsv"``
  append : bool, default=False
      Should we append the current predictions to the file if it exists?
  class_labels : bool, default=True
      For classifier, should we convert class indices to their (str) labels
      for the returned array? Note that class labels are always written out
      to disk.
  individual_predictions : bool, default=False
      Return (and, optionally, write out) the predictions from each
      underlying learner.
  
  Returns
  -------
  Tuple[numpy.ndarray, Optional[Dict[str, numpy.ndarray]]]
      The first element is the array of predictions returned by the
      meta-estimator and the second is an optional dictionary with the
      name of each underlying learner as the key and the array of its
      predictions as the value. The second element is ``None`` if
      ``individual_predictions`` is set to ``False``.
docstr_tok: ["Generate","predictions","with","meta-estimator",".","Compute","the","predictions","from","the","meta-estimator","and",",","optionally",",","the","underlying","estimators","on","given","``","FeatureSet","``",".","The","predictions","are","also","written","to","disk","if","``","prediction_prefix","``","is","not","``","None","``",".","For","regressors",",","the","returned","and","written-out","predictions","are","identical",".","However",",","for","classifiers",":","-","if","``","class_labels","``","is","``","True","``",",","class","labels","are","returned","as","well","as","written","out",".","-","if","``","class_labels","``","is","``","False","``","and","the","classifier","is","probabilistic","(","i.e.",",","``","self.probability","``","is","``","True","``",")",",","class","probabilities","are","returned","as","well","as","written","out",".","-","if","``","class_labels","``","is","``","False","``","and","the","classifier","is","non-probabilistic","(","i.e.",",","``","self","..","probability","``","is","``","False","``",")",",","class","indices","are","returned","and","class","labels","are","written","out",".","This","option","is","generally","only","meant","for","SKLL-internal","use",".","Parameters","--","--","--","--","--","examples",":",":","class",":","`","skll.data.featureset.FeatureSet","`","The","``","FeatureSet","``","instance","to","predict","labels","for",".","prediction_prefix",":","Optional","[","str","]",",","default=None","If","saving","the","predictions",",","this","is","the","prefix","that","will","be","used","for","the","filename",".","It","will","be","followed","by","``","``","_predictions.tsv","''","``","append",":","bool",",","default=False","Should","we","append","the","current","predictions","to","the","file","if","it","exists","?","class_labels",":","bool",",","default=True","For","classifier",",","should","we","convert","class","indices","to","their","(","str",")","labels","for","the","returned","array","?","Note","that","class","labels","are","always","written","out","to","disk",".","individual_predictions",":","bool",",","default=False","Return","(","and",",","optionally",",","write","out",")","the","predictions","from","each","underlying","learner",".","Returns","--","--","--","-","Tuple","[","numpy.ndarray",",","Optional","[","Dict","[","str",",","numpy.ndarray","]","]","]","The","first","element","is","the","array","of","predictions","returned","by","the","meta-estimator","and","the","second","is","an","optional","dictionary","with","the","name","of","each","underlying","learner","as","the","key","and","the","array","of","its","predictions","as","the","value",".","The","second","element","is","``","None","``","if","``","individual_predictions","``","is","set","to","``","False","``","."]
code: def predict(
      self,
      examples: FeatureSet,
      prediction_prefix: Optional[str] = None,
      append: bool = False,
      class_labels: bool = True,
      individual_predictions: bool = False,
  ) -> Tuple[np.ndarray, Optional[Dict[str, np.ndarray]]]:
      """
      Generate predictions with meta-estimator.
  
      Compute the predictions from the meta-estimator and, optionally, the
      underlying estimators on given ``FeatureSet``. The predictions are
      also written to disk if ``prediction_prefix`` is not ``None``.
  
      For regressors, the returned and written-out predictions are identical.
      However, for classifiers:
  
      - if ``class_labels`` is ``True``, class labels are returned as well as
        written out.
  
      - if ``class_labels`` is ``False`` and the classifier is probabilistic
        (i.e., ``self.probability`` is ``True``), class probabilities are
        returned as well as written out.
  
      - if ``class_labels`` is ``False`` and the classifier is non-probabilistic
        (i.e., ``self..probability`` is ``False``), class indices are returned
        and class labels are written out. This option is generally only
        meant for SKLL-internal use.
  
      Parameters
      ----------
      examples : :class:`skll.data.featureset.FeatureSet`
          The ``FeatureSet`` instance to predict labels for.
      prediction_prefix : Optional[str], default=None
          If saving the predictions, this is the prefix that will be used for
          the filename. It will be followed by ``"_predictions.tsv"``
      append : bool, default=False
          Should we append the current predictions to the file if it exists?
      class_labels : bool, default=True
          For classifier, should we convert class indices to their (str) labels
          for the returned array? Note that class labels are always written out
          to disk.
      individual_predictions : bool, default=False
          Return (and, optionally, write out) the predictions from each
          underlying learner.
  
      Returns
      -------
      Tuple[numpy.ndarray, Optional[Dict[str, numpy.ndarray]]]
          The first element is the array of predictions returned by the
          meta-estimator and the second is an optional dictionary with the
          name of each underlying learner as the key and the array of its
          predictions as the value. The second element is ``None`` if
          ``individual_predictions`` is set to ``False``.
      """
      example_ids = examples.ids
  
      # get the test set features in the right format
      if isinstance(examples.vectorizer, DictVectorizer):
          xtest = examples.vectorizer.inverse_transform(
              examples.features
          )
  
      # get all possible kinds of predictions from the meta-learner
      prediction_dict = get_predictions(self, xtest)
  
      # decide what predictions to write and what predictions to return
      # by default, these are just what is output by the model
      to_write = prediction_dict["raw"]
      to_return = prediction_dict["raw"]
  
      # for classifiers ...
      if self.learner_type == "classifier":
          # return and write class labels if they were explicitly asked for
          if class_labels:
              to_return = to_write = prediction_dict["labels"]
          else:
              # return and write probabilities
              if self.voting == "soft":
                  to_return = to_write = prediction_dict[
                      "probabilities"
                  ]
              # return class indices and write labels
              else:
                  to_return = prediction_dict["raw"]
                  to_write = prediction_dict["labels"]
  
      # for regressors, it's really simple
      else:
          to_write = to_return = prediction_dict["raw"]
  
      # write out the meta-estimator predictions if we are asked to
      if prediction_prefix is not None:
          write_predictions(
              example_ids,
              to_write,
              prediction_prefix,
              self.learner_type,
              self.learners[0].label_list,
              append=append,
          )
  
      # get and write each underlying learner's predictions if asked for
      if individual_predictions:
          # create a dictionary to hold the individual predictions
          individual_predictions_dict = {}
  
          # iterate over each underlying learner along with names
          for name, learner in zip(
              self.model.named_estimators_, self.learners
          ):
              # the learner's `predict()` method should handle everything
              learner_prediction_prefix = (
                  f"{prediction_prefix}_{name}"
                  if prediction_prefix is not None
                  else None
              )
              learner_predictions = learner.predict(
                  examples,
                  prediction_prefix=learner_prediction_prefix,
                  append=append,
                  class_labels=class_labels,
              )
  
              # save this estimator's predictions in the dictionary
              individual_predictions_dict[name] = learner_predictions
      else:
          individual_predictions_dict = None
  
      # return the tuple of the meta-estimator predictions array
      # and the dictionary containing the individual predictions
      return (to_return, individual_predictions_dict)
  
imports: import copy
  import logging
  from importlib import import_module
  from itertools import zip_longest
  from multiprocessing import cpu_count
  from typing import Any, Dict, List, Optional, Tuple, Union
  import joblib
  import numpy
  from sklearn.ensemble import VotingClassifier, VotingRegressor
  from sklearn.utils import shuffle
  from sklearn.utils.multiclass import type_of_target
  from skll.data import FeatureSet
  from skll.data.dict_vectorizer import DictVectorizer
  from skll.learner import Learner
  from skll.types import EvaluateTaskResults, FoldMapping, LabelType, LearningCurveSizes, PathOrStr, VotingCrossValidateTaskResults
  from skll.utils.constants import MAX_CONCURRENT_PROCESSES
  from .utils import _load_learner_from_disk, _save_learner_to_disk, add_unseen_labels, compute_evaluation_metrics, get_acceptable_classification_metrics, get_acceptable_regression_metrics, get_predictions, setup_cv_fold_iterator, setup_cv_split_iterator, train_and_score, write_predictions
label_desc: Use image node_id 10 for calling the VotingLearner obj's underlying member method code with example usage: obj.predict(examples, prediction_prefix, append, class_labels, individual_predictions) and returns: to_return,  individual_predictions_dict