Skip to content

Commit

Permalink
improve docstrings of LinearGaussian and LinearStudentT
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasrothfuss committed Jan 23, 2019
1 parent e3bf7f9 commit 525ce20
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
3 changes: 2 additions & 1 deletion cde/density_simulation/LinearGaussian.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ class LinearGaussian(BaseConditionalDensitySimulation):
y = N(y | mean = mu_slope*x+mu, scale = std_slope*x+std)
Args:
ndim_x: number of dimensions of x
mu: the intercept of the mean line
mu_slope: the slope of the mean line
std: the intercept of the std dev. line
std_slope: the slope of the std. dev. line
random_seed: seed for the random_number generator
"""

def __init__(self, mu=0.0, ndim_x=1, mu_slope=0.005, std=0.01, std_slope=0.002, random_seed=None):
def __init__(self, ndim_x=1, mu=0.0, mu_slope=0.005, std=0.01, std_slope=0.002, random_seed=None):
assert std > 0
self.random_state = np.random.RandomState(seed=random_seed)
self.random_seed = random_seed
Expand Down
13 changes: 9 additions & 4 deletions cde/density_simulation/LinearStudentT.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,25 @@

class LinearStudentT(BaseConditionalDensitySimulation):
"""
A simple, Gaussian conditional distribution where
A conditional student-t distribution where
x = U(-1,1)
y = N(y | mean = mu_slope*x+mu, scale = std_slope*x+std)
x ~ N(x | 0,I)
y ~ Student-t(y | dof(x), loc(x), scale(x))
with
dof(x) = dof_low + (dof_high - dof_low) * sigmoid(- 2*x)
loc(x) = mu_slope*x+mu
scale(x) = std_slope*x+std
Args:
ndim_x: number of dimensions of x
mu: the intercept of the mean line
mu_slope: the slope of the mean line
std: the intercept of the std dev. line
std_slope: the slope of the std. dev. line
random_seed: seed for the random_number generator
"""

def __init__(self, mu=0.0, ndim_x=10, mu_slope=0.005, std=0.01, std_slope=0.002, dof_low=2, dof_high=10, random_seed=None):
def __init__(self, ndim_x=10, mu=0.0, mu_slope=0.005, std=0.01, std_slope=0.002, dof_low=2, dof_high=10, random_seed=None):
assert std > 0
self.random_state = np.random.RandomState(seed=random_seed)
self.random_seed = random_seed
Expand Down

0 comments on commit 525ce20

Please sign in to comment.