Exemple #1
0
 def __init__(self, numStates, numActions, env, name=None):
     Module.__init__(self, 1, 1, name)
     ParameterContainer.__init__(self, numStates * numActions)
     self.numRows = numStates
     self.numColumns = numActions
     #self.allowed_actions = range(numActions)
     self.env = env
Exemple #2
0
    def __init__(self, dim, nNeurons, mNeurons=1, name=None, outputFullMap=False):
        if outputFullMap:
            outdim = nNeurons * mNeurons
        else:
            outdim = 2
        Module.__init__(self, dim, outdim, name)

        # switch modes
        self.outputFullMap = outputFullMap

        # create neurons
        self.neurons = random.random((nNeurons, mNeurons, dim))
        self.difference = zeros(self.neurons.shape)
        self.winner = zeros(2)
        self.nInput = dim
        self.nNeurons = nNeurons
        self.mNeurons = mNeurons
        self.neighbours = min(nNeurons, mNeurons)
        self.neighbourdist = min(nNeurons, mNeurons)
        self.learningrate = 0.001
        self.neighbourdecay = 0.9999
        self.winner_error = maxint

        # distance matrix
        distx, disty = mgrid[0:self.nNeurons, 0:self.mNeurons]
        self.distmatrix = zeros((self.nNeurons, self.mNeurons, 2))
        self.distmatrix[:, :, 0] = distx
        self.distmatrix[:, :, 1] = disty
Exemple #3
0
 def __init__(self, dimState, numActions, name=None):
     Module.__init__(self, dimState, 1, name)
     self.network = buildNetwork(dimState + numActions, dimState + numActions, 1)
     self.numActions = numActions
     self.numStates = dimState
     self.bn = BN()
     self.bn.numActions = numActions
    def __init__(self, dimState, numActions, name=None, id2action=None):
        Module.__init__(self, dimState, 1, name)

        #self.network = buildNetwork(8,8,1, hiddenclass = ReluLayer )
        self.network = buildNetwork(dimState + numActions,
                                    dimState + numActions,
                                    int((dimState + numActions) / 2),
                                    1,
                                    hiddenclass=ReluLayer)
        self.numActions = numActions
        self.id2action = id2action
Exemple #5
0
 def __init__(self, dimState, numActions, name=None):
     Module.__init__(self, dimState, 1, name)
     self.network = buildNetwork(dimState + numActions, dimState + numActions, 1)
     self.numActions = numActions
Exemple #6
0
 def __init__(self, numStates, numActions, name=None):
     Module.__init__(self, 1, 1, name)
     ParameterContainer.__init__(self, numStates * numActions)
     self.numRows = numStates
     self.numColumns = numActions
Exemple #7
0
 def __init__(self, numStates, numActions, name=None):
     Module.__init__(self, 1, 1, name)
     ParameterContainer.__init__(self, numStates * numActions)
     self.numRows = numStates
     self.numColumns = numActions