-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathfinal_plots.py
62 lines (49 loc) · 2.32 KB
/
final_plots.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
62
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from src.suggested_plots import *
results_mean = pd.DataFrame(columns = ["mean_of_means", "mean_of_biases", "mean_of_miss_percent", "mean_of_std", "mean_of_accuracy_a", "mean_of_accuracy_b"])
results_std = pd.DataFrame(columns = ["std_of_means", "std_of_biases", "std_of_miss_percent", "std_of_std", "std_of_accuracy_a", "std_of_accuracy_b"])
dic_m = {}
dic_s = {}
for i_mcar in [0, 10, 20]:
for i_mar in [0, 10, 20]:
for i_mnar in [0, 10, 20]:
if i_mcar == 0 and i_mar == 0 and i_mnar == 0:
continue
csv_name = "./csvs/MCAR:" + str(i_mcar) + "_" + "MAR:" + str(i_mar) + "_" + "MNAR:" + str(i_mnar) + ".csv"
df = pd.read_csv(csv_name)
# print(df.head(3))
n = df.shape[1]
# print(n, df.dtypes)
m = [0] * (n - 1)
s = [0] * (n - 1)
idx = 0
for i in range(0, n):
if i == 2:
continue
m[idx] = df.iloc[:, i].mean()
s[idx] = df.iloc[:, i].std()
idx += 1
# print(m)
# print(s)
series_m = pd.Series({"mean_of_means": m[0], "mean_of_biases": m[1], "mean_of_miss_percent": m[2], "mean_of_std": m[3], "mean_of_accuracy_a": m[4], "mean_of_accuracy_b": m[5]})
results_mean = pd.concat([results_mean, series_m.to_frame().T], ignore_index=True)
series_s = pd.Series({"std_of_means": s[0], "std_of_biases": s[1], "std_of_miss_percent": s[2], "std_of_std": s[3], "std_of_accuracy_a": s[4], "std_of_accuracy_b": s[5]})
results_std = pd.concat([results_std, series_s.to_frame().T], ignore_index=True)
tup = (i_mcar, i_mar, i_mnar)
dic_m[tup] = m
dic_s[tup] = s
# print(results_mean)
# print(dic_s)
txt_name = "./coverage_rates.txt"
coverage_rates = pd.read_csv(txt_name, delim_whitespace=True)
coverage_rates.drop(coverage_rates.columns[[0]], axis = 1, inplace=True)
# print(df)
true_mean = 0.0963602811950791
true_std = 0.01406412813767362
true_acc = 0.935672514619883
# Final plots
# print(results_mean.iloc[:, 5])
# barplot_type1(dic_m, dic_s, x_axis_miss_type="MNAR", legend_miss_type="MAR", title_miss_type="MCAR", percentage=20, column=3)
barplot_type3(dic_m, true_acc)