-
Notifications
You must be signed in to change notification settings - Fork 0
/
mean_values.py
54 lines (45 loc) · 2.46 KB
/
mean_values.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
from utils import *
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sn
def main(exp_vals="mean"):
array = pd.read_csv("./csv_laurent.csv")
test_cols = ['Mol_weight', 'Isoelectric_point', 'GRAVY Score',"Y"]
all_res, standard_devs, leaf_nums, best_r2_clf, best_int_clf, train_scores = experiments(array, test_cols, exp_vals)
plt.title("Comparison of the number of leaves for each tree")
sn.heatmap(pd.DataFrame(leaf_nums, index=[f"Depth {i}" for i in range(1, 9)],
columns=[f"Exp {i}" for i in range(1, 6)]), annot=True, fmt='.3g')
plt.savefig("./leaves_number_mean_values.jpg")
plt.close()
X = pd.DataFrame(train_scores[:, 0, :].T, index=["exp1", "exp2", "exp3", "exp4", "exp5"],
columns=[1, 2, 3, 4, 5, 6, 7, 8])
plt.figure(figsize=(20, 10))
plt.title("Comparison of R^2 and RMSE on the training set for each experiments")
sn.heatmap(X, annot=True, cmap='RdBu', vmin=0.2, vmax=0.9, fmt='.3g')
plt.savefig("./training_scores_mean_values.jpg")
plt.close()
X = pd.DataFrame(all_res[:, 0, :], index=["exp1", "exp2", "exp3", "exp4", "exp5"],
columns=[1, 2, 3, 4, 5, 6, 7, 8])
std_matrix = mean_std_matrix(all_res, standard_devs)
Y = all_res[:, 1, :]
plt.figure(figsize=(20, 10))
plt.title("Comparison of R^2 and RMSE for each experiments at each depth")
sn.heatmap(X, annot=False, cmap='RdBu', vmin=0.2, vmax=0.9)
sn.heatmap(X, annot=std_matrix[:, 0, :], annot_kws={'va': 'bottom'}, cbar=False, fmt='', cmap='RdBu')
sn.heatmap(X, annot=Y, annot_kws={'va': 'top'}, fmt='.3g', cbar=False, cmap='RdBu')
plt.savefig("./mean_values_heatmaps.jpg")
plt.close()
X = pd.DataFrame(all_res[:, 2, :], index=["exp1", "exp2", "exp3", "exp4", "exp5"],
columns=[1, 2, 3, 4, 5, 6, 7, 8])
std_matrix = mean_std_matrix(all_res, standard_devs)
Y = all_res[:, 3, :]
plt.figure(figsize=(15, 10))
plt.title("Comparison of interval R^2 and RMSE for each experiments at each depth")
sn.heatmap(X, annot=False, cmap='RdBu', vmin=0.2, vmax=0.9)
sn.heatmap(X, annot=std_matrix[:, 2, :], annot_kws={'va': 'bottom'}, fmt='', cbar=False, cmap='RdBu', vmin=0.2,
vmax=0.9)
sn.heatmap(X, annot=Y, annot_kws={'va': 'top'}, fmt='.3g', cbar=False, cmap='RdBu', vmin=0.2, vmax=0.9)
plt.savefig("./mean_values_interval_heatmaps.jpg")
if __name__ == "__main__":
exp_vals = "mean"
main(exp_vals)