Skip to content
Permalink
Browse files

remove logp from simulator (#3542)

* remove logp from simulator

* add docstring, remove unused import
  • Loading branch information...
aloctavodia authored and junpenglao committed Jul 10, 2019
1 parent 3873f3c commit 89bba1eef1118e1ac81ef17a3c98a872461a6a8d
Showing with 15 additions and 18 deletions.
  1. +15 −5 pymc3/distributions/distribution.py
  2. +0 −13 pymc3/distributions/simulator.py
@@ -134,10 +134,9 @@ def TensorType(dtype, shape, broadcastable=None):

class NoDistribution(Distribution):

def __init__(self, shape, dtype, testval=None, defaults=(),
transform=None, parent_dist=None, *args, **kwargs):
super().__init__(shape=shape, dtype=dtype,
testval=testval, defaults=defaults,
def __init__(self, shape, dtype, testval=None, defaults=(), transform=None, parent_dist=None,
*args, **kwargs):
super().__init__(shape=shape, dtype=dtype, testval=testval, defaults=defaults,
*args, **kwargs)
self.parent_dist = parent_dist

@@ -150,7 +149,18 @@ def __getattr__(self, name):
return getattr(self.parent_dist, name)

def logp(self, x):
return 0
"""Calculate log probability.
Parameters
----------
x : numeric
Value for which log-probability is calculated.
Returns
-------
TensorVariable
"""
return tt.zeros_like(x)


class Discrete(Distribution):
@@ -1,4 +1,3 @@
import theano.tensor as tt
import numpy as np
from .distribution import NoDistribution

@@ -38,18 +37,6 @@ def random(self, point=None, size=None):

raise NotImplementedError("Not implemented yet")

def logp(self, value):
"""
Parameters
----------
value : numeric
Value for which log-probability is calculated.
Returns
-------
TensorVariable
"""
return tt.zeros_like(value)

def _repr_latex_(self, name=None, dist=None):
if dist is None:
dist = self

0 comments on commit 89bba1e

Please sign in to comment.
You can’t perform that action at this time.