-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplots_online_exp.py
More file actions
99 lines (81 loc) · 4.05 KB
/
Copy pathplots_online_exp.py
File metadata and controls
99 lines (81 loc) · 4.05 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import pandas as pd
from river import metrics
from Functions.Create_Plots import create_plots
from Functions.Evaluation import evaluation
def take_saved_data(file_name):
df = pd.read_csv(f'../Experiments/Results/{file_name}')
df = df.replace({'True': 1, 'False': 0})
df = df.apply(pd.to_numeric, errors='coerce')
y_real=df.iloc[:, 0].tolist()
y_pred=df.iloc[:, 1].tolist()
data_drifts= [value for value in df.iloc[:, 2].tolist() if pd.notna(value)]
concept_drifts=[value for value in df.iloc[:, 3].tolist() if pd.notna(value)]
return y_real, y_pred, data_drifts, concept_drifts
# create the lists to save the results
y_real = []
y_predicted = []
data_drifts = []
concept_drifts = []
experiment_no = 1
y_real_temp, y_predicted_temp, data_drifts_temp, concept_drifts_temp = take_saved_data(f"experiment{experiment_no}_pipeline1_results.csv")
# add the results from the pipeline in the lists
y_real.append(y_real_temp)
y_predicted.append(y_predicted_temp)
data_drifts.append(data_drifts_temp)
concept_drifts.append(concept_drifts_temp)
y_real_temp, y_predicted_temp, data_drifts_temp, concept_drifts_temp = take_saved_data(f"experiment{experiment_no}_pipeline2_results.csv")
# add the results from the pipeline in the lists
y_real.append(y_real_temp)
y_predicted.append(y_predicted_temp)
data_drifts.append(data_drifts_temp)
concept_drifts.append(concept_drifts_temp)
y_real_temp, y_predicted_temp, data_drifts_temp, concept_drifts_temp = take_saved_data(f"experiment{experiment_no}_pipeline3_results.csv")
# add the results from the pipeline in the lists
y_real.append(y_real_temp)
y_predicted.append(y_predicted_temp)
data_drifts.append(data_drifts_temp)
concept_drifts.append(concept_drifts_temp)
y_real_temp, y_predicted_temp, data_drifts_temp, concept_drifts_temp = take_saved_data(f"experiment{experiment_no}_pipeline4_results.csv")
# add the results from the pipeline in the lists
y_real.append(y_real_temp)
y_predicted.append(y_predicted_temp)
data_drifts.append(data_drifts_temp)
concept_drifts.append(concept_drifts_temp)
y_real_temp, y_predicted_temp, data_drifts_temp, concept_drifts_temp = take_saved_data(f"experiment{experiment_no}_pipeline5_results.csv")
# add the results from the pipeline in the lists
y_real.append(y_real_temp)
y_predicted.append(y_predicted_temp)
data_drifts.append(data_drifts_temp)
concept_drifts.append(concept_drifts_temp)
y_real_temp, y_predicted_temp, data_drifts_temp, concept_drifts_temp = take_saved_data(f"experiment{experiment_no}_pipeline6_results.csv")
# add the results from the pipeline in the lists
y_real.append(y_real_temp)
y_predicted.append(y_predicted_temp)
data_drifts.append(data_drifts_temp)
concept_drifts.append(concept_drifts_temp)
y_real_temp, y_predicted_temp, data_drifts_temp, concept_drifts_temp = take_saved_data(f"experiment{experiment_no}_pipeline7_results.csv")
# add the results from the pipeline in the lists
y_real.append(y_real_temp)
y_predicted.append(y_predicted_temp)
data_drifts.append(data_drifts_temp)
concept_drifts.append(concept_drifts_temp)
y_real_temp, y_predicted_temp, data_drifts_temp, concept_drifts_temp = take_saved_data(f"experiment{experiment_no}_pipeline8_results.csv")
# add the results from the pipeline in the lists
y_real.append(y_real_temp)
y_predicted.append(y_predicted_temp)
data_drifts.append(data_drifts_temp)
concept_drifts.append(concept_drifts_temp)
y_real_temp, y_predicted_temp, data_drifts_temp, concept_drifts_temp = take_saved_data(f"experiment{experiment_no}_pipeline9_results.csv")
# add the results from the pipeline in the lists
y_real.append([None if pd.isna(x) else x for x in y_real_temp])
y_predicted.append([None if pd.isna(x) else x for x in y_predicted_temp])
data_drifts.append(data_drifts_temp)
concept_drifts.append(concept_drifts_temp)
# print(y_real_temp)
# print(y_real[-1])
# Delete the temporal variables
del y_real_temp, y_predicted_temp, data_drifts_temp, concept_drifts_temp
# evaluation of pipelines
evaluates = evaluation(y_real, y_predicted, metrics.Accuracy())
# plots for metrics and drifts of the pipelines
create_plots(evaluates, data_drifts, concept_drifts)