-
Notifications
You must be signed in to change notification settings - Fork 5
/
get_result.py
62 lines (46 loc) · 1.74 KB
/
get_result.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import numpy as np
from scipy import stats
#single_log_without_bp.txt
#single_log_with_bp_without_clustring1_200.txt
#single_log_with_bp1_200.txt
#single_log_with_bp1_80.txt
#single_log_without_bp_80.txt
#single_log_with_bp_without_clustring1_80.txt
import random
def GetResult(st):
name = "./log_folder/final_log_folder/" + st
file_ob = open(name, "r+")
stlis = file_ob.readlines()
stlis = [ item.rstrip().split(' ') for item in stlis ]
#print(len(stlis))
stlis = random.sample( stlis, 15)
result_lis = [[float(item[1]), float(item[2])] for item in stlis]
result_arr = np.array(result_lis)
print(result_arr)
mean = np.mean(result_arr, axis = 0)
stdevs = np.std(result_arr, axis=0)
return mean, stdevs
def GiveTTestResult(st1, st2):
name1 = "./log_folder/final_log_folder/" + st1
name2 = "./log_folder/final_log_folder/" + st2
file_ob = open(name1, "r+")
stlis = file_ob.readlines()
stlis = [item.rstrip().split(' ') for item in stlis]
# print(len(stlis))
stlis = random.sample(stlis, 15)
result_lis = [[float(item[1]), float(item[2])] for item in stlis]
result_arr1 = np.array(result_lis)
file_ob = open(name2, "r+")
stlis = file_ob.readlines()
stlis = [item.rstrip().split(' ') for item in stlis]
# print(len(stlis))
stlis = random.sample(stlis, 15)
result_lis = [[float(item[1]), float(item[2])] for item in stlis]
result_arr2 = np.array(result_lis)
arr1 = result_arr1[:, 1]
arr2 = result_arr2[:, 1]
#print(arr1, arr2)
t_val, p_val = stats.ttest_rel(arr1, arr2)
return t_val, p_val
print(GetResult("single_log_without_bp_80.txt"))
#print(GiveTTestResult("single_log_without_bp.txt", "single_log_with_bp_without_clustring1_80.txt"))