-
Notifications
You must be signed in to change notification settings - Fork 0
/
constants.py
120 lines (113 loc) · 4.1 KB
/
constants.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
from pathlib import Path
from sklearn.ensemble import RandomForestRegressor, AdaBoostRegressor, GradientBoostingRegressor, ExtraTreesRegressor
from sklearn.linear_model import LinearRegression
from sklearn.neighbors import KNeighborsRegressor
from sklearn.svm import SVR
from sklearn.tree import DecisionTreeRegressor, ExtraTreeRegressor
from skopt.space import Real, Integer, Categorical
from xgboost import XGBRegressor, XGBRFRegressor
CONSTITUENT_CHEMICAL_ELEMENTS = [
'C', 'Si', 'Mn', 'Mg', 'Cu', 'Ni', 'Mo',
'S', 'P', 'V', 'Cr', 'Ti', 'Sn', 'Al'
]
INPUT_DATA_COLUMNS = [
'C', 'Si', 'Mn', 'Mg', 'Cu', 'Ni', 'Mo',
'S', 'P', 'V', 'Cr', 'Ti', 'Sn', 'Al',
'aust_temp', 'aust_czas',
'ausf_temp', 'ausf_czas',
'thickness'
]
DATA_COLUMNS_TO_DELETE = [
'S', 'P', 'V', 'Cr', 'Ti', 'Sn', 'Al'
]
OUTPUT_DATA_COLUMNS = ['Rm', 'Rp02', 'A5', 'HB', 'K']
DATA_PATH = 'data/Dane_zeliwa.xlsx'
RESULTS_PATH = Path('results')
RESULTS_PATH.mkdir(exist_ok=True)
MODELS_DICT = {
'lin': LinearRegression(),
'dt': DecisionTreeRegressor(random_state=7),
'etr': ExtraTreeRegressor(random_state=7),
'rf': RandomForestRegressor(random_state=7, verbose=0),
'efr': ExtraTreesRegressor(random_state=7, verbose=0),
'svr': SVR(verbose=0),
'knn': KNeighborsRegressor(),
'ab': AdaBoostRegressor(random_state=7),
'gb': GradientBoostingRegressor(random_state=7),
'xgb': XGBRegressor(random_state=7),
'xgbf': XGBRFRegressor(random_state=7)
}
PARAMS_BAYESIAN_SEARCH = {
'gb': [
Integer(10, 500, name='n_estimators'),
Categorical([None, 2, 3, 4, 5, 10, 15, 20], name='max_depth'),
Integer(2, 20, name='min_samples_split'),
Integer(1, 20, name='min_samples_leaf'),
Categorical(['sqrt', 'log2', None, 1, 3, 5, 10], name='max_features'),
Real(0.01, 0.7, name='learning_rate')
]
}
PARAMS_GRID_SEARCH = {
'lin': {
'model__fit_intercept': [True, False],
},
'dt': {
'model__max_depth': [None, 2, 3, 5, 10, 15],
'model__min_samples_split': [2, 5, 15],
'model__min_samples_leaf': [1, 2, 4, 8],
'model__max_features': ['sqrt', 'log2', None, 1]
},
'etr': {
'model__max_depth': [None, 2, 3, 5, 10, 15],
'model__min_samples_split': [2, 5, 15],
'model__min_samples_leaf': [1, 2, 4, 8],
'model__max_features': ['sqrt', 'log2', None, 1]
},
'rf': {
'model__n_estimators': [10, 100, 200, 500],
'model__max_depth': [None, 2, 3, 4, 5, 10, 15],
'model__min_samples_split': [2, 5, 15],
'model__min_samples_leaf': [1, 2, 4, 8],
'model__max_features': ['sqrt', 'log2', None, 1]
},
'efr': {
'model__n_estimators': [10, 100, 200, 500],
'model__max_depth': [None, 2, 3, 4, 5, 10, 15],
'model__min_samples_split': [2, 5, 15],
'model__min_samples_leaf': [1, 2, 4, 8],
'model__max_features': ['sqrt', 'log2', None, 1]
},
'svr': {
'model__C': [0.01, 0.1, 1, 10, 20, 30, 40, 50, 60, 70, 80],
'model__kernel': ['linear', 'rbf', 'poly'],
'model__degree': [1, 2, 3, 4],
},
'knn': {
'model__n_neighbors': [3, 5, 7, 10],
'model__weights': ['uniform', 'distance'],
'model__p': [1, 2],
},
'ab': {
'model__n_estimators': [50, 100, 200, 500],
'model__learning_rate': [0.01, 0.1, 0.2, 0.3, 0.4]
},
'gb': {
'model__n_estimators': [50, 100, 200, 500],
'model__max_depth': [None, 2, 5, 15],
'model__min_samples_split': [2, 5, 15],
'model__min_samples_leaf': [1, 2, 4, 8],
'model__max_features': ['sqrt', 'log2', None, 1],
'model__learning_rate': [0.01, 0.1, 0.2, 0.3, 0.4]
},
'xgb': {
'model__n_estimators': [50, 100, 200, 500],
'model__max_depth': [None, 2, 5, 15],
'model__learning_rate': [0.01, 0.1, 0.2, 0.3, 0.4]
},
'xgbf': {
'model__n_estimators': [50, 100, 200, 500],
'model__max_depth': [None, 2, 5, 15],
'model__colsample_bynode': [0.0, 0.25, 0.5, 0.75, 1.0],
'model__colsample_bytree': [0.0, 0.25, 0.5, 0.75, 1.0],
}
}