• <bdo id="2geeg"><optgroup id="2geeg"></optgroup></bdo>
    <rt id="2geeg"><optgroup id="2geeg"></optgroup></rt><kbd id="2geeg"><tr id="2geeg"></tr></kbd>
    <sup id="2geeg"><optgroup id="2geeg"></optgroup></sup><optgroup id="2geeg"><acronym id="2geeg"></acronym></optgroup>
    <input id="2geeg"><samp id="2geeg"></samp></input>
  • <rt id="2geeg"><optgroup id="2geeg"></optgroup></rt>

    机器学习 – 如何在OpenAI中创建一个新的健身房环境?

    我有一个任务,要制作一个AI代理,学习使用ML玩视频游戏.我想使用OpenAI Gym创建一个新环境,因为我不想使用现有环境.如何创建新的自定义环境?

    另外,有没有其他方法可以让我开始让AI Agent在没有OpenAI Gym的帮助下玩特定的视频游戏?

    在极小的环境中查看我的 banana-gym.

    创建新环境

    请参阅存储库的主页面:

    https://github.com/openai/gym/blob/master/docs/creating-environments.md

    步骤是:

    >使用PIP包结构创建新的存储库

    它看起来应该是这样的

    gym-foo/
      README.md
      setup.py
      gym_foo/
        __init__.py
        envs/
          __init__.py
          foo_env.py
          foo_extrahard_env.py

    有关其内容,请点击上面的链接.那里没有提到的细节特别是foo_env.py中的某些函数应该是什么样子.查看示例并在gym.openai.com/docs/有所帮助.这是一个例子:

    class FooEnv(gym.Env):
        metadata = {'render.modes': ['human']}
    
        def __init__(self):
            pass
    
        def _step(self, action):
            """
    
            Parameters
            ----------
            action :
    
            Returns
            -------
            ob, reward, episode_over, info : tuple
                ob (object) :
                    an environment-specific object representing your observation of
                    the environment.
                reward (float) :
                    amount of reward achieved by the previous action. The scale
                    varies between environments, but the goal is always to increase
                    your total reward.
                episode_over (bool) :
                    whether it's time to reset the environment again. Most (but not
                    all) tasks are divided up into well-defined episodes, and done
                    being True indicates the episode has terminated. (For example,
                    perhaps the pole tipped too far, or you lost your last life.)
                info (dict) :
                     diagnostic information useful for debugging. It can sometimes
                     be useful for learning (for example, it might contain the raw
                     probabilities behind the environment's last state change).
                     However, official evaluations of your agent are not allowed to
                     use this for learning.
            """
            self._take_action(action)
            self.status = self.env.step()
            reward = self._get_reward()
            ob = self.env.getState()
            episode_over = self.status != hfo_py.IN_GAME
            return ob, reward, episode_over, {}
    
        def _reset(self):
            pass
    
        def _render(self, mode='human', close=False):
            pass
    
        def _take_action(self, action):
            pass
    
        def _get_reward(self):
            """ Reward is given for XY. """
            if self.status == FOOBAR:
                return 1
            elif self.status == ABC:
                return self.somestate ** 2
            else:
                return 0

    使用您的环境

    import gym
    import gym_foo
    env = gym.make('MyEnv-v0')

    例子

    > https://github.com/openai/gym-soccer
    > https://github.com/openai/gym-wikinav
    > https://github.com/alibaba/gym-starcraft
    > https://github.com/endgameinc/gym-malware
    > https://github.com/hackthemarket/gym-trading
    > https://github.com/tambetm/gym-minecraft
    > https://github.com/ppaquette/gym-doom
    > https://github.com/ppaquette/gym-super-mario
    > https://github.com/tuzzer/gym-maze

    相关文章
    惠泽社群高手论坛3 包头市| 独山县| 遵化市| 上犹县| 句容市| 边坝县| 织金县| 林周县| 皮山县| 宜昌市| 旌德县| 临漳县| 惠州市| 闻喜县| 拜泉县| 旺苍县| 沈阳市| 益阳市| 遵化市| 福海县| 滦平县| 龙井市| 安陆市| 乡宁县| 陇西县| 汉源县| 望都县| 龙井市| 隆子县| 桃园县| 应城市| 临夏县| 香格里拉县| 通海县| 偏关县| 浮山县| 无极县| 呼和浩特市| 安龙县| 从化市| 东台市| 曲阳县| 凌云县| 盐亭县| 富顺县| 冷水江市| 安化县| 南投市| 华宁县| 清水河县| 嘉义县| 万载县| 镇巴县| 嘉义市| 宁蒗| 武邑县| 凉城县| 轮台县| 饶阳县| 剑河县| 揭东县| 阿尔山市| 修文县| 合肥市| 博客| 中江县| 遂川县| 东方市| 曲松县| 白沙| 叶城县| 哈巴河县| 梧州市| 霍邱县| 阜阳市| 永嘉县| 南宫市| 丽江市| 海安县| 栾城县| 老河口市| 峨山| 镶黄旗| 东安县| 通渭县| 屯留县| 曲阳县| http://www.hslotr888.com http://gwrongl888.com http://www.gwelcomel888.com http://www.gwalkl888.com http://htravelr888.com http://m.hstressr888.com http://wap.hturnr888.com http://gwaitl888.com http://www.hweightr888.com http://www.flskyo888.com http://wap.hthreadr888.com