def weighted_confidence(self, combined_prediction, weight_label):
        """Compute the combined weighted confidence from a list of predictions

        """
        predictions = [prediction for prediction in self.predictions \
            if prediction['prediction'] == combined_prediction]
        if (weight_label is not None and
                (not isinstance(weight_label, basestring) or
                 any([not 'confidence' or weight_label not in prediction
                      for prediction in predictions]))):
            raise ValueError("Not enough data to use the selected "
                             "prediction method. Lacks %s information." %
                             weight_label)
        final_confidence = 0.0
        total_weight = 0.0
        weight = 1
        for prediction in predictions:
            if weight_label is not None:
                weight = prediction[weight_label]
            final_confidence += weight * prediction['confidence']
            total_weight += weight
        final_confidence = (final_confidence / total_weight
                            if total_weight > 0 else float('nan'))
        return combined_prediction, final_confidence
dataset/ETHPy150Open bigmlcom/python/bigml/multivote.py/MultiVote.weighted_confidence/original