Ich arbeite in einem Verstärkungslernprogramm und verwende diesen Artikel als reference. Ich verwende Python mit keras (Theano) für neuronale Netzwerk zu schaffen und den Pseudo-Code, den ich für dieses Programm verwenden istWie man Gewichte in Keras für Verstärkungslernen aktualisiert?
Do a feedforward pass for the current state s to get predicted Q-values for all actions.
Do a feedforward pass for the next state s’ and calculate maximum overall network outputs max a’ Q(s’, a’).
Set Q-value target for action to r + γmax a’ Q(s’, a’) (use the max calculated in step 2). For all other actions, set the Q-value target to the same as originally returned from step 1, making the error 0 for those outputs.
Update the weights using backpropagation.
Die Verlust Funktionsgleichung hier dieses
ist, wo meine Belohnung +1, MaxQ (s', a ') = 0,8375 und Q (s, a) = 0,6892
Mein L 1/2*(1+0.8375-0.6892)^2=0.659296445
wäre Nun, wie soll ich meine Modell neuronales Netz Gewichte unter Verwendung des obigen Verlustfunktionswertes aktualisieren, wenn meine Modellstruktur ist dies
model = Sequential()
model.add(Dense(150, input_dim=150))
model.add(Dense(10))
model.add(Dense(1,activation='sigmoid'))
model.compile(loss='mse', optimizer='adam')
Bitte geben Sie eine detailliertere Beschreibung. Vielen Dank – RZK