Пример #1
0
testing_errs_by_percent = {}
auc_by_percent = {}
roc = []
auc = 0.0
k_folds = Preprocess.prepare_k_folds(training_data, k)
percent_list = (5, 10, 15, 20, 30, 50, 80)
for i in range(k):
    tr_data_all, te_data = Preprocess.get_i_fold(k_folds, i)

    for c in percent_list:
        if c not in training_errs_by_percent.keys():
            training_errs_by_percent[c] = []
            testing_errs_by_percent[c] = []
            auc_by_percent[c] = []

        tr_data = Preprocess.get_c_percent(c, tr_data_all)

        tr_n, f_d = np.shape(tr_data[0])
        te_n, = np.shape(te_data[1])
        # TODO prepare distribution
        d = util.init_distribution(len(tr_data[0]))
        # TODO compute thresholds cheat sheet
        thresh_cs = util.pre_compute_threshes_uci(tr_data[0], tr_data[1], threshes)
        boost = b.Boosting(d)
        testing_predict = np.zeros((1, te_n)).tolist()[0]
        training_predict = np.zeros((1, tr_n)).tolist()[0]
        round_tr_err = []
        round_te_err = []
        round_model_err = []
        round_te_auc = []
        converged = False