public class BinomialDistribution extends BaseDistribution
org.apache.commons.math3.distribution.BinomialDistributionrandom, solverAbsoluteAccuracy| Constructor and Description |
|---|
BinomialDistribution(int trials,
double p)
Create a binomial distribution with the given number of trials and
probability of success.
|
BinomialDistribution(int n,
INDArray p) |
BinomialDistribution(Random rng,
int trials,
double p)
Creates a binomial distribution.
|
| Modifier and Type | Method and Description |
|---|---|
double |
cumulativeProbability(double x)
For a random variable
X whose values are distributed according
to this distribution, this method returns P(X <= x). |
double |
cumulativeProbability(double x0,
double x1)
For a random variable
X whose values are distributed according
to this distribution, this method returns P(x0 < X <= x1). |
double |
cumulativeProbability(int x) |
double |
density(double x)
Returns the probability density function (PDF) of this distribution
evaluated at the specified point
x. |
int |
getNumberOfTrials()
Access the number of trials for this distribution.
|
double |
getNumericalMean()
Use this method to get the numerical value of the mean of this
distribution.
|
double |
getNumericalVariance()
Use this method to get the numerical value of the variance of this
distribution.
|
double |
getProbabilityOfSuccess()
Access the probability of success for this distribution.
|
double |
getSupportLowerBound()
Access the lower bound of the support.
|
double |
getSupportUpperBound()
Access the upper bound of the support.
|
boolean |
isSupportConnected()
Use this method to get information about whether the support is connected,
i.e.
|
boolean |
isSupportLowerBoundInclusive()
Whether or not the lower bound of support is in the domain of the density
function.
|
boolean |
isSupportUpperBoundInclusive()
Whether or not the upper bound of support is in the domain of the density
function.
|
double |
probability(int x) |
INDArray |
sample(INDArray ret)
Fill the target array by sampling from the distribution
|
INDArray |
sample(int[] shape)
Sample the given shape
|
getSolverAbsoluteAccuracy, inverseCumulativeProbability, probability, probability, reseedRandomGenerator, sample, samplepublic BinomialDistribution(int trials,
double p)
trials - Number of trials.p - Probability of success.org.apache.commons.math3.exception.NotPositiveException - if trials < 0.org.apache.commons.math3.exception.OutOfRangeException - if p < 0 or p > 1.public BinomialDistribution(Random rng, int trials, double p)
rng - Random number generator.trials - Number of trials.p - Probability of success.org.apache.commons.math3.exception.NotPositiveException - if trials < 0.org.apache.commons.math3.exception.OutOfRangeException - if p < 0 or p > 1.public BinomialDistribution(int n,
INDArray p)
public int getNumberOfTrials()
public double getProbabilityOfSuccess()
public double probability(int x)
public double cumulativeProbability(int x)
public double density(double x)
Distributionx. In general, the PDF is
the derivative of the CDF.
If the derivative does not exist at x, then an appropriate
replacement should be returned, e.g. Double.POSITIVE_INFINITY,
Double.NaN, or the limit inferior or limit superior of the
difference quotient.x - the point at which the PDF is evaluatedxpublic double cumulativeProbability(double x)
DistributionX whose values are distributed according
to this distribution, this method returns P(X <= x). In other
words, this method represents the (cumulative) distribution function
(CDF) for this distribution.x - the point at which the CDF is evaluatedxpublic double cumulativeProbability(double x0,
double x1)
throws org.apache.commons.math3.exception.NumberIsTooLargeException
DistributionX whose values are distributed according
to this distribution, this method returns P(x0 < X <= x1).x0 - the exclusive lower boundx1 - the inclusive upper boundx0 and x1,
excluding the lower and including the upper endpointorg.apache.commons.math3.exception.NumberIsTooLargeException - if x0 > x1public double getNumericalMean()
n trials and probability parameter p, the mean is
n * p.Double.NaN if it is not definedpublic double getNumericalVariance()
n trials and probability parameter p, the variance is
n * p * (1 - p).Double.POSITIVE_INFINITY as
for certain cases in org.apache.commons.math3.distribution.TDistribution) or Double.NaN if it
is not definedpublic double getSupportLowerBound()
inverseCumulativeProbability(0). In other words, this
method must return
inf {x in R | P(X <= x) > 0}.
p = 1.public double getSupportUpperBound()
inverseCumulativeProbability(1). In other words, this
method must return
inf {x in R | P(X <= x) = 1}.
p = 0.public boolean isSupportLowerBoundInclusive()
DistributiongetSupporLowerBound() is finite and
density(getSupportLowerBound()) returns a non-NaN, non-infinite
value.public boolean isSupportUpperBoundInclusive()
DistributiongetSupportUpperBound() is finite and
density(getSupportUpperBound()) returns a non-NaN, non-infinite
value.public boolean isSupportConnected()
truepublic INDArray sample(int[] shape)
Distributionsample in interface Distributionsample in class BaseDistributionshape - the given shapepublic INDArray sample(INDArray ret)
Distributionsample in interface Distributionsample in class BaseDistributionret - target arrayCopyright © 2018. All rights reserved.