jsat.distributions.discrete
Class Binomial
- java.lang.Object
-
- jsat.distributions.Distribution
-
- jsat.distributions.discrete.DiscreteDistribution
-
- jsat.distributions.discrete.Binomial
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable
public class Binomial extends DiscreteDistribution
The Binomial distribution is the distribution for the number of successful, independent, trials with a specific probability of success- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description Binomial()Creates a new Binomial distribution for 1 trial with a 0.5 probability of successBinomial(int trials, double p)Creates a new Binomial distribution
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublecdf(int x)Computes the value of the Cumulative Density Function (CDF) at the given point.Binomialclone()doublegetP()intgetTrials()doublelogPmf(int x)Computes the log of the Probability Mass Function.doublemax()The maximum value for which the#pdf(double)is meant to return a value.doublemean()Computes the mean value of the distributiondoublemedian()Computes the median value of the distributiondoublemin()The minimum value for which the#pdf(double)is meant to return a value.doublemode()Computes the mode of the distribution.doublepmf(int x)voidsetP(double p)Sets the probability of a trial being a successvoidsetTrials(int trials)The number of trials for the distributiondoubleskewness()Computes the skewness of the distribution.doublevariance()Computes the variance of the distribution.-
Methods inherited from class jsat.distributions.discrete.DiscreteDistribution
cdf, invCdf
-
Methods inherited from class jsat.distributions.Distribution
sample, sampleVec, standardDeviation
-
-
-
-
Constructor Detail
-
Binomial
public Binomial()
Creates a new Binomial distribution for 1 trial with a 0.5 probability of success
-
Binomial
public Binomial(int trials, double p)Creates a new Binomial distribution- Parameters:
trials- the number of independent trialsp- the probability of success
-
-
Method Detail
-
setTrials
public void setTrials(int trials)
The number of trials for the distribution- Parameters:
trials- the number of trials to perform
-
getTrials
public int getTrials()
-
setP
public void setP(double p)
Sets the probability of a trial being a success- Parameters:
p- the probability of success for each trial
-
getP
public double getP()
-
logPmf
public double logPmf(int x)
Description copied from class:DiscreteDistributionComputes the log of the Probability Mass Function. Note, that then the probability is zero,Double.NEGATIVE_INFINITYwould be the true value. Instead, this method will always return the negative ofDouble.MAX_VALUE. This is to avoid propagating bad values through computation.- Overrides:
logPmfin classDiscreteDistribution- Parameters:
x- the value to get the log(PMF) of- Returns:
- the value of log(PMF(x))
-
pmf
public double pmf(int x)
- Specified by:
pmfin classDiscreteDistribution
-
cdf
public double cdf(int x)
Description copied from class:DiscreteDistributionComputes the value of the Cumulative Density Function (CDF) at the given point. The CDF returns a value in the range [0, 1], indicating what portion of values occur at or below that point.- Specified by:
cdfin classDiscreteDistribution- Parameters:
x- the value to get the CDF of- Returns:
- the CDF(x)
-
mean
public double mean()
Description copied from class:DistributionComputes the mean value of the distribution- Specified by:
meanin classDistribution- Returns:
- the mean value of the distribution
-
median
public double median()
Description copied from class:DistributionComputes the median value of the distribution- Overrides:
medianin classDistribution- Returns:
- the median value of the distribution
-
mode
public double mode()
Description copied from class:DistributionComputes the mode of the distribution. Not all distributions have a mode for all parameter values.NaNmay be returned if the mode is not defined for the current values of the distribution.- Specified by:
modein classDistribution- Returns:
- the mode of the distribution
-
variance
public double variance()
Description copied from class:DistributionComputes the variance of the distribution. Not all distributions have a finite variance for all parameter values.NaNmay be returned if the variance is not defined for the current values of the distribution.Infinityis a possible value to be returned by some distributions.- Specified by:
variancein classDistribution- Returns:
- the variance of the distribution.
-
skewness
public double skewness()
Description copied from class:DistributionComputes the skewness of the distribution. Not all distributions have a finite skewness for all parameter values.NaNmay be returned if the skewness is not defined for the current values of the distribution.- Specified by:
skewnessin classDistribution- Returns:
- the skewness of the distribution.
-
min
public double min()
Description copied from class:DistributionThe minimum value for which the#pdf(double)is meant to return a value. Note thatDouble.NEGATIVE_INFINITYis a valid return value.- Specified by:
minin classDistribution- Returns:
- the minimum value for which the
#pdf(double)is meant to return a value.
-
max
public double max()
Description copied from class:DistributionThe maximum value for which the#pdf(double)is meant to return a value. Note thatDouble.POSITIVE_INFINITYis a valid return value.- Specified by:
maxin classDistribution- Returns:
- the maximum value for which the
#pdf(double)is meant to return a value.
-
clone
public Binomial clone()
- Specified by:
clonein classDiscreteDistribution
-
-
DataMelt 3.0 © DataMelt by jWork.ORG