def generate(cls, conf): """ Generate list of model objects. One for each conf. to be tested. """ r = list() degrees = conf.get("degree", 2) epsilons = conf.get("epsilon", 0.1) if "degree" in conf: del conf["degree"] if "epsilon" in conf: del conf["epsilon"] for degree in expand_parameters(degrees): for e in expand_parameters(epsilons): r.append(cls(degree=degree, epsilon=e, **conf)) return r
def prepare(self): """ Prepare experiment: Generate configurations to be simulated. """ self._lst_max_time_t = expand_parameters(self.conf.get("max_time_t")) # pmodel self._lst_pmodel = list() for pmcls, pmconf in self._pmodel_cls_lst: self._lst_pmodel += pmcls.generate(pmconf) # selector(s) self._lst_selector = list() for scls, sconf in self._selector_cls_lst: self._lst_selector += scls.generate(sconf) # predictor self._lst_predictor = list() for pcls, pconf in self._predictor_cls_lst: self._lst_predictor += pcls.generate(pconf) # error metrics self._lst_error = list() for ecls, econf in self._error_cls_lst: self._lst_error += ecls.generate(econf) # plots self._lst_plot = list() for pcls, pconf in self._plot_cls_lst: self._lst_plot += pcls.generate(pconf) LOG.info("*** Prepared {}x{} configurations to be simulated.".format( self.n_configs, self.conf.get("repetitions", 1)))
def generate(cls, conf): """ Generate list of model objects. One for each conf. to be tested. """ r = list() # extract max_samples parameter because it is the X axis conf_max_samples = conf.get("max_samples") del conf["max_samples"] del conf["name"] # no name in params (implicitly given by class) # generate one object for each expanded parameter for max_samples in expand_parameters(conf_max_samples): r.append(cls(max_samples=max_samples, **conf)) return r