Example #1
0
    resultRow.append(neg)
    tp_rate = float(true_alerts) / pos
    resultRow.append(tp_rate)
    fp_rate = float(false_alerts) / neg
    resultRow.append(fp_rate)

    resultRow.append(sum(found))
    return resultRow


if __name__ == '__main__':

    ut.list_to_csv(head=head)
    result = []
    df_list = []
    name_list = ut_light.gen_list_title(data_type='bgs')
    for index, name in enumerate(name_list[0:5]):
        for threshold in thresholds:
            ut.checkFolderandCreate("{}\\ROC\\{}".format(main_path, algo_name))
            pickle_ROC_file = '{}\\ROC\\{}\\_{}_threshold{}.pkl'.format(
                main_path, algo_name, name, threshold)
            if not os.path.exists(pickle_ROC_file):
                result = []
                data = ut_light.load_light_select_dataset(input_path=path,
                                                          file_name=name)
                print("##### cal name : {} , threshold = {}  #####".format(
                    name, threshold))
                ROC_row = genROCFile(name=name, data=data, threshold=threshold)
                result.append(ROC_row)
                df = pd.DataFrame(result, columns=ROC_head)
                with open(pickle_ROC_file, 'wb') as output:
Example #2
0
    tp_rate = float(true_alerts) / pos
    resultRow.append(tp_rate)
    fp_rate = float(false_alerts) / neg
    resultRow.append(fp_rate)

    resultRow.append(sum(found))
    return resultRow


if __name__ == '__main__':

    ut.list_to_csv(head=head)
    result = []
    df_list = []
    # name_list = ut_light.gen_list_mix(main_path=dataset_path,data_type='bgs',mix_size="*sq_L3_I30_*")
    name_list = ut_light.gen_list_title(data_type='pca')
    for index, name in enumerate(name_list):
        listWindow = []
        data = ut_light.load_light_select_dataset(input_path=path,
                                                  file_name=name,
                                                  is_mix=is_mix)
        # for index_tran in range(data.get_len_tran()):
        for index_tran in range(2):
            coreSketch = dySketch(alpha_mean=alpha_mean,
                                  alpha_var=alpha_var,
                                  e=e,
                                  w_size=WINDOW_SIZE,
                                  bin_size=bin_size)
            instances = data.get_dataset_test(int(index_tran))
            for i, instance in enumerate(instances):
                if i == len(instances) - 1: