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 boltzmann_action definition #8

Open
wants to merge 2 commits 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
4 changes: 2 additions & 2 deletions test_agent_kerasrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def evaluate( action_function ):

# option 1: Boltzmann sampling from Q-function network output
softmax = lambda x : np.exp( x ) / np.sum( np.exp( x ))
boltzmann_action = lambda x : np.argmax( np.random.multinomial( 1, softmax(x).flatten()))
boltzmann_action = lambda x : np.random.choice( range(len(x)), p=softmax(x).flatten())
# option 2: maximize the Q value, ignoring stochastic action space
best_action = lambda x : np.argmax( x )

Expand Down Expand Up @@ -70,4 +70,4 @@ def f(bytez):
print("Success rate of random chance: {}\n".format( len(random_success) / total ))
print("Success rate (dqn): {}\n".format( len(dqn_success) / total ) )
print("Success rate (dqn): {}\n".format( len(dqn_score_success) / total ) )