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 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
""" | |
Create train, valid, test iterators for CIFAR-10 [1]. | |
Easily extended to MNIST, CIFAR-100 and Imagenet. | |
[1]: https://discuss.pytorch.org/t/feedback-on-pytorch-for-kaggle-competitions/2252/4 | |
""" | |
import torch | |
import numpy as np |
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
X = np.array([ [0,0,1],[0,1,1],[1,0,1],[1,1,1] ]) | |
y = np.array([[0,1,1,0]]).T | |
syn0 = 2*np.random.random((3,4)) - 1 | |
syn1 = 2*np.random.random((4,1)) - 1 | |
for j in xrange(60000): | |
l1 = 1/(1+np.exp(-(np.dot(X,syn0)))) | |
l2 = 1/(1+np.exp(-(np.dot(l1,syn1)))) | |
l2_delta = (y - l2)*(l2*(1-l2)) | |
l1_delta = l2_delta.dot(syn1.T) * (l1 * (1-l1)) | |
syn1 += l1.T.dot(l2_delta) |
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) |