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
loss_grad = grad(loss) | |
loss_grad(circles) # this gives us the gradient with respect to the circles |
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 loss(circles): | |
return ((render(circles) - target) ** 2).sum() |
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
use std::env; | |
const EMPTY_NODE_ID: usize = 0; | |
// an intermediate representation for symbol data during the parse step | |
#[derive(Clone, Debug, PartialEq)] | |
struct ParseSymbol { | |
string: String, | |
debug_program_position: usize, | |
} |
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 | |
from bintrees import FastAVLTree as AVLTree | |
import random | |
import time | |
def weightedRandom(weights): | |
""" | |
Draw from a general discrete distribution. | |
:param weights: A dictionary of weights that must sum to one. | |
:return: A random sample from it the distribution defined by the weights. |
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 random | |
class QLearner: | |
def __init__(self, num_actions): | |
#play around with these parameters for different results | |
self.learning_rate = 0.03 | |
self.discount_factor = 0.65 | |
self.num_actions = num_actions | |
self.last_state = None | |
self.last_action = None |