(self, data)
return ThresholdClassifier(model, threshold)
Induce a model using the provided `base_learner`, compute probabilities
        on training data and the find the optimal decision thresholds. In case
        of ties, select the threshold that is closest to 0.5.
Induce a model using the provided `base_learner`, compute probabilities
        on training data and the find the optimal decision thresholds. In case
        of ties, select the threshold that is closest to 0.5.
Induce a model using the provided base_learner compute probabilities on training data and the find the optimal decision thresholds . In case of ties select the threshold that is closest to 0 . 5 .
def fit_storage(self, data):
        """
        Induce a model using the provided `base_learner`, compute probabilities
        on training data and the find the optimal decision thresholds. In case
        of ties, select the threshold that is closest to 0.5.
        """
        if not data.domain.class_var.is_discrete \
                or len(data.domain.class_var.values) != 2:
            raise ValueError("ThresholdLearner requires a binary class")

        res = TestOnTrainingData(store_models=True)(data, [self.base_learner])
        model = res.models[0, 0]
        curves = Curves.from_results(res)
        curve = [curves.ca, curves.f1][self.threshold_criterion]()
        # In case of ties, we want the optimal threshold that is closest to 0.5
        best_threshs = curves.probs[curve == np.max(curve)]
        threshold = best_threshs[min(np.searchsorted(best_threshs, 0.5),
                                     len(best_threshs) - 1)]
        return ThresholdClassifier(model, threshold)
def fit_storage ( self , data ) : if not data . domain . class_var . is_discrete or len ( data . domain . class_var . values ) != 2 : raise ValueError ( "ThresholdLearner requires a binary class" ) res = TestOnTrainingData ( store_models = True ) ( data , [ self . base_learner ] ) model = res . models [ 0 , 0 ] curves = Curves . from_results ( res ) curve = [ curves . ca , curves . f1 ] [ self . threshold_criterion ] ( ) # In case of ties, we want the optimal threshold that is closest to 0.5 best_threshs = curves . probs [ curve == np . max ( curve ) ] threshold = best_threshs [ min ( np . searchsorted ( best_threshs , 0.5 ) , len ( best_threshs ) - 1 ) ] return ThresholdClassifier ( model , threshold )