-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathparams.py
171 lines (154 loc) · 4.17 KB
/
params.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
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
import numpy as np
# procedure
procedure_params: dict = {
"construct_fp": True,
"multiprocessing": False, # cv for multiple models
"model": "xgb",
"train": False,
"hyperparametrize": False, # and trains
"predict": False,
"feature_reduction": False,
}
# fingerprint
"""
Unicode commands for singles:
phi (flexibility) = '\u03A6'
sigma (symmetry) = '\u03C3'
epsilon^2D (2D eccentricity) = '\u03B5\u00B2\u1d30'
epsilon^3D (3D eccentricity) = '\u03B5\u00B3\u1d30'
q^3D (3D asphericity) = '\U0001D45E\u00B3\u1d30'
w (Wiener index) = '\U0001D464'
m (mass) = '\U0001D45A'
2&6 = number of halogens at 2,6 position of biphenyl (singles)
"""
fp_params: dict = {
"data_path": "./datasets/jain/jain.csv",
"smiles_name": "SMILES",
"labels": {
"groups": [
"X",
"Y",
"YY",
"YYY",
"YYYY",
"YYYYY",
"Z",
"ZZ",
"YZ",
"YYZ",
"YYYZ",
"",
"RG",
"AR",
"BR2",
"BR3",
"FU",
"BIP",
],
"singles": [
"\u03A6",
"\u03C3",
"\u03B5\u00B2\u1d30",
"\U0001D45E\u00B3\u1d30",
"\U0001D464",
"\U0001D45A",
],
},
"fp_type": "upper",
"fp_path": "upper_jain_3d_mass_w.csv",
"d_path": "upper_jain_3d_mass_w.pkl",
}
# dataset
data_params: dict = {
"fp_path": "upper_jain_3d_mass_w.csv",
"target_path": "./datasets/jain/jain.csv",
"target_name": "Tm(K) EXP",
}
# split train, test
split_params: dict = {
"split": {"train": 0.9, "test": 0.1},
"random_state": 123,
"tt_indices_path": "",
"train_indices": np.array([]),
"test_indices": np.array([]),
}
# model and results save/load
save_load_params: dict = {
"save_model": False,
"load_model": False,
"save_model_path": "",
"load_model_path": "",
"train_fp_path": "upper_jain_3d_mass_w.csv",
"npz_train_path": "train",
"npz_test_path": "test",
}
# multiprocessing (e.g., cross validation)
multiprocess_params: dict = {
"n_splits": 10,
"random_state": 123,
"shuffle": True,
}
### ridge regression model params ###
# train params
lr_train_params: dict = {"alpha": 0.5}
# hyperparameter search
lr_hyper_params: list = [
{"alpha": np.logspace(-6, 6, 13)},
]
### xgb model params ###
# initial train params
xgb_train_params: dict = {
"learning_rate": 0.03, # default = 0.3
"n_estimators": 10000, # default = 100
"objective": "reg:squarederror",
}
# hyperparameter search
xgb_hyper_params: list = [
{
"max_depth": np.arange(1, 11), # (0, inf), default = 3
"min_child_weight": [0, 1, 10, 100, 1000], # [0, inf), default = 1
},
{"gamma": [0, 1, 10, 100, 1000],}, # [0, inf), default = 0
{
"subsample": np.linspace(0.1, 1, 10), # (0, 1], default = 1
"colsample_bytree": np.linspace(0.1, 1, 10), # (0, 1], default = 1
},
{"alpha": [0, 0.001, 0.01, 0.1, 1],}, # [0,inf), default = 0
]
# final train params if hyperparameter search
xgb_train_params_final: dict = {
"learning_rate": 0.01, # default = 0.3
"n_estimators": 10000, # default = 100
"objective": "reg:squarederror",
}
# logger configuration
logging_config: dict = {
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"standard": {"format": "%(asctime)s - %(name)s - %(levelname)s - %(message)s"},
},
"handlers": {
"default": {
"level": "DEBUG",
"formatter": "standard",
"class": "logging.StreamHandler",
"stream": "ext://sys.stdout", # Default is stderr
},
"info": {
"level": "INFO",
"formatter": "standard",
"class": "logging.handlers.RotatingFileHandler",
"filename": "./src/tmp/info.log",
"mode": "w",
},
},
"loggers": {
"": { # root logger
"handlers": ["default", "info"],
"level": "INFO",
"propagate": False,
},
"my.packg": {"handlers": ["default"], "level": "WARN", "propagate": False},
},
}