Skip to content
Snippets Groups Projects
Commit 29f96ab1 authored by Majdi Karim's avatar Majdi Karim
Browse files

Update reinforce_cartpole.py

parent 4eead764
Branches
No related tags found
No related merge requests found
......@@ -7,14 +7,6 @@ from torch.distributions import Categorical
import matplotlib.pyplot as plt
# Create the environment
env = gym.make("CartPole-v1", render_mode="human")
......@@ -91,3 +83,10 @@ for i in range(500):
env.close()
# Plot the policy loss against iterations
plt.plot([i for i in range(0,500)],episodes_rewards)
plt.xlabel('Iterations')
plt.ylabel('Policy Loss')
plt.title('Policy Loss vs. Iterations')
plt.show()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment