onegpy.utils.config.gp_from_config

onegpy.utils.config.gp_from_config(path_or_config, config_tags=None, builder_map=None)[source]

Create a gp instance based on config. Keys of config indicate instances’ name and values follows below format. [module, class or function, list or dict of arguments] where list or dict of arguments only contains hyper parameters not dependent instances

Parameters:
  • path_or_config – filepath or dict
  • config_tags – list of instance names. All the instances are built in this order.

Tags which are not in config will be skipped. :param builder_map: dict. the mapper of instances’ names to their builder :return gp: a gp instance

  • Example of config
    config = {

    “gp”: [“onegpy.base”, “PopulationGP”, [20]], “initializer”: [

    “onegpy.operators”, “PopulationRandomInitializer”, [500, 0.1, 10]

    ], “problem”: [

    “onegpy.problems”, “EvenParity”, {“dim”: 3}

    ], “sequential”: [

    [“onegpy.operators”, “PopulationOnePointCrossover”, {“c_rate”: 0.5, “destructive”: False}], [“onegpy.operators”, “PopulationPointMutation”, {“m_rate”: 0.2}], [“onegpy.operators”, “TournamentSelection”, {“k”: 500, “tournament_size”: 5}]

    ], “logger”: [

    “onegpy.viewers”, “DefaultObserver”

    ]

    }