Skip to content

Instantly share code, notes, and snippets.

View jostmey's full-sized avatar

Jared Ostmeyer jostmey

View GitHub Profile
@jostmey
jostmey / RWACell.py
Last active September 8, 2018 21:05
Recurrent Weighted Average (RWA) model as a Tensorflow RNNCell
##########################################################################################
# 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.
"""
@shamatar
shamatar / rwa.py
Last active January 14, 2022 20:17
Keras (keras.is) implementation of Recurrent Weighted Average, as described in https://arxiv.org/abs/1703.01253. Follows original implementation in Tensorflow from https://github.com/jostmey/rwa. Works with fixed batch sizes, requires "batch_shape" parameter in input layer. Outputs proper config, should save and restore properly. You are welcome…
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
@chiral
chiral / rbm.R
Created March 30, 2014 13:09
Restricted Boltzmann Machine implementation in R and Julia (Julia version is much faster than R)
### 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)