This file contains 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
""" | |
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) |
This file contains 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
class MultipleFieldLookupORMixin(object): | |
""" | |
Actual code http://www.django-rest-framework.org/api-guide/generic-views/#creating-custom-mixins | |
Apply this mixin to any view or viewset to get multiple field filtering | |
based on a `lookup_fields` attribute, instead of the default single field filtering. | |
""" | |
def get_object(self): | |
queryset = self.get_queryset() # Get the base queryset | |
queryset = self.filter_queryset(queryset) # Apply any filter backends | |
filter = {} |
This file contains 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
# Author: Kyle Kastner | |
# License: BSD 3-Clause | |
# Implementing http://mnemstudio.org/path-finding-q-learning-tutorial.htm | |
# Q-learning formula from http://sarvagyavaish.github.io/FlappyBirdRL/ | |
# Visualization based on code from Gael Varoquaux [email protected] | |
# http://scikit-learn.org/stable/auto_examples/applications/plot_stock_market.html | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from matplotlib.collections import LineCollection |