Exemplo n.º 1
0
def transform_trlist_to_data(trList):
    """
    """
    timeSteps, rewards = unzip(trList)

    data = {"rewards": list(rewards), "time": timeSteps}

    return data
Exemplo n.º 2
0
    def learn(self, actionRewardTupleList):
        """
        Learns from a list of ActionReward Tuples
        """

        actions, rewards = utils.unzip( actionRewardTupleList )

        self.Q.update( newValueOrList=rewards, indexList=actions )
Exemplo n.º 3
0
def test_unzip():
    x = [1, 2, 3]
    y = [4, 5, 6]

    z = zip(x, y)

    v, w = utils.unzip(z)

    assert v == x, "Unzip 1"
    assert w == y, "Unzip 2"
Exemplo n.º 4
0
    def learn(self, actionRewardTupleList):
        """
        Learns from a list of ActionReward Tuples
        """

        actions, rewards = utils.unzip( actionRewardTupleList )

        self.Q.update( newValueOrList=rewards, indexList=actions )

        # TODO Add multiple decays
        self.decay_epsilon()
Exemplo n.º 5
0
def transform_arlist_to_data(arList):
    """
    """
    actions, rewards = unzip(arList)

    timeSteps = range(len(actions))

    data = {
        "actions": list(actions),
        "rewards": list(rewards),
        "time": timeSteps
    }

    return data