ConfigurationΒΆ

In general, you can define any option that you want to use while extracting features or post-processing data. You will be able to access them in a cfg argument of your custom features and hooks or in the fields self._cfg and self._post_config of FeaturesExtractor and DataProcessor respectively.

However, some options will always be present as they are used by the stock features and classes. Check the examples to see the definition of all the default settings:

To override these options and/or add your own ones, you have two options:

  1. To provide FeatureExtractor and DataProcessor with the file names to YAML files; in this case, every YAML variable will become a field in the Configuration object

  2. To provide them a list of key-word arguments, where the key will become the name of the field of the Configuration object. You can also mix these two methods and, in such a case, the key-word arguments will have the precedence.

For instance, imagine your YAML file is named myconf.yml and looks like this:

myoption: [1, 2, 3]

You could create an extractor object like this:

FeaturesExtractor('myconf.yml', anotheroption="somevalue")

Then, in your custom feature, you can access anotheroption and myoption:

def update_part_objects(
    score_data: dict = None,
    parts_data: list = None,
    cfg: object = None,
    parts_features: list = None,
):
  if cfg.myoption[0] == 1:
    # do something
    pass
  elif cfg.anotheroption == 'somevalue':
    # do something
    pass

Also, have a look the Configuration API page to understand how the Configuration class works. You can subclass it for advanced handling of configurations; see, for instance, the Didone feature project.