Ejemplo n.º 1
0
    def test_final_model(self, X, y):
        """
        Test the (already trained) model pipeline on the provided test data
        (X and y). Store the test judgment metric and return the rest of the
        metrics as a hierarchical dictionary.
        """
        # time the prediction
        start_time = time.time()
        total = time.time() - start_time
        self.avg_predict_time = old_div(total, float(len(y)))

        # TODO: this is hacky. See https://github.com/HDI-Project/ATM/issues/48
        binary = self.num_classes == 2
        kwargs = {}
        if self.verbose_metrics:
            kwargs['include_curves'] = True
            if not binary:
                kwargs['include_per_class'] = True

        # compute the actual test scores!
        test_scores = test_pipeline(self.pipeline, X, y, binary, **kwargs)

        # save meta-metrics
        self.test_judgment_metric = test_scores.get(self.judgment_metric)

        return test_scores
Ejemplo n.º 2
0
    def test_final_model(self, X, y):
        """
        Test the (already trained) model pipeline on the provided test data (X
        and y). Store the test judgment metric and return the rest of the
        metrics as a hierarchical dictionary.
        """
        # time the prediction
        starttime = time.time()
        y_preds = self.pipeline.predict(X)

        binary = self.num_classes == 2
        test_scores = test_pipeline(self.pipeline, X, y, binary)

        total = time.time() - starttime
        self.avg_prediction_time = total / float(len(y))
        self.test_judgment_metric = test_scores.get(self.judgment_metric)

        return test_scores