Created
October 22, 2010 18:13
-
-
Save pearcemc/641076 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scipy as sp | |
class PDimClass: | |
""" | |
A p-dimensional class, which takes a list of Normal distribution parameters, | |
each of which defines a dimension | |
""" | |
#a list of normal distribution parameter tuples, for N(mean, sd) | |
params = [(0,1), (0,1)] | |
def __init__(self, params=None): | |
if params: | |
self.params = params | |
def generate(self): | |
point = [] | |
for dimension in self.params: | |
#the dimension value = (random number from standard normal distribution * sd) + mean | |
value = (sp.randn()*dimension[1]) + dimension[0] | |
point.append(value) | |
return tuple(point) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment