base_models#
Methods for creating HSR base models.
- class hsr4hci.base_models.BaseModelCreator[source]#
Wrapper class for creating new base model instances.
Example
>>> base_model_config = { >>> 'module': 'sklearn.linear_model', >>> 'class': 'LinearRegression', >>> 'parameters': {'fit_intercept': False}, >>> } >>> bmc = BaseModelCreator(**base_model_config) >>> model = bmc.get_model_instance() >>> model LinearRegression(fit_intercept=False)
Note
Ideally, this function should simply take three arguments instead of a dictionary. The reason behind the current version is a poor early design choice for the experiment configuration files: The โclassโ parameter should have been called โnameโ instead, because
classis a protected key word in Python that cannot be used as the name of an input parameter. However, changing this now would require updating all experiment configuration files and all training scriptsโฆ- __init__(**base_model_config)[source]#
- Parameters:
**base_model_config (Any) โ
A
dictcontaining the configuration of the base model. It needs to have exactly three keys (see example above):module: A string with the module from which the base model should be imported.class: A string with the class (= name) of the base model.parameters: A dictionary with additional keyword arguments that will be passed to the constructor ofmodule.class. Can be empty:{}.
- Return type:
None