Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, vis_shape, n_hid,
encoders=None,
# intercepts=dists.Uniform(-1, 1),
intercepts=dists.Uniform(-0.5, -0.5),
# max_rates=dists.Uniform(150, 250),
# max_rates=dists.Uniform(1, 1),
max_rate=200,
mask=None, rf_shape=None, seed=None):
if seed is None:
seed = np.random.randint(2**31 - 1)
vis_shape = vis_shape if isinstance(vis_shape, tuple) else (vis_shape,)
n_vis = np.prod(vis_shape)
rng = np.random.RandomState(seed=seed)
# create initial parameters
if encoders is None:
encoders = rng.normal(size=(n_hid, n_vis))
def encoders_rates_intercepts(seed):
rng = np.random.RandomState(seed)
# encoders = UniformHypersphere(1, surface=True).sample(N, rng)
# intercepts = Uniform(-1, 1).sample(N, rng)
encoders = np.ones((N, 1))
intercepts = Uniform(-0.5, 0.8).sample(N, rng=rng)
max_rates = Uniform(200, 400).sample(N, rng=rng)
return encoders, max_rates, intercepts
def encoders_rates_intercepts(seed):
rng = np.random.RandomState(seed)
# encoders = UniformHypersphere(1, surface=True).sample(N, rng)
# intercepts = Uniform(-1, 1).sample(N, rng)
encoders = np.ones((N, 1))
intercepts = Uniform(-0.5, 0.8).sample(N, rng=rng)
max_rates = Uniform(200, 400).sample(N, rng=rng)
return encoders, max_rates, intercepts