Mercurial > ift6266
comparison transformations/affine_transform.py @ 154:ce56e8ca960d
Checked all modules to work with only numpy.random and random and to be deterministic after numpy.random.seed() and random.seed()
author | boulanni <nicolas_boulanger@hotmail.com> |
---|---|
date | Wed, 24 Feb 2010 16:59:04 -0500 |
parents | b852dddf43a6 |
children |
comparison
equal
deleted
inserted
replaced
153:041d68b34b70 | 154:ce56e8ca960d |
---|---|
14 | 14 |
15 | 15 |
16 class AffineTransformation(): | 16 class AffineTransformation(): |
17 def __init__( self, complexity = .5): | 17 def __init__( self, complexity = .5): |
18 self.shape = (32,32) | 18 self.shape = (32,32) |
19 self.rng = numpy.random.RandomState() | |
20 self.complexity = complexity | 19 self.complexity = complexity |
21 params = self.rng.uniform(size=6) -.5 | 20 params = numpy.random.uniform(size=6) -.5 |
22 self.a = 1. + params[0]*.6*complexity | 21 self.a = 1. + params[0]*.6*complexity |
23 self.b = 0. + params[1]*.6*complexity | 22 self.b = 0. + params[1]*.6*complexity |
24 self.c = params[2]*8.*complexity | 23 self.c = params[2]*8.*complexity |
25 self.d = 0. + params[3]*.6*complexity | 24 self.d = 0. + params[3]*.6*complexity |
26 self.e = 1. + params[4]*.6*complexity | 25 self.e = 1. + params[4]*.6*complexity |
41 # y' = params[3]*x + params[4]*y _ params[5] | 40 # y' = params[3]*x + params[4]*y _ params[5] |
42 | 41 |
43 # the ranges are set manually as to look acceptable | 42 # the ranges are set manually as to look acceptable |
44 | 43 |
45 self.complexity = complexity | 44 self.complexity = complexity |
46 params = self.rng.uniform(size=6) -.5 | 45 params = numpy.random.uniform(size=6) -.5 |
47 self.a = 1. + params[0]*.8*complexity | 46 self.a = 1. + params[0]*.8*complexity |
48 self.b = 0. + params[1]*.8*complexity | 47 self.b = 0. + params[1]*.8*complexity |
49 self.c = params[2]*9.*complexity | 48 self.c = params[2]*9.*complexity |
50 self.d = 0. + params[3]*.8*complexity | 49 self.d = 0. + params[3]*.8*complexity |
51 self.e = 1. + params[4]*.8*complexity | 50 self.e = 1. + params[4]*.8*complexity |