def output(self, input_value): if not self.training_state: return input_value theano_random = theano_random_stream() noise = theano_random.normal(size=input_value.shape, avg=self.mean, std=self.std) return input_value + noise
def output(self, input_value): if not self.training_state: return input_value theano_random = theano_random_stream() proba = 1.0 - self.proba mask = theano_random.binomial(n=1, p=proba, size=input_value.shape, dtype=input_value.dtype) return (mask * input_value) / proba
def output(self, input_value): if not self.training_state: return input_value theano_random = theano_random_stream() proba = (1.0 - self.proba) mask = theano_random.binomial(n=1, p=proba, size=input_value.shape, dtype=input_value.dtype) return (mask * input_value) / proba
def __init__(self, n_visible, n_hidden, **options): self.theano_random = theano_random_stream() super(ConfigurableABC, self).__init__(n_hidden=n_hidden, n_visible=n_visible, **options) self.weight = create_shared_parameter(value=self.weight, name='algo:rbm/matrix:weight', shape=(n_visible, n_hidden)) self.hidden_bias = create_shared_parameter( value=self.hidden_bias, name='algo:rbm/vector:hidden-bias', shape=(n_hidden, ), ) self.visible_bias = create_shared_parameter( value=self.visible_bias, name='algo:rbm/vector:visible-bias', shape=(n_visible, ), ) super(RBM, self).__init__(**options)
def __init__(self, n_visible, n_hidden, **options): self.theano_random = theano_random_stream() super(ConfigurableABC, self).__init__(n_hidden=n_hidden, n_visible=n_visible, **options) self.weight = create_shared_parameter( value=self.weight, name='algo:rbm/matrix:weight', shape=(n_visible, n_hidden) ) self.hidden_bias = create_shared_parameter( value=self.hidden_bias, name='algo:rbm/vector:hidden-bias', shape=(n_hidden,), ) self.visible_bias = create_shared_parameter( value=self.visible_bias, name='algo:rbm/vector:visible-bias', shape=(n_visible,), ) super(RBM, self).__init__(**options)
def output(self, *input_values): mu, sigma = input_values random = theano_random_stream() return mu + T.exp(sigma) * random.normal(mu.shape)
def __init__(self, n_hidden, **options): self.theano_random = theano_random_stream() super(RBM, self).__init__(n_hidden=n_hidden, **options)