Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dqn_agent.py #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions dqn_agent.py
Original file line number Diff line number Diff line change
@@ -80,7 +80,7 @@ def random_value(self):

def predict_value(self, state):
'''Predicts the score for a certain state'''
return self.model.predict(state)[0]
return self.model().predict(state)[0]


def act(self, state):
@@ -120,7 +120,7 @@ def train(self, batch_size=32, epochs=3):

# Get the expected score for the next states, in batch (better performance)
next_states = np.array([x[1] for x in batch])
next_qs = [x[0] for x in self.model.predict(next_states)]
next_qs = [x[0] for x in self.model().predict(next_states)]

x = []
y = []
@@ -137,7 +137,7 @@ def train(self, batch_size=32, epochs=3):
y.append(new_q)

# Fit the model to the given values
self.model.fit(np.array(x), np.array(y), batch_size=batch_size, epochs=epochs, verbose=0)
self.model().fit(np.array(x), np.array(y), batch_size=batch_size, epochs=epochs, verbose=0)

# Update the exploration variable
if self.epsilon > self.epsilon_min: