Skip to content

Instantly share code, notes, and snippets.

@davidADSP
Last active December 1, 2019 17:46
Show Gist options
  • Save davidADSP/65da60a8c5d006239e0857a5089db0fe to your computer and use it in GitHub Desktop.
Save davidADSP/65da60a8c5d006239e0857a5089db0fe to your computer and use it in GitHub Desktop.
# At the start of each search, we add dirichlet noise to the prior of the root
# to encourage the search to explore new actions.
def add_exploration_noise(config: MuZeroConfig, node: Node):
actions = list(node.children.keys())
noise = numpy.random.dirichlet([config.root_dirichlet_alpha] * len(actions))
frac = config.root_exploration_fraction
for a, n in zip(actions, noise):
node.children[a].prior = node.children[a].prior * (1 - frac) + n * frac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment