- for csv_file in listdir():
- with open(csv_file, "r") as f:
- reader = DictReader(f, delimiter=',')
- dico_features = {{row['name']: row['type'] # qualitative (2) or quantitative (1)
- }
- for row in reader if row['name'] in self._features}
+ 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')