adventures-in-ml-code icon indicating copy to clipboard operation
adventures-in-ml-code copied to clipboard

Policy Gradient Issue: ValueError: Shapes (20, 1) and (20, 2) are incompatible

Open danisch-khurshid-creator opened this issue 5 years ago • 1 comments

Hi. The code Code is not working with this line: loss = network.train_on_batch(states, discounted_rewards).

Try this... it should work... target_actions = np.array([[1 if a==i else 0 for i in range(2)] for a in actions]) loss = network.train_on_batch(states,target_actions, sample_weight=discounted_rewards)

asokraju avatar Sep 10 '20 17:09 asokraju