-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_milank.py
More file actions
53 lines (39 loc) · 1.59 KB
/
test_milank.py
File metadata and controls
53 lines (39 loc) · 1.59 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
from util import tree_planter, tree_pprinter, tree_rmse_calc
import time
import pandas as pd
import numpy as np
if __name__ == "__main__":
lin_group = []
cir_group = ['prec', 'tilt']
class_var = 'rad'
print(class_var, lin_group, cir_group)
#for bin_size in [2500, 1800]:
for bin_size in [2500, 2250, 2000, 1750, 1500, 1250, 1000, 750, 500, 250]:
print(bin_size)
df = pd.read_csv("./datasets/milankovitch.csv")
rmse = []
var_desc = {}
for lin_var in lin_group:
var_desc[lin_var] = {"type": "lin", "method": "classic", "bounds": [[-np.inf, np.inf]]}
# 1 Classic
for cir_var in cir_group:
var_desc[cir_var] = {"type": "lin", "method": "classic", "bounds": [[-np.inf, np.inf]]}
time1 = time.time()
tree = tree_planter(df, class_var, var_desc, bin_size, .01)
#tree_pprinter(tree)
rmse.append(tree_rmse_calc(tree, df))
# 2 Our
for cir_var in cir_group:
var_desc[cir_var] = {"type": "cir", "method": "classic", "bounds": [[-np.inf, np.inf]]}
time1 = time.time()
tree = tree_planter(df, class_var, var_desc, bin_size, .01)
#tree_pprinter(tree)
rmse.append(tree_rmse_calc(tree, df))
# 3 Lund
for cir_var in cir_group:
var_desc[cir_var] = {"type": "cir", "method": "subset", "bounds": [[-np.inf, np.inf]]}
time1 = time.time()
tree = tree_planter(df, class_var, var_desc, bin_size, .01)
#tree_pprinter(tree)
rmse.append(tree_rmse_calc(tree, df))
print(rmse)