Mercurial > pylearn
changeset 1296:b9bc9d5a08cc
Some language fixes (don't capitalize 'variable', changement->change.
author | David Warde-Farley <wardefar@iro.umontreal.ca> |
---|---|
date | Fri, 01 Oct 2010 11:55:04 -0400 |
parents | 7af2a89bff3d |
children | 24890ca1d96b |
files | pylearn/formulas/noise.py |
diffstat | 1 files changed, 10 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/pylearn/formulas/noise.py Fri Oct 01 11:47:53 2010 -0400 +++ b/pylearn/formulas/noise.py Fri Oct 01 11:55:04 2010 -0400 @@ -2,8 +2,8 @@ This script define the different symbolic noise functions. The noise contract is simple: noise_lvl is a symbolic variable going from 0 to 1. -0: no changement. -1: max noise. +0: no change. +1: maximum noise. """ import theano from tags import tags @@ -21,12 +21,13 @@ @tags('noise','binomial','salt') def binomial_noise(theano_rng,inp,noise_lvl): - """ This add binomial noise to inp. Only the salt part of pepper and salt. + """ + This add binomial noise to inp. Only the salt part of pepper and salt. - :type inp: Theano Variable + :type inp: Theano variable :param inp: The input that we want to add noise :type noise_lvl: float - :param noise_lvl: The % of noise. Between 0(no noise) and 1. + :param noise_lvl: The %% of noise. Between 0 (no noise) and 1. """ return theano_rng.binomial( size = inp.shape, n = 1, p = 1 - noise_lvl, dtype=theano.config.floatX) * inp @@ -34,11 +35,11 @@ @tags('noise','binomial NLP','pepper','salt') def pepper_and_salt_noise(theano_rng,inp,noise_lvl): """ This add pepper and salt noise to inp - - :type inp: Theano Variable + + :type inp: Theano variable :param inp: The input that we want to add noise :type noise_lvl: tuple(float,float) - :param noise_lvl: The % of noise for the salt and pepper. Between 0(no noise) and 1. + :param noise_lvl: The %% of noise for the salt and pepper. Between 0 (no noise) and 1. """ return theano_rng.binomial( size = inp.shape, n = 1, p = 1 - noise_lvl[0], dtype=theano.config.floatX) * inp \ + (inp==0) * theano_rng.binomial( size = inp.shape, n = 1, p = noise_lvl[1], dtype=theano.config.floatX) @@ -47,7 +48,7 @@ def gaussian_noise(theano_rng,inp,noise_lvl): """ This add gaussian NLP noise to inp - :type inp: Theano Variable + :type inp: Theano variable :param inp: The input that we want to add noise :type noise_lvl: float :param noise_lvl: The standard deviation of the gaussian.