Last active
January 12, 2021 22:01
-
-
Save ForteXX-2020/620f80de70686804caee634f6c173c6a to your computer and use it in GitHub Desktop.
0002_reinforcement
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
ssp = [1, 1, 1, 1, 0] | |
def epoch(): | |
asp = [1, 0] | |
tr = 0 | |
for _ in range(100): | |
a = np.random.choice(asp) | |
s = np.random.choice(ssp) | |
if a == s: | |
tr += 1 | |
asp.append(s) | |
return tr | |
rl = np.array([epoch() for _ in range(15)]) | |
print(rl.mean()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment