Skip to content

Instantly share code, notes, and snippets.

View lgvaz's full-sized avatar

Lucas Vazquez lgvaz

View GitHub Profile
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCnGxOnXBdS3hXOnmHcp+Q2rviEUT79aMsQMfj0+V1tekHPThDTdNuWrsc0MYBhpS12zGlOKSIWt51/BkvfSaZ9hcvd6Szi1QfR7F7N3LFlJq0Vj0Q+IQQCbIo76VYpx6LmUMCqqU6MlHXxH4RiZiMmrnBzgst4rGr6AfcxwxBCT0nPkhx6hRgMu2X4UIc01wwoAxu0V3OG5TYBOCYdjII8urQIxNkDrIswayRcnXbYRTvYC/WJs/RIQA7kkAD5JC39dJSM1qF7m4NS5pl67ynEFzgIZ5Vb7U1ThKb0wlxYDx6nqJDxrh/XpMGnY3wl0Z9R5YJJ9hg3Djo20f19IgpdhbPmojIwgDVmxKept4S0gcmyykDHcBP4vNHcONkxmdA/+nTTvZyTmMsXJWbD5Ksjmpi4HK2FKvpJ4mVDdFXOB51qRlfbfxgia+j04FlBdXX/7KGtwByMeFen8bGr5Zb++gKWEqKMTA9M4yVJnA2zfLFc8SwftBPi4xvZC/zlpGOKzBtp4ZgT2Y5/pcs89eYaAx46Ylme33MNdf3oZ7y/Mf8jl6aV3XsH/5tAIpSzWqnVKhLz4R6TlpzmEq2u18Vu1Ez/aBTOYE/lFaOy6JuV8xrBKzNQtDOXThMurUK1fNIT18M9e2LrOuqviYSJFDr1MEvNvs/S0F7/XwrkuHc6vw== lucasgouvaz@gmail.com
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.
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.
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])