Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 | |
| import matplotlib.pyplot as plt | |
| # Ordem das cores, definida pelo professor | |
| COLORS = ["blue", "green", "red", "magenta", "cyan", "yellow", "black"] | |
| # Lê os dados, "with" abre o documento e o fecha automaticamente após sair da indentação | |
| with open("points.dat") as f: | |
| data_raw = f.read().splitlines() |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
| def egreedy_policy(q_values, state, epsilon=0.1): | |
| # Get a random number from a uniform distribution between 0 and 1, | |
| # if the number is lower than epsilon choose a random action | |
| if np.random.random() < epsilon: | |
| return np.random.choice(4) | |
| # Else choose the action with the highest value | |
| else: | |
| return np.argmax(q_values[state]) |
NewerOlder