io.siddhi.extension.execution.streamingml.bayesian.model

## Class BernoulliDistribution

- java.lang.Object
- - io.siddhi.extension.execution.streamingml.bayesian.model.BernoulliDistribution

- All Implemented Interfaces:
    Serializable

      public class BernoulliDistribution
      extends Object

  implements BernoulliDistribution.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BernoulliDistribution(org.nd4j.autodiff.samediff.SDVariable logits, org.nd4j.autodiff.samediff.SameDiff sd)` Construct the bernoulli distribution.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `org.nd4j.autodiff.samediff.SDVariable` | `getProb()`
    `org.nd4j.autodiff.samediff.SDVariable` | `klDivergence(io.siddhi.extension.execution.streamingml.bayesian.model.Distribution distribution)` returns the kl divergence w.r.t the given distribution.
    `org.nd4j.autodiff.samediff.SDVariable` | `logProbability(org.nd4j.autodiff.samediff.SDVariable values)` returns the log probability p(x) given x.
    `org.nd4j.autodiff.samediff.SDVariable` | `sample()` returns a random sample from the distribution.
    `org.nd4j.autodiff.samediff.SDVariable` | `sample(int n)` returns random samples from the distribution.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### BernoulliDistribution

          public BernoulliDistribution(org.nd4j.autodiff.samediff.SDVariable logits,
                                       org.nd4j.autodiff.samediff.SameDiff sd)

      Construct the bernoulli distribution.
      Parameters:
        `logits` - should be 2-dimensional. the dimensions should follow the order (input_size, 1)
        `sd` - SameDiff context

  - ### Method Detail

    - #### logProbability

          public org.nd4j.autodiff.samediff.SDVariable logProbability(org.nd4j.autodiff.samediff.SDVariable values)

      returns the log probability p(x) given x.
      Parameters:
        `values` - x values
      Returns:
        a differentiable SameDiff variable

    - #### sample

          public org.nd4j.autodiff.samediff.SDVariable sample()

      returns a random sample from the distribution.
      Returns:
        a differentiable SameDiff variable

    - #### sample

          public org.nd4j.autodiff.samediff.SDVariable sample(int n)

      returns random samples from the distribution.
      Parameters:
        `n` - number of samples
      Returns:
        a differentiable SameDiff variable

    - #### klDivergence

          public org.nd4j.autodiff.samediff.SDVariable klDivergence(io.siddhi.extension.execution.streamingml.bayesian.model.Distribution distribution)
                                                             throws io.siddhi.core.exception.SiddhiAppCreationException

      returns the kl divergence w.r.t the given distribution.
      Parameters:
        `distribution` - reference distribution p(x)
      Returns:
        kl-divergence(this, p(x))
      Throws:
        `io.siddhi.core.exception.SiddhiAppCreationException`

    - #### getProb

          public org.nd4j.autodiff.samediff.SDVariable getProb()

Copyright © 2019 WSO2. All rights reserved.