class_docstr: Tests for pm.Bound distribution
class_docstr_tok: ["Tests","for","pm.Bound","distribution"]
code: def test_continuous(self):
      with pm.Model() as model:
          dist = pm.Normal.dist(mu=0, sigma=1)
          with pytest.warns(
              FutureWarning, match="Bound has been deprecated"
          ):
              with warnings.catch_warnings():
                  warnings.filterwarnings(
                      "ignore",
                      "invalid value encountered in add",
                      RuntimeWarning,
                  )
                  UnboundedNormal = pm.Bound(
                      "unbound", dist, transform=None
                  )
                  InfBoundedNormal = pm.Bound(
                      "infbound",
                      dist,
                      lower=-np.inf,
                      upper=np.inf,
                      transform=None,
                  )
              LowerNormal = pm.Bound(
                  "lower", dist, lower=0, transform=None
              )
              UpperNormal = pm.Bound(
                  "upper", dist, upper=0, transform=None
              )
              BoundedNormal = pm.Bound(
                  "bounded", dist, lower=1, upper=10, transform=None
              )
              LowerNormalTransform = pm.Bound(
                  "lowertrans", dist, lower=1
              )
              UpperNormalTransform = pm.Bound(
                  "uppertrans", dist, upper=10
              )
              BoundedNormalTransform = pm.Bound(
                  "boundedtrans", dist, lower=1, upper=10
              )
  
      assert (
          model.compile_fn(model.logp(LowerNormal), point_fn=False)(-1)
          == -np.inf
      )
      assert (
          model.compile_fn(model.logp(UpperNormal), point_fn=False)(1)
          == -np.inf
      )
      assert (
          model.compile_fn(model.logp(BoundedNormal), point_fn=False)(0)
          == -np.inf
      )
      assert (
          model.compile_fn(model.logp(BoundedNormal), point_fn=False)(
              11
          )
          == -np.inf
      )
  
      assert (
          model.compile_fn(model.logp(UnboundedNormal), point_fn=False)(
              0
          )
          != -np.inf
      )
      assert (
          model.compile_fn(model.logp(UnboundedNormal), point_fn=False)(
              11
          )
          != -np.inf
      )
      assert (
          model.compile_fn(
              model.logp(InfBoundedNormal), point_fn=False
          )(0)
          != -np.inf
      )
      assert (
          model.compile_fn(
              model.logp(InfBoundedNormal), point_fn=False
          )(11)
          != -np.inf
      )
  
      assert (
          model.compile_fn(
              model.logp(LowerNormalTransform), point_fn=False
          )(-1)
          != -np.inf
      )
      assert (
          model.compile_fn(
              model.logp(UpperNormalTransform), point_fn=False
          )(1)
          != -np.inf
      )
      assert (
          model.compile_fn(
              model.logp(BoundedNormalTransform), point_fn=False
          )(0)
          != -np.inf
      )
      assert (
          model.compile_fn(
              model.logp(BoundedNormalTransform), point_fn=False
          )(11)
          != -np.inf
      )
  
      ref_dist = pm.Normal.dist(mu=0, sigma=1)
      assert np.allclose(
          model.compile_fn(model.logp(UnboundedNormal), point_fn=False)(
              5
          ),
          pm.logp(ref_dist, 5).eval(),
      )
      assert np.allclose(
          model.compile_fn(model.logp(LowerNormal), point_fn=False)(5),
          pm.logp(ref_dist, 5).eval(),
      )
      assert np.allclose(
          model.compile_fn(model.logp(UpperNormal), point_fn=False)(-5),
          pm.logp(ref_dist, 5).eval(),
      )
      assert np.allclose(
          model.compile_fn(model.logp(BoundedNormal), point_fn=False)(
              5
          ),
          pm.logp(ref_dist, 5).eval(),
      )
  
file_path: pymc/tests/distributions/test_bound.py
imports: import warnings
  import numpy
  import pytest
  import scipy.stats
  from pytensor.tensor.random.op import RandomVariable
  import pymc
label_desc: Use image node_id 1 for calling the TestBound obj's underlying member method code with example usage: obj.test_continuous() without return types