How to use the pyhf.probability.Poisson function in pyhf

To help you get started, we’ve selected a few pyhf examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github scikit-hep / pyhf / tests / test_public_api.py View on Github external
def test_prob_models(backend):
    tb, _ = backend
    pyhf.probability.Poisson(tb.astensor([10.0])).log_prob(tb.astensor(2.0))
    pyhf.probability.Normal(tb.astensor([10.0]), tb.astensor([1])).log_prob(
        tb.astensor(2.0)
    )
github scikit-hep / pyhf / tests / test_probability.py View on Github external
def test_joint(backend):
    tb, _ = backend
    p1 = probability.Poisson(tb.astensor([10.0])).log_prob(tb.astensor(2.0))
    p2 = probability.Poisson(tb.astensor([10.0])).log_prob(tb.astensor(3.0))
    assert tb.tolist(probability.Simultaneous._joint_logpdf([p1, p2])) == tb.tolist(
        p1 + p2
    )
github scikit-hep / pyhf / tests / test_probability.py View on Github external
def test_poisson(backend):
    tb, _ = backend
    result = probability.Poisson(tb.astensor([10.0])).log_prob(tb.astensor(2.0))
    assert result.shape == (1,)

    result = probability.Poisson(tb.astensor([10.0, 10.0])).log_prob(tb.astensor(2.0))
    assert result.shape == (2,)

    result = probability.Poisson(tb.astensor([10.0, 10.0])).log_prob(
        tb.astensor([2.0, 3.0])
    )
    assert result.shape == (2,)

    result = probability.Poisson(tb.astensor([10.0, 10.0])).log_prob(
        tb.astensor([[2.0, 3.0]])
    )
    assert result.shape == (1, 2)
github scikit-hep / pyhf / tests / test_probability.py View on Github external
def test_independent(backend):
    tb, _ = backend
    result = probability.Independent(
        probability.Poisson(tb.astensor([10.0, 10.0]))
    ).log_prob(tb.astensor([2.0, 3.0]))

    p1 = probability.Poisson(tb.astensor([10.0])).log_prob(tb.astensor(2.0))
    p2 = probability.Poisson(tb.astensor([10.0])).log_prob(tb.astensor(3.0))
    assert tb.tolist(probability.Simultaneous._joint_logpdf([p1, p2]))[0] == tb.tolist(
        result
    )
    assert tb.tolist(probability.Simultaneous._joint_logpdf([p1, p2]))[0] == tb.tolist(
        result
    )
github scikit-hep / pyhf / tests / test_probability.py View on Github external
def test_poisson(backend):
    tb, _ = backend
    result = probability.Poisson(tb.astensor([10.0])).log_prob(tb.astensor(2.0))
    assert result.shape == (1,)

    result = probability.Poisson(tb.astensor([10.0, 10.0])).log_prob(tb.astensor(2.0))
    assert result.shape == (2,)

    result = probability.Poisson(tb.astensor([10.0, 10.0])).log_prob(
        tb.astensor([2.0, 3.0])
    )
    assert result.shape == (2,)

    result = probability.Poisson(tb.astensor([10.0, 10.0])).log_prob(
        tb.astensor([[2.0, 3.0]])
    )
    assert result.shape == (1, 2)
github scikit-hep / pyhf / tests / test_probability.py View on Github external
def test_independent(backend):
    tb, _ = backend
    result = probability.Independent(
        probability.Poisson(tb.astensor([10.0, 10.0]))
    ).log_prob(tb.astensor([2.0, 3.0]))

    p1 = probability.Poisson(tb.astensor([10.0])).log_prob(tb.astensor(2.0))
    p2 = probability.Poisson(tb.astensor([10.0])).log_prob(tb.astensor(3.0))
    assert tb.tolist(probability.Simultaneous._joint_logpdf([p1, p2]))[0] == tb.tolist(
        result
    )
    assert tb.tolist(probability.Simultaneous._joint_logpdf([p1, p2]))[0] == tb.tolist(
        result
    )