-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpreprocess.py
32 lines (23 loc) · 1.06 KB
/
preprocess.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
# Extracts the features, labels, and normalizes the development and evaluation split features.
from cls import cls_feature_class as cls_feature_class
import parameters as parameters
import sys
def main(argv):
# Expects one input - task-id - corresponding to the configuration given in the parameter.py file.
# Extracts features and labels relevant for the task-id
# It is enough to compute the feature and labels once.
# use parameter set defined by user
task_id = '33' if len(argv) < 2 else argv[1]
params = parameters.get_params(task_id)
# -------------- Extract features and labels for development set -----------------------------
dev_feat_cls = cls_feature_class.FeatureClass(params, is_eval=False)
# Extract features and normalize them
dev_feat_cls.extract_all_feature()
dev_feat_cls.preprocess_features()
# Extract labels
dev_feat_cls.extract_all_labels()
if __name__ == "__main__":
try:
sys.exit(main(sys.argv))
except (ValueError, IOError) as e:
sys.exit(e)