Example #1
0
    def blind_test(self, feature_sets, normalize=None):
        """
        This method should predict a value for all testobjects in the list feature_sets, and returns a list with the
        predictions.
        :param feature_sets: list of sub-lists, where the sub-lists are the images to classify.
        :return:
        """

        if self.gui_worker:
            self.gui_worker.gui.status_message.emit("Started blind test...")
        else:
            print('----> Started blind test...')
        classifications = []

        if self.gui_worker:
            self.gui_worker.gui.status_message.emit("Normalizing cases...")
        else:
            print('----> Normalizing cases...')

        if normalize:
            feature_sets = normalize(feature_sets)
        else:
            feature_sets = normalize_images(feature_sets)

        if self.gui_worker:
            self.gui_worker.gui.status_message.emit("Run blind tests...")
        else:
            print('----> Run blind tests...')
        for test_case in feature_sets:
            prediction = self.predictor(test_case)
            classifications.append(prediction.tolist().index(max(prediction)))

        return classifications
Example #2
0
    def play2048_test(self, feature_sets, normalize=None):

        classifications = []

        if normalize:
            feature_sets = normalize(feature_sets)
        else:
            feature_sets = normalize_images(feature_sets)

        for test_case in feature_sets:
            prediction = self.predictor(test_case)
            classifications.append(prediction.tolist())

        return classifications