rectorch.configuration¶
Class list¶
|
Class containing the configurations for reading/writing the data set. |
|
Class containing the configurations for creating, training and testing the model. |
Wrapper class for both the data and model configurations. |
The module contains useful classes to manage the configuration files.
Configuration files are useful to correctly initialize the data processing and the recommendation engines. Configuration files must be .json files with a specific format. Details about the file formats are described in Configuration files format.
-
class
rectorch.configuration.
DataConfig
(file_path)[source]¶ Class containing the configurations for reading/writing the data set.
Note
The data configuration file must have the structure described in Configuration files format.
-
class
rectorch.configuration.
ModelConfig
(file_path)[source]¶ Class containing the configurations for creating, training and testing the model.
Note
The data configuration file must have the structure described in Configuration files format.
- Attributes
- modelDefaultMunch
Munch object containing the model’s configurations according to the
model
key in thefile_path
json file.- trainDefaultMunch
Munch object containing the model training’s configurations according to the
train
key in thefile_path
json file.- testDefaultMunch
Munch object containing the test configurations according to the
test
key in thefile_path
json file.- samplerDefaultMunch
Munch object containing the sampler configurations according to the
model
key in thefile_path
json file.
-
class
rectorch.configuration.
ConfigManager
(data_config_path, model_config_path)[source]¶ Wrapper class for both the data and model configurations.
Examples
Initializing the ConfigManager
singleton:
>>> from rectorch.configuration import ConfigManager
>>> ConfigManager("path/to/the/dataconfig/file", "path/to/the/modelconfig/file")
ConfigManager(data_config=DataConfig(...), model_config=ModelConfig(...))
- Attributes
- data_config
DataConfig
Object containing the configurations for reading/writing the data set.
- model_config
ModelConfig
Object containing the configurations for creating, training and testing the model.
- data_config
-
classmethod
get
()[source]¶ Return the singleton ConfigManager instance.
- Returns
ConfigManager
The singletion
ConfigManager
instance.
- Raises
Exception
Raised when the singleton
ConfigManager
object has not been previously created. To initialize theConfigManager
simply call its constructor. Please, see Examples.
Examples
>>> from rectorch.configuration import ConfigManager
>>> man = ConfigManager.get()
Exception: Singleton object not instantiated!
The ConfigManager
singleton object must be initialized to get it.
>>> ConfigManager("path/to/the/dataconfig/file", "path/to/the/modelconfig/file")
ConfigManager(data_config=DataConfig(...), model_config=ModelConfig(...))
>>> man = ConfigManager.get()
>>> man
ConfigManager(data_config=DataConfig(...), model_config=ModelConfig(...))
Getting the configuration objects is as easy as getting an attribute
>>> man.data_config
DataConfig(...)
>>> man.model_config
ModelConfig(...)