<s> from rlpy . Domains import HIVTreatment <EOL> from rlpy . Agents import SARSA , Q_LEARNING <EOL> from rlpy . Representations import * <EOL> from rlpy . Policies import eGreedy <EOL> from rlpy . Experiments import Experiment <EOL> import numpy as np <EOL> from hyperopt import hp <EOL> param_space = { '<STR_LIT>' : hp . quniform ( "<STR_LIT>" , <NUM_LIT:3> , <NUM_LIT:30> , <NUM_LIT:1> ) , <EOL> '<STR_LIT>' : hp . uniform ( "<STR_LIT>" , <NUM_LIT:0.> , <NUM_LIT:1.> ) , <EOL> '<STR_LIT>' : hp . loguniform ( "<STR_LIT>" , np . log ( <NUM_LIT> ) , np . log ( <NUM_LIT> ) ) , <EOL> '<STR_LIT>' : hp . loguniform ( "<STR_LIT>" , np . log ( <NUM_LIT> ) , np . log ( <NUM_LIT:1> ) ) } <EOL> def make_experiment ( <EOL> exp_id = <NUM_LIT:1> , path = "<STR_LIT>" , <EOL> boyan_N0 = <NUM_LIT> , <EOL> lambda_ = <NUM_LIT> , <EOL> initial_learn_rate = <NUM_LIT> , <EOL> resolution = <NUM_LIT> , num_rbfs = <NUM_LIT> ) : <EOL> opt = { } <EOL> opt [ "<STR_LIT:path>" ] = path <EOL> opt [ "<STR_LIT>" ] = exp_id <EOL> opt [ "<STR_LIT>" ] = <NUM_LIT> <EOL> opt [ "<STR_LIT>" ] = <NUM_LIT:30> <EOL> opt [ "<STR_LIT>" ] = <NUM_LIT:1> <EOL> domain = HIVTreatment ( ) <EOL> opt [ "<STR_LIT>" ] = domain <EOL> representation = NonparametricLocalBases ( domain , <EOL> kernel = linf_triangle_kernel , <EOL> resolution = resolution , <EOL> normalization = True ) <EOL> policy = eGreedy ( representation , epsilon = <NUM_LIT:0.1> ) <EOL> opt [ "<STR_LIT>" ] = Q_LEARNING ( <EOL> policy , representation , discount_factor = domain . discount_factor , <EOL> lambda_ = lambda_ , initial_learn_rate = initial_learn_rate , <EOL> learn_rate_decay_mode = "<STR_LIT>" , boyan_N0 = boyan_N0 ) <EOL> experiment = Experiment ( ** opt ) <EOL> return experiment <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> from rlpy . Tools . run import run_profiled <EOL> experiment = make_experiment ( <NUM_LIT:1> ) <EOL> experiment . run ( visualize_learning = True ) <EOL> experiment . plot ( ) </s>
