def model(): p_latent = numpyro.sample("p_latent", FakeBeta(alpha0, beta0)) with numpyro.plate("data", len(data)): numpyro.sample("obs", dist.Bernoulli(p_latent), obs=data) return p_latent
def guide(): probs = numpyro.param("probs", 0.2) numpyro.sample("x", dist.Bernoulli(probs))
def model(data): w = numpyro.sample("w", dist.Bernoulli(0.6)) x = 0 for i, y in markov(enumerate(data)): x = numpyro.sample(f"x_{i}", dist.Categorical(probs[w, x])) numpyro.sample(f"y_{i}", dist.Normal(locs[x], 1), obs=y)
def model(data): alpha = jnp.array([1.1, 1.1]) beta = jnp.array([1.1, 1.1]) p_latent = numpyro.sample("p_latent", dist.Beta(alpha, beta)) numpyro.sample("obs", dist.Bernoulli(p_latent), obs=data) return p_latent
def model(data, labels): dim = data.shape[1] coefs = numpyro.sample('coefs', dist.Normal(jnp.zeros(dim), jnp.ones(dim))) logits = jnp.dot(data, coefs) return numpyro.sample('obs', dist.Bernoulli(logits=logits), obs=labels)
def model(): numpyro.sample("c", dist.Bernoulli(0.8))
def model(data): x = numpyro.sample("x", dist.Bernoulli(0.5), infer={"enumerate": "parallel"}) with numpyro.plate("N", data.shape[0], subsample_size=100, dim=-1): batch = numpyro.subsample(data, event_dim=0) numpyro.sample("obs", dist.Normal(x, 1), obs=batch)
def model(data): f = sample('beta', dist.Beta(1., 1.)) sample('obs', dist.Bernoulli(f), obs=data)
def model(data): f = numpyro.sample("beta", dist.Beta(1.0, 1.0)) with numpyro.plate("plate", 10): numpyro.deterministic("beta_sq", f**2) numpyro.sample("obs", dist.Bernoulli(f), obs=data)
def model(data=None): with numpyro.plate("dim", 2): beta = numpyro.sample("beta", dist.Beta(1., 1.)) with numpyro.plate("plate", N, dim=-2): numpyro.deterministic("beta_sq", beta**2) numpyro.sample("obs", dist.Bernoulli(beta), obs=data)
def model(labels): coefs = numpyro.sample('coefs', dist.Normal(np.zeros(dim), np.ones(dim))) logits = numpyro.deterministic('logits', np.sum(coefs * data, axis=-1)) return numpyro.sample('obs', dist.Bernoulli(logits=logits), obs=labels)
def model(data): f = numpyro.sample("beta", dist.Beta(1., 1.)) with numpyro.plate("plate", 10): numpyro.sample("obs", dist.Bernoulli(f), obs=data)
def model(data=None): beta = numpyro.sample("beta", dist.Beta(np.ones(2), np.ones(2))) with numpyro.plate("plate", N, dim=-2): numpyro.sample("obs", dist.Bernoulli(beta), obs=data)
def model(data): f = numpyro.sample("beta", dist.Beta(1.0, 1.0)) with numpyro.plate("N", len(data)): numpyro.sample("obs", dist.Bernoulli(f), obs=data)
def model(): numpyro.sample("x", dist.Bernoulli(0.7).expand([3])) numpyro.sample("y", dist.Binomial(10, 0.3))
def model(data): f = numpyro.sample('beta', dist.Beta(jnp.ones(2), jnp.ones(2))) numpyro.sample('obs', dist.Bernoulli(f), obs=data)
def model(): numpyro.sample("x", dist.Bernoulli(0.7), infer={"enumerate": "parallel"}) y = numpyro.sample("y", dist.Binomial(10, 0.3)) numpyro.deterministic("y2", y ** 2)
def model(data, labels): coefs = numpyro.sample('coefs', dist.Normal(jnp.zeros(dim), jnp.ones(dim))) logits = jnp.sum(coefs * data, axis=-1) return numpyro.sample('obs', dist.Bernoulli(logits=logits), obs=labels)
def model(): numpyro.sample("c", dist.Bernoulli(0.8)) numpyro.sample( "u", dist.ImproperUniform(dist.constraints.unit_interval, (), ()) )
def model(data, labels): coefs = numpyro.sample("coefs", dist.Normal(jnp.zeros(dim), jnp.ones(dim))) offset = numpyro.sample("offset", dist.Uniform(-1, 1)) logits = offset + jnp.sum(coefs * data, axis=-1) return numpyro.sample("obs", dist.Bernoulli(logits=logits), obs=labels)
def discrete(prob): numpyro.sample("x", dist.Bernoulli(prob))
def model(data): f = numpyro.sample("beta", dist.Beta(1, 1)) with numpyro.plate("plate", 20, 10, dim=-1): numpyro.sample("obs", dist.Bernoulli(f), obs=data)
def model(labels): coefs = numpyro.sample("coefs", dist.Normal(jnp.zeros(dim), jnp.ones(dim))) logits = numpyro.deterministic("logits", jnp.sum(coefs * data, axis=-1)) return numpyro.sample("obs", dist.Bernoulli(logits=logits), obs=labels)
def model(data): f = numpyro.sample("beta", dist.Beta(jnp.ones(2), jnp.ones(2)).to_event()) with numpyro.plate("N", N): numpyro.sample("obs", dist.Bernoulli(f).to_event(1), obs=data)
def model(): numpyro.sample("x", dist.Bernoulli(0.5))
def model(labels): coefs = sample('coefs', dist.Normal(np.zeros(dim), np.ones(dim))) logits = np.sum(coefs * data, axis=-1) return sample('obs', dist.Bernoulli(logits=logits), obs=labels)
def model(data): f = numpyro.sample("beta", dist.Beta(1.0, 1.0)) numpyro.sample("obs", dist.Bernoulli(f), obs=data)
def model(data): alpha = np.array([1.1, 1.1]) beta = np.array([1.1, 1.1]) p_latent = sample('p_latent', dist.Beta(alpha, beta)) sample('obs', dist.Bernoulli(p_latent), obs=data) return p_latent
def model(data): y_prob = numpyro.sample("y_prob", dist.Beta(1., 1.)) with numpyro.plate("data", data.shape[0]): y = numpyro.sample("y", dist.Bernoulli(y_prob)) z = numpyro.sample("z", dist.Bernoulli(0.65 * y + 0.1)) numpyro.sample("obs", dist.Normal(2. * z, 1.), obs=data)
def model(): c = numpyro.sample("c", dist.Gamma(1, 1)) with handlers.collapse(): probs = numpyro.sample("probs", dist.Beta(c, 2)) numpyro.sample("obs", dist.Bernoulli(probs), obs=data)