<jupyter_start><jupyter_text>Policy Evaluation![alt text](jpg/policy_eval.jpg)<jupyter_code>random_policy = np.ones([env.nS, env.nA]) / env.nA
v = policy_eval(random_policy, env)
print("Value Function:")
print(v)
print("")

print("Reshaped Grid Value Function:")
print(v.reshape(env.shape))
print("")
# Test: Make sure the evaluated policy is what we expected
expected_v = np.array([0, -14, -20, -22, -14, -18, -20, -20, -20, -20, -18, -14, -22, -20, -14, 0])
np.testing.assert_array_almost_equal(v, expected_v, decimal=2)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18478260869565216, 'fraction_numerical': 0.05615942028985507, 'mean_word_length': 5.827160493827161, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '402770', 'license': 'MIT', 'n_tokens_mistral': 238, 'n_tokens_neox': 216, 'n_words': 49, 'path': 'DP/Policy Evaluation.ipynb', 'repo_name': 'NathanChenJiabin/reinforcement-learning', 'size': '552'}