def evaluate_accuracy(clf):
    acc = np.empty(shape=(NUM_ACC_PASSES, 1))
    clf.load_training_data(TRAIN_PATH)
    clf.load_test_data(TEST_PATH)
    cat_labels = clf.testing[1].apply((lambda x: ATTACKS[x]))
    cats = {'U2R': [np.zeros(shape=(NUM_ACC_PASSES, 1)), np.zeros(shape=(NUM_ACC_PASSES, 1))], 'DoS': [np.zeros(shape=(NUM_ACC_PASSES, 1)), np.zeros(shape=(NUM_ACC_PASSES, 1))], 'R2L': [np.zeros(shape=(NUM_ACC_PASSES, 1)), np.zeros(shape=(NUM_ACC_PASSES, 1))], 'Probe': [np.zeros(shape=(NUM_ACC_PASSES, 1)), np.zeros(shape=(NUM_ACC_PASSES, 1))], 'normal': [np.zeros(shape=(NUM_ACC_PASSES, 1)), np.zeros(shape=(NUM_ACC_PASSES, 1))]}
    for i in range(0, NUM_ACC_PASSES):
        clf.train_clf()
        (preds, acc[i]) = clf.test_clf()
        for (cat, pred) in zip(cat_labels, preds):
            cats[cat][(pred == 'normal')][i] += 1
        clf.shuffle_training_data()
    conf = calculate_category_accuracy(cats)
    mean = acc.mean()
    std = acc.std()
    write_acc_to_csv([mean, std], cats, conf, clf.__class__.__name__)
    return [mean, std]
def evaluate_accuracy(clf):
    acc = np.empty(shape=(NUM_ACC_PASSES, 1))
    clf.load_training_data(TRAIN_PATH)
    clf.load_test_data(TEST_PATH)
    cat_labels = clf.testing[1].apply((lambda x: ATTACKS[x]))
    cats = {'U2R': [np.zeros(shape=(NUM_ACC_PASSES, 1)), np.zeros(shape=(NUM_ACC_PASSES, 1))], 'DoS': [np.zeros(shape=(NUM_ACC_PASSES, 1)), np.zeros(shape=(NUM_ACC_PASSES, 1))], 'R2L': [np.zeros(shape=(NUM_ACC_PASSES, 1)), np.zeros(shape=(NUM_ACC_PASSES, 1))], 'Probe': [np.zeros(shape=(NUM_ACC_PASSES, 1)), np.zeros(shape=(NUM_ACC_PASSES, 1))], 'normal': [np.zeros(shape=(NUM_ACC_PASSES, 1)), np.zeros(shape=(NUM_ACC_PASSES, 1))]}
    for i in range(0, NUM_ACC_PASSES):
        clf.train_clf()
        (preds, acc[i]) = clf.test_clf()
        for (cat, pred) in zip(cat_labels, preds):
            cats[cat][(pred == 'normal')][i] += 1
        clf.shuffle_training_data()
    conf = calculate_category_accuracy(cats)
    mean = acc.mean()
    std = acc.std()
    write_acc_to_csv([mean, std], cats, conf, clf.__class__.__name__)
    return [mean, std]