def _notify(self): HillClimber._notify(self) if self.verbose: print ' Bits on in best mask:', sum(self.bestEvaluable.mask)
def _learnStep(self): self.switchMutations() HillClimber._learnStep(self) self.switchMutations()
# coding=utf-8 from pybrain.optimization.hillclimber import HillClimber from pybrain.rl.agents.optimization import OptimizationAgent from pybrain.rl.environments.cartpole.balancetask import BalanceTask from pybrain.rl.experiments.episodic import EpisodicExperiment from pybrain.tools.shortcuts import buildNetwork task = BalanceTask() net = buildNetwork(task.outdim, 3, task.indim) agent = OptimizationAgent(net, HillClimber()) exp = EpisodicExperiment(task, agent) exp.doEpisodes(100) print(exp)