def relu_with_drop_ratio(ratio): def f(x, train=True): return F.dropout(F.relu(x), train=train, ratio=ratio) return f def drop_ratio(ratio): def f(x, train=True): return F.dropout(x, train=train, ratio=ratio) return f model.activate_functions["l1"] = relu_with_drop_ratio(0.2) model.activate_functions["l2"] = relu_with_drop_ratio(0.4) model.activate_functions["l3"] = relu_with_drop_ratio(0.5) model.activate_functions["l4"] = drop_ratio(0.7) player = AsciiGamePlayerAgent(model) player.ALPHA = 0.01 agent_play(ThisGame, player) if __name__ == '__main__': def calc_output_size(screen_size, ksize, stride): return (screen_size - ksize) / stride + 1 if os.environ.get("DEBUG_PLAY", None): print "Debug Mode" debug_game(JumpGame) else: print "EmbedID Mode" ptn1(JumpGame, 'JumpGame')
def relu_with_drop_ratio(ratio): def f(x, train=True): return F.dropout(F.relu(x), train=train, ratio=ratio) return f def drop_ratio(ratio): def f(x, train=True): return F.dropout(x, train=train, ratio=ratio) return f model.activate_functions["l1"] = relu_with_drop_ratio(0.2) model.activate_functions["l2"] = relu_with_drop_ratio(0.4) model.activate_functions["l3"] = relu_with_drop_ratio(0.5) model.activate_functions["l4"] = drop_ratio(0.7) player = AsciiGamePlayerAgent(model) player.ALPHA = 0.01 agent_play(ThisGame, player) if __name__ == '__main__': def calc_output_size(screen_size, ksize, stride): return (screen_size - ksize) / stride + 1 if os.environ.get("DEBUG_PLAY", None): print "Debug Mode" debug_game(TreasureGame) else: print "EmbedID Mode" ptn1(TreasureGame, 'TreasureGameEmbedModel')