self.scores = {} self.score(val_data, user_ls) vbf_dict = self.scores results = {u:evaluate_threshold(self.thresh[u], vbf_dict[u]) for u in (user_ls if (user_ls != None) else self.thresh.keys())} return results if __name__=='__main__': from CV import CV from preprocessor import split_samples, load_data, filter_users_val P.np.seterr(all='ignore') all_data, pkd = filter_users_val(split_samples(load_data())) for u in all_data.keys(): if all_data[u] == []: del all_data[u] del pkd[u] gbfa = CV(lambda: GammaBFAuth(all_data), all_data, pkd) with open('./bf_result.csv', 'rw+') as res_file: result_writer = csv.writer(res_file) result_writer.writerow(['user', 'CV_IPR', 'CV_FRR', 'CV_GT', 'CV_IT'])
if __name__=='__main__': """ test_data = {'a' : [coll.defaultdict(list, {'aa' : range(10,100,10), 'ab' : range(1,10)}), coll.defaultdict(list, {'ac' : range(1,10,2), 'aa' : [2,2,2]}), coll.defaultdict(list, {'ad' : range(10, 20, 3)}) ], 'b' : [coll.defaultdict(list, {'ba' : range(1,20,3), 'bb' : range(1,15)}), coll.defaultdict(list, {'bc' : range(2,20,4)}), coll.defaultdict(list, {'bd' : range(50,300,150)}) ], } """ test_data = pp.split_samples(pp.load_data()) for u in test_data.keys(): if u not in {'9999999','SERLHOU'}: del test_data[u] print test_data.keys() test_cv = CV(DensityAuth, test_data) ''' for i in test_cv.partition_data('shit', test_data['a'], 1): f**k.pprint(i) ''' for i in test_cv.validate(): pass print "DONESKI"