Skip to content

Instantly share code, notes, and snippets.

View yaoyichen's full-sized avatar

Eason Yao yaoyichen

  • Tsinghua University
View GitHub Profile
@yaoyichen
yaoyichen / min-char-rnn.py
Created December 15, 2017 09:20 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@yaoyichen
yaoyichen / dijkstra.py
Created August 27, 2017 14:46 — forked from mdsrosa/dijkstra.py
Modified Python implementation of Dijkstra's Algorithm (https://gist.github.com/econchick/4666413)
from collections import defaultdict, deque
class Graph(object):
def __init__(self):
self.nodes = set()
self.edges = defaultdict(list)
self.distances = {}
def add_node(self, value):