Repository navigation
Expand file tree
/
Copy pathconfig.py
More file actions
66 lines (47 loc) · 1.97 KB
/
Copy pathconfig.py
File metadata and controls
66 lines (47 loc) · 1.97 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import logging
from typing import Callable, Any
from pathlib import Path
from pandas import Series
from numpy import timedelta64
from scipy.stats import randint, uniform
from windowing.operations import mean_operation, min_operation, max_operation, std_operation, last_operation
# Train dataset directory
TRAIN_DATA_DIR: Path = Path('/data/dataset')
# Model output file
MODEL_OUTPUT_FILE: str = "./models/model.json"
# Configured log level
LOG_LEVEL: int = logging.INFO
# Data resolution (assuming uniform interval between datapoints)
DATAPOINT_RESOLUTION: timedelta64 = timedelta64(1, 'm')
# Required columns, if None use all
COLUMNS: list[str]|None = None
# Required window size for prediction
WINDOW_SIZES: list[timedelta64] = [timedelta64(30, 'm'), timedelta64(1, 'h'), timedelta64(3, 'h'), timedelta64(6, 'h')]
# Operations
OPERATIONS: dict[str,Callable[[Series],float]] = {'mean': mean_operation, 'min': min_operation, 'max': max_operation, 'std': std_operation, 'last': last_operation}
# Validation size
VALIDATION_SIZE: float = 0.2
# Test size
TEST_SIZE: float = 0.2
# k-fold splits in search validation
KFOLD_SPLITS: int = 5
# Number of parameter sampling for random search
N_ITER: int = 10
# Search parameter distribution
PARAM_DISTRIBUTIONS: dict[str,Any] = {
"n_estimators": randint(100, 500),
"learning_rate": uniform(0.01, 0.29), # 0.01-0.3
"max_depth": randint(3, 15),
"min_child_weight": randint(1, 10),
"subsample": uniform(0.5, 0.5), # 0.5-1.0
"colsample_bytree": uniform(0.5, 0.5), # 0.5-1.0
"gamma": uniform(0.0, 5.0),
"reg_alpha": uniform(0.0, 5.0),
"reg_lambda": uniform(0.0, 5.0),
}
# Percentages to use for top feature selection and exluding all (e.g. [0.1, 0.4, 0.8]), if None do not perform selection and use all features
N_TOP_FEATURES_SELECTION: list[float] = [0.2, 0.4, 0.6, 0.8]
# Maximum thread workers to use
MAX_THREAD_WORKERS: int = 8
# Random state to use for repeatability, if not None will be random
RANDOM_STATE: int|None = 42