view noise.py @ 431:0f8c81b0776d

Adding file make_test_datasets to host simple data-generating processes to create artificial datasets meant to test various learning algorithms.
author Yoshua Bengio <bengioy@iro.umontreal.ca>
date Tue, 29 Jul 2008 10:19:25 -0400
parents 643dbccde1fc
children
line wrap: on
line source

def binomial(input, rstate, p = 0.75):
    """
    Op to corrupt an input with binomial noise.
    Generate a noise vector of 1's and 0's (1 with probability p).
    We multiply this by the input.

    @note: See U{ssh://projects@lgcm.iro.umontreal.ca/repos/denoising_aa}
    to see how rstate is used.
    """
    noise = rstate.gen_like(('binomial',{'p': p, 'n': 1}), input)
    noise.name = 'noise'
    return noise * input