Question: ## 4 . D - Success Rate Plot Use Matplotlib to create a line plot showing the progress in the success rate for the Monte
## D Success Rate Plot
Use Matplotlib to create a line plot showing the progress in the success rate for the Monte Carlo agent. The yvalues for the line plot should come from the success rate list created in the previous cell. The xvalues should be the corresponding number of episodes. The figure should also have the following characteristics.
A figsize of
The title should read MC Agent Success Rate".
The x and y axes should be labeled "Number of Episodes" and "Success Rate", respectively.
Add a grid to your plot.
## E Display Policy
Calculate the mean absolute difference between the optimal statevalue function and the current estimate produced by Monte Carlo control. Print the message shown below with the blank filled in with the appropriate value, rounded to decimal places.
The mean absolute difference in V is
Display the environment from A setting fill to shade the the cells according to their value under the policy found by MC control, and set contents to display that policy. When calling display set size and shownumsFalse
## F QLearning
Starter code has been provided in the cell below. Complete this code to repeat the process outline in Step C but using Qlearning insteasd of MC Control. The process is identical to that described in Step C with two exceptions:
You will use Qlearning instead of MC control.
The characters MC in the output should be replaced with TD
TDAgentenv gamma randomstate
srates
for i in range:
numeps
qlearningepisodesnumeps, epsiloni alpha maxsteps exploringstarts
sr successrateenv policy episodes maxsteps randomstatei
sratesappendsr
printfAfter i numeps episodes, the TD agent's success rate was sr:f
## G Success Rate Plot
Repeat the steps outlined in Step D but using the list created for QLearning in F instead. The title of this figure should be TD Agent Success Rate".
## H Display Policy
Repeat the steps outlined in Step E but using the policy and statevalue function estimates found using Qlearning rather than those found by Monte Carlo control.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
