-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfiguration.py
More file actions
85 lines (60 loc) · 2.33 KB
/
Configuration.py
File metadata and controls
85 lines (60 loc) · 2.33 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import logging
import time
from Utils import Utils
class Configuration:
def __init__(self):
pass
HIGGS_ALL = 'HIGGS.csv.gz'
# HIGGS_ALL = 'HIGGS_10000.csv'
# HIGGS_ALL = 'sim.csv'
DATA_DIR = './data/'
LOGGER_NAME = 'higgs_main_logger'
LOG_DIR = './logs/'
RESULTS_DIR = './results2/'
HIGGS_FRACS = [0.001, 0.005, 0.01, 0.05, 0.1, 0.2, 0.3, 0.4, 0.5]
HIGGS_FRACS_TEST = [0.005]
REGENERATE_DATA = False
HYPEROPT_EVALS_PER_SEARCH = 20
ANN_OPIMIZER_MAX_ITERATIONS = 100
DNN_EPOCHS = 40
ALL_DATA_FRACTION = 0.25 # how much data to use from entire higgs dataset (11M records)
TEST_DATA_FRACTION = 0.25 # test data fraction out of entire dataset
VALID_DATA_FRACTION = 0.25 # valid data fraction out of test dataset
# deprecated
# which columns should be taken to process
# from 0 to last column, higgs data has 28 features so columns 1:27
# higgs dataset : 0 column - label, 1-21 coulmns - 21 low level features, 22-28 columns - 7 high level features
# it's changed in main.py while parsing arguments 'low' and 'high' TODO:should be removed from here
FEATURES_START_COL = 22 # including
FEATURES_END_COL = 28 # including
# KEYS
SVM_KEY = 'svm'
ANN_KEY = 'ann'
FOREST_KEY = 'random_forest'
TREE_KEY = 'decision_tree'
DNN_KEY = 'dnn'
@staticmethod
def configure_logger():
Configuration.maybe_create_log_dir()
logger = logging.getLogger(Configuration.LOGGER_NAME)
logger.setLevel(logging.DEBUG)
log_filename = Configuration.generate_logfile_name()
sh = logging.StreamHandler()
fh = logging.FileHandler(Configuration.LOG_DIR + log_filename)
sh.setLevel(logging.DEBUG)
fh.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s %(levelname)s:%(message)s')
# add formatter to sh
sh.setFormatter(formatter)
fh.setFormatter(formatter)
logger.addHandler(sh)
logger.addHandler(fh)
logger.info("Logger configured")
@staticmethod
def maybe_create_log_dir():
Utils.maybe_create_directory(Configuration.LOG_DIR)
@staticmethod
def generate_logfile_name():
return time.strftime('%d_%m_%Y_%H_%M_%S' + '.log')
def logger():
return logging.getLogger(Configuration.LOGGER_NAME)