neuroevolution-ai / NeuroEvolution-CTRNN_new

MIT License
3 stars 3 forks source link

pass objects instead of configs to experiment #77

Open bjuergens opened 3 years ago

bjuergens commented 3 years ago

required in context of #73

blocked by #54

related #72

Currently we pass a configuration object ot Experiment-Class. Instead we want to pass Objects to the Experiment. This should make it easier for users to use this project as a module.

The current signature of the Experiment constructor looks like this:

def __init__(self, 
    configuration: ExperimentCfg, 
    result_path, 
    processing_framework, 
    write_final_checkpoint=False,
    number_of_workers=os.cpu_count(), 
    from_checkpoint=None, 
    reset_hof=False):

and after this issue it should look like this:

def __init__(self, 
    environment: str,
    number_generations: int, #this parameter should probably move to the Optimizer
    episode_runner: EpisodeRunnerCfg, 
    optimizer: IOptimizerCfg,
    brain_factory,
    random_seed: int = -1,
    result_path, 
    processing_framework, 
    write_final_checkpoint=False,
    number_of_workers=os.cpu_count(), 
    from_checkpoint=None, 
    reset_hof=False):

In any case I think we shouldn't lose the ability to use json files for configuration, because it makes results very easy comparable and thus makes hyperparameter searches and comparisons much much simpler.

After all the core idea behind this repository was to have a unified framework, which enables us to compare different techniques in the area of neuro-evolution. If we lose the ability to easily compare techniques, then the project loses its Raison d'être.

bjuergens commented 3 years ago

to keep the config jsons, there are different approaches possible.

One option would be to add a static factory method init_from_json to the Experiment class, which reads contents from a json file and passes the contents to the contructor. This factory would also recursively initiate subobjects (e.g. epRunner and Optimizer) similar to how ConfigReader.config_from_file currently does it with configurations.