Ejemplo n.º 1
0
#        test_data = DataProvider(TEST_FILE_NAME, TEST_INIT_DATA_FILE_NAME).get_data()
#        assert(calc_class_re())
        app = QApplication(sys.argv)
        data = dataProvider.get_data()
#        print data
        classifier = c45(data, max_repeat_var=10)
        form = MainWindow(data, classifier)

##        print data
#        classifier = c45(data, max_repeat_var=10)
#        pos_sum = 0
#        for row, target in zip(data.data, data.target):
#            pos = 0
#            for l, c in classifier.get_labels_count(row).items():
#                pos += 1
#                if l == target:
#                    pos_sum += pos
#                    print pos
#            else:
#                print "=========="
#        print "---------------"
#        print pos_sum / data.n_samples
        print get_classification_error(classifier.get_likely_label, data)
        form.show()
        code = app.exec_()
        dataProvider.save()
        sys.exit(code)
#    except Exception as e:
#        log.error(e.message)
#        raise e
Ejemplo n.º 2
0
def error_of_likely_class_is(step, error):
    got = get_classification_error(world.c45.get_likely_label, world.data_set)
    assert got == float(error), "correct classification error"
Ejemplo n.º 3
0
def error_less_or_eq_for_set(step, error, ds):
    data_set = world.tr_set if ds == "training" else world.tst_set
    got = get_classification_error(world.c45.get_likely_label, data_set)
    assert  got <= float(error), "correct classification error"
Ejemplo n.º 4
0
def try_to_calc_error(step):
    world.was_exception = False
    try:
        world.error = get_classification_error(world.classifier, world.data_set)
    except Exception:
        world.was_exception = True