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: Jared L. Ostmeyer | |
# Date Started: 2017-04-11 | |
# Purpose: Recurrent weighted average cell for tensorflow. | |
########################################################################################## | |
"""Implementation of recurrent weighted average cell as a TensorFlow module. See | |
https://arxiv.org/abs/1703.01253 for a mathematical description of the model. | |
""" |
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 keras.layers import Recurrent | |
import keras.backend as K | |
from keras import activations | |
from keras import initializers | |
from keras import regularizers | |
from keras import constraints | |
from keras.engine import Layer | |
from keras.engine import InputSpec | |
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
### Restricted Boltzmann Machine implementation by isobe | |
sigmoid <- function(x) 1/(1+exp(-x)) | |
rbm <- function(obs,n_hidden,eta=0.05, | |
epsilon=0.05,maxiter=100, | |
CD_k=1,reconstruct_trial=10, | |
verbose=0) { | |
L <- nrow(obs) | |
N <- ncol(obs) |