def combine(self, method=DEFAULT_METHOD, with_confidence=False,
                add_confidence=False, add_distribution=False,
                add_count=False, add_median=False, add_min=False,
                add_max=False, options=None):
        """Reduces a number of predictions voting for classification and
           averaging predictions for regression.

           method will determine the voting method (plurality, confidence
           weighted, probability weighted or threshold).
           If with_confidence is true, the combined confidence (as a weighted
           average of the confidences of votes for the combined prediction)
           will also be given.
        """
        # there must be at least one prediction to be combined
        if not self.predictions:
            raise Exception("No predictions to be combined.")

        method = COMBINER_MAP.get(method, COMBINER_MAP[DEFAULT_METHOD])
        keys = WEIGHT_KEYS.get(method, None)
        # and all predictions should have the weight-related keys
        if keys is not None:
            for key in keys:
                if not all([prediction in key for prediction
                            in self.predictions]):
                    raise Exception("Not enough data to use the selected "
                                    "prediction method. Try creating your"
                                    " model anew.")
        if self.is_regression():
            for prediction in self.predictions:
                if prediction['confidence'] is None:
                    prediction['confidence'] = 0
            function = NUMERICAL_COMBINATION_METHODS.get(method,
                                                         self.__class__.avg)
            return function(self, with_confidence=with_confidence,
                            add_confidence=add_confidence,
                            add_distribution=add_distribution,
                            add_count=add_count,
                            add_median=add_median,
                            add_min=add_min,
                            add_max=add_max)
        else:
            if method == THRESHOLD:
                if options is None:
                    options = {}
                predictions = self.single_out_category(options)
            elif method == PROBABILITY:
                predictions = MultiVote([])
                predictions.predictions = self.probability_weight()
            else:
                predictions = self
            return predictions.combine_categorical(
                COMBINATION_WEIGHTS.get(method, None),
                with_confidence=with_confidence,
                add_confidence=add_confidence,
                add_distribution=add_distribution,
                add_count=add_count)
dataset/ETHPy150Open bigmlcom/python/bigml/multivote.py/MultiVote.combine/swapped operands of `in`