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
""" | |
This is a batched LSTM forward and backward pass | |
""" | |
import numpy as np | |
import code | |
class LSTM: | |
@staticmethod | |
def init(input_size, hidden_size, fancy_forget_bias_init = 3): |
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 | |
Korean translation | |
최소 버전의 단어 레벨 바닐라 RNN 모델. Andrej Karpathy (@karpathy) 작성 | |
- Korean comments | |
- Python3 compatibility update | |
""" |
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
import numpy as np | |
import tensorflow as tf | |
from tensorflow.python.framework import dtypes | |
# 1. Setting up initial values | |
x = np.zeros((7, 7, 3)) | |
x[:, :, 0] = np.mat( | |
"0 0 0 0 0 0 0;0 0 1 0 1 0 0;0 2 1 0 1 2 0;0 0 2 0 0 1 0;0 2 0 1 0 0 0;0 0 0 1 2 2 0;0 0 0 0 0 0 0" | |
).A |
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
import tensorflow as tf | |
import numpy as np | |
from tensorflow.python.ops import variable_scope | |
from tensorflow.python.ops import init_ops | |
from tensorflow.python.ops import array_ops | |
from tensorflow.python.ops import variables | |
from tensorflow.contrib.rnn.python.ops import rnn_cell | |
res = [] |
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
# From udacity Machine Learning Nanodegree course | |
import numpy as np | |
# Define sigmoid function | |
def sigmoid(x): | |
return 1/(1+np.exp(-x)) | |
# Derivative of the sigmoid function | |
def sigmoid_derivative(x): |
NewerOlder