コード例 #1
0
ファイル: tests.py プロジェクト: xflows/cf_noise_detection
    def test_two_filters(self):
        """ Tests saturation_filter (normal and prune) and classification_filter
        """

        import cf_noise_detection.library as l
        import cf_weka.classification as c

        learner = c.j48()

        data = ut.load_UCI_dataset("iris")

        inp_dict = {'data': data, 'satur_type': 'normal'}
        out_dict = l.saturation_filter(inp_dict, None)

        self.assertGreaterEqual(len(out_dict.keys()), 1)

        inp_dict = {'data': data, 'satur_type': 'prune'}
        out_dict = l.saturation_filter(inp_dict, None)

        self.assertGreaterEqual(len(out_dict.keys()), 1)

        inp_dict = {
            'learner': learner,
            'data': data,
            'timeout': 60.0,
            'k_folds': 10
        }

        out_dict = l.classification_filter(inp_dict, None)

        self.assertGreaterEqual(len(out_dict.keys()), 1)
コード例 #2
0
ファイル: tests.py プロジェクト: xflows/cf_noise_detection
    def test_two_filters(self):
        """ Tests saturation_filter (normal and prune) and classification_filter
        """

        import cf_noise_detection.library as l
        import cf_weka.classification as c

        learner = c.j48()

        data = ut.load_UCI_dataset("iris")

        inp_dict = {'data': data, 'satur_type': 'normal'}
        out_dict = l.saturation_filter(inp_dict, None)

        self.assertGreaterEqual(len(out_dict.keys()), 1)

        inp_dict = {'data': data, 'satur_type': 'prune'}
        out_dict = l.saturation_filter(inp_dict, None)

        self.assertGreaterEqual(len(out_dict.keys()), 1)

        inp_dict = {'learner': learner, 'data': data, 'timeout': 60.0, 'k_folds': 10}

        out_dict = l.classification_filter(inp_dict, None)

        self.assertGreaterEqual(len(out_dict.keys()), 1)
コード例 #3
0
ファイル: tests.py プロジェクト: xflows/cf_noise_detection
    def test_noise_rank(self):
        """Tests noise rank widget
        """
        import cf_noise_detection.library as l
        import cf_weka.classification as c

        learner = c.j48()

        data = ut.load_UCI_dataset("iris")

        inp_dict = {'learner': learner, 'data': data, 'timeout': 60.0, 'k_folds': 10}

        out_dict = l.classification_filter(inp_dict, None)

        inp_dict = {'noise': [out_dict['noise_dict']],
                    'data': data}

        out_dict = l.noiserank(inp_dict)

        self.assertGreaterEqual(len(out_dict['allnoise']), 1)
コード例 #4
0
ファイル: tests.py プロジェクト: xflows/cf_noise_detection
    def test_noise_rank(self):
        """Tests noise rank widget
        """
        import cf_noise_detection.library as l
        import cf_weka.classification as c

        learner = c.j48()

        data = ut.load_UCI_dataset("iris")

        inp_dict = {
            'learner': learner,
            'data': data,
            'timeout': 60.0,
            'k_folds': 10
        }

        out_dict = l.classification_filter(inp_dict, None)

        inp_dict = {'noise': [out_dict['noise_dict']], 'data': data}

        out_dict = l.noiserank(inp_dict)

        self.assertGreaterEqual(len(out_dict['allnoise']), 1)
コード例 #5
0
    def test_classification_learners(self):
        """ Tests creating classification learners from the classification.py file
        :return: a list of learners, i.e. WekaClassifier objects
        """

        lrn = []
        num_exceptions = 0
        try:
            lrn.append(c.logistic())
            lrn.append(c.j48())
            lrn.append(c.rep_tree())
            lrn.append(c.random_forest())
            lrn.append(c.random_tree())
            lrn.append(c.rules_zeror())
            lrn.append(c.rules_jrip())
            lrn.append(c.ibk())
            lrn.append(c.k_star())
            lrn.append(c.naive_bayes())
            lrn.append(c.multilayer_perceptron())
            lrn.append(c.smo())

        except Exception, e:
            num_exceptions += 1
            print "Exception: " + str(e)