<s> __author__ = "<STR_LIT>" <EOL> from pybrain . tools . example_tools import ExTools <EOL> from pybrain . tools . shortcuts import buildNetwork <EOL> from pybrain . rl . environments . cartpole import CartPoleEnvironment , BalanceTask <EOL> from pybrain . rl . agents import OptimizationAgent <EOL> from pybrain . optimization import FEM <EOL> from pybrain . rl . experiments import EpisodicExperiment <EOL> batch = <NUM_LIT:2> <EOL> prnts = <NUM_LIT:100> <EOL> epis = <NUM_LIT> / batch / prnts <EOL> numbExp = <NUM_LIT:10> <EOL> et = ExTools ( batch , prnts ) <EOL> for runs in range ( numbExp ) : <EOL> env = CartPoleEnvironment ( ) <EOL> task = BalanceTask ( env , <NUM_LIT:200> , desiredValue = None ) <EOL> net = buildNetwork ( <NUM_LIT:4> , <NUM_LIT:1> , bias = False ) <EOL> agent = OptimizationAgent ( net , FEM ( storeAllEvaluations = True ) ) <EOL> et . agent = agent <EOL> experiment = EpisodicExperiment ( task , agent ) <EOL> for updates in range ( epis ) : <EOL> for i in range ( prnts ) : <EOL> experiment . doEpisodes ( batch ) <EOL> et . printResults ( ( agent . learner . _allEvaluations ) [ - <NUM_LIT:50> : - <NUM_LIT:1> ] , runs , updates ) <EOL> et . addExps ( ) <EOL> et . showExps ( ) </s>
