import tensorflow as tf

from .. import config
from ..distribution import Distribution


@Distribution
def Exponential(lambda_, name=None):
    X = tf.placeholder(config.dtype, name=name)

    Distribution.logp = tf.log(lambda_) - lambda_*X

    def cdf(lim):
        return tf.constant(1, dtype=config.dtype) - tf.exp(-lambda_*lim)

    Distribution.integral = lambda lower, upper: cdf(upper) - cdf(lower)

    return X

import tensorflow as tf

from .. import config
from ..distribution import Distribution


@Distribution
def Exponential(lambda_, name=None):
    X = tf.placeholder(config.dtype, name=name)

    Distribution.logp = tf.log(lambda_) - lambda_*X

    def integral(lower, upper):
        return tf.exp(-lambda_*lower) - tf.exp(-lambda_*upper)

    Distribution.integral = integral

    return X

Correct integral used for Exponential distributon
Correct integral used for Exponential distributon
