Skip to content

Ch 8 predicting? #35

Description

@nisbus

I've managed to run the code from chapter 8 successfully and the update_q seems to be creating Q values for states.

I now wanted to run the simulation a 100 times and then predict the same (or other) prices using the learnt knowledge.

I tried adding the following method to the QDecisionPolicy

    def predict(self, state):                
        action_q_vals = self.sess.run(self.q, feed_dict={self.x: state})        
        action_idx = np.argmax(action_q_vals)
        action = self.actions[action_idx]
        print('Action {}, Q {}, STATE :{}'.format(action, action_q_vals, state))
        return action

This always prints out Action 'HOLD', Q [[0. 0. 0.]] for any state given
event though I've tested printing the same in the update Q and seeing that the state I'm putting into predict is being updated to non zero values.

How can I query the policy, or is there some other mechanism that I should be using to predict using the learnt policy?

Thanks

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions