- csv_files = Path.cwd() / 'config' / 'features'
- self._features = {feat : None for feat in self._features}
- for csv_file in listdir(csv_files):
- with open(csv_files / csv_file, "r") as f:
- reader = DictReader(f, delimiter=',')
- for row in reader:
- if row['name'] in self._features:
- self._features[row['name']] = row['type']
- print(self._features)
- exit()
+ feature_files = Path.cwd() / 'config' / 'features'
+ self._features = {feat : {'numerical': False} for feat in self._features}
+ for feature_file in listdir(feature_files):
+ if feature_file.endswith('csv'):
+ with open(feature_files / feature_file , "r") as f:
+ reader = DictReader(f, delimiter=',')
+ typed_names = {row['name']: row['type'] for row in reader}
+ for feature in self._features:
+ if feature.split('_')[0] in typed_names:
+ self._features[feature]['type'] = int(typed_names[feature.split('_')[0]])
+ elif feature_file.endswith('cfg'):
+ config = ConfigParser()
+ config.read(feature_files / feature_file)
+ for section in config:
+ if config.has_option(section, 'numerical'):
+ self._features[section]['numerical'] = config[section].getboolean('numerical')
+