Skip to content

Instantly share code, notes, and snippets.

@hyponymous
hyponymous / gridworld.js
Last active February 10, 2017 00:06
Gridworld I — SARSA(λ)
/* global d3, _ */
var CONFIG = {
transitionDuration: 0,
stepDelay: 10,
// learning rate
alpha: 0.1,
// deviation from greediness
epsilon: 1e-2,
// reward discount factor
import copy
# fun from Ernest!
#
# Given two strings s and t, determine whether some anagram of t is a substring of s.
# For example: if s = "udacity" and t = "ad", then the function returns True.
# Your function definition should look like: question1(s, t) and return a boolean True or False.
def q_mike(s, t):
def add_to_hist(c, hist):
#!/usr/bin/env python
import itertools
import numpy as np
N = 1000
d = 500
x_normal = np.random.multivariate_normal([0], [[1]], [N, d]).reshape([N, d])
x_spherical = x_normal / np.linalg.norm(x_normal, axis=1)[:, np.newaxis]
@hyponymous
hyponymous / index.html
Created April 12, 2020 00:35
Multilane Timeline in d3
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.15/lodash.min.js"> </script>
<script src="https://d3js.org/d3.v5.min.js"></script>
<style type="text/css">
.timeline {
pointer-events: all;
}