def run_model(params): # https://stackoverflow.com/questions/11526975/set-random-seed-programwide-in-python # https://stackoverflow.com/questions/30517513/global-seed-for-multiple-numpy-imports random.seed(params.seed) np.random.seed(params.seed) # Must be called before Session # https://stackoverflow.com/questions/38469632/tensorflow-non-repeatable-results/40247201#40247201 tf.set_random_seed(params.seed) qagent = QAgent(params) if params.is_train: qagent.fit() elif params.eval_mode == 0: qagent.evaluate_mine() elif params.eval_mode == 1: qagent.test_mine() elif params.eval_mode == 2: for mines in range(1, 13): params.mines_min = mines params.mines_max = mines print("Mines =", mines) qagent.test_mine() tf.reset_default_graph() qagent = QAgent(params)
def train(params): # https://stackoverflow.com/questions/11526975/set-random-seed-programwide-in-python # https://stackoverflow.com/questions/30517513/global-seed-for-multiple-numpy-imports random.seed(params.seed) np.random.seed(params.seed) # Must be called before Session # https://stackoverflow.com/questions/38469632/tensorflow-non-repeatable-results/40247201#40247201 tf.set_random_seed(params.seed) qagent = QAgent(params) if params.is_train: qagent.fit() else: qagent.evaluate_mine()