jsat.distributions
Class Normal
- java.lang.Object
-
- jsat.distributions.Distribution
-
- jsat.distributions.ContinuousDistribution
-
- jsat.distributions.Normal
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable
public class Normal extends ContinuousDistribution
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description Normal()Normal(double mean, double stndDev)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublecdf(double x)Computes the value of the Cumulative Density Function (CDF) at the given point.static doublecdf(double x, double mu, double sigma)ContinuousDistributionclone()booleanequals(java.lang.Object obj)double[]getCurrentVariableValues()Returns an array, where each value contains the value of a parameter in the distribution.java.lang.StringgetDescriptiveName()The descriptive name of a distribution returns the name of the distribution, followed by the parameters of the distribution and their values.java.lang.StringgetDistributionName()Return the name of the distribution.java.lang.String[]getVariables()Returns an array, where each value contains the name of a parameter in the distribution.inthashCode()doubleinvCdf(double d)Computes the inverse Cumulative Density Function (CDF-1) at the given point.static doubleinvcdf(double x, double mu, double sigma)doubleinvPdf(double d)doublelogPdf(double x)Computes the log of the Probability Density Function.static doublelogPdf(double x, double mu, double sigma)Computes the log probability of a given valuedoublemax()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.doublepdf(double d)Computes the value of the Probability Density Function (PDF) at the given pointstatic doublepdf(double x, double mu, double sigma)voidsetMean(double mean)voidsetStndDev(double stndDev)voidsetUsingData(Vec data)Attempts to set the variables used by this distribution based on population sample data, assuming the sample data is from this type of distribution.voidsetVariable(java.lang.String var, double value)Sets one of the variables of this distribution by the name.doubleskewness()Computes the skewness of the distribution.doublestandardDeviation()Computes the standard deviation of the distribution.doublevariance()Computes the variance of the distribution.doublezTransform(double x)static doublezTransform(double x, double mu, double sigma)-
Methods inherited from class jsat.distributions.ContinuousDistribution
toString
-
Methods inherited from class jsat.distributions.Distribution
sample, sampleVec
-
-
-
-
Method Detail
-
setMean
public void setMean(double mean)
-
setStndDev
public void setStndDev(double stndDev)
-
cdf
public static double cdf(double x, double mu, double sigma)
-
cdf
public double cdf(double x)
Description copied from class:DistributionComputes 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.- Overrides:
cdfin classContinuousDistribution- Parameters:
x- the value to get the CDF of- Returns:
- the CDF(x)
-
invcdf
public static double invcdf(double x, double mu, double sigma)
-
invCdf
public double invCdf(double d)
Description copied from class:DistributionComputes the inverse Cumulative Density Function (CDF-1) at the given point. It takes in a value in the range of [0, 1] and returns the value x, such that CDF(x) = p- Overrides:
invCdfin classContinuousDistribution- Parameters:
d- the probability value- Returns:
- the value such that the CDF would return p
-
pdf
public static double pdf(double x, double mu, double sigma)
-
pdf
public double pdf(double d)
Description copied from class:ContinuousDistributionComputes the value of the Probability Density Function (PDF) at the given point- Specified by:
pdfin classContinuousDistribution- Parameters:
d- the value to get the PDF- Returns:
- the PDF(x)
-
logPdf
public static double logPdf(double x, double mu, double sigma)Computes the log probability of a given value- Parameters:
x- the value to the get log(pdf) ofmu- the mean of the distributionsigma- the standard deviation of the distribution- Returns:
- the log probability
-
logPdf
public double logPdf(double x)
Description copied from class:ContinuousDistributionComputes the log of the Probability Density 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:
logPdfin classContinuousDistribution- Parameters:
x- the value to get the log(PDF) of- Returns:
- the value of log(PDF(x))
-
invPdf
public double invPdf(double d)
-
zTransform
public static double zTransform(double x, double mu, double sigma)
-
zTransform
public double zTransform(double x)
-
getDescriptiveName
public java.lang.String getDescriptiveName()
Description copied from class:ContinuousDistributionThe descriptive name of a distribution returns the name of the distribution, followed by the parameters of the distribution and their values.- Overrides:
getDescriptiveNamein classContinuousDistribution- Returns:
- the name of the distribution that includes parameter values
-
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.
-
getDistributionName
public java.lang.String getDistributionName()
Description copied from class:ContinuousDistributionReturn the name of the distribution.- Specified by:
getDistributionNamein classContinuousDistribution- Returns:
- the name of the distribution.
-
getVariables
public java.lang.String[] getVariables()
Description copied from class:ContinuousDistributionReturns an array, where each value contains the name of a parameter in the distribution. The order must always be the same, and match up with the values returned byContinuousDistribution.getCurrentVariableValues()- Specified by:
getVariablesin classContinuousDistribution- Returns:
- a string of the variable names this distribution uses
-
setVariable
public void setVariable(java.lang.String var, double value)Description copied from class:ContinuousDistributionSets one of the variables of this distribution by the name.- Specified by:
setVariablein classContinuousDistribution- Parameters:
var- the variable to setvalue- the value to set
-
clone
public ContinuousDistribution clone()
- Specified by:
clonein classContinuousDistribution
-
setUsingData
public void setUsingData(Vec data)
Description copied from class:ContinuousDistributionAttempts to set the variables used by this distribution based on population sample data, assuming the sample data is from this type of distribution.- Specified by:
setUsingDatain classContinuousDistribution- Parameters:
data- the data to use to attempt to fit against
-
getCurrentVariableValues
public double[] getCurrentVariableValues()
Description copied from class:ContinuousDistributionReturns an array, where each value contains the value of a parameter in the distribution. The order must always be the same, and match up with the values returned byContinuousDistribution.getVariables()- Specified by:
getCurrentVariableValuesin classContinuousDistribution- Returns:
- the current values of the parameters used by this distribution, in the same order as their names are returned by
ContinuousDistribution.getVariables()
-
mean
public double mean()
Description copied from class:DistributionComputes the mean value of the distribution- Overrides:
meanin classContinuousDistribution- 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.- Overrides:
modein classContinuousDistribution- 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.- Overrides:
variancein classContinuousDistribution- Returns:
- the variance of the distribution.
-
standardDeviation
public double standardDeviation()
Description copied from class:DistributionComputes the standard deviation of the distribution. Not all distributions have a finite standard deviation 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.- Overrides:
standardDeviationin classDistribution- Returns:
- the standard deviation 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.- Overrides:
skewnessin classContinuousDistribution- Returns:
- the skewness of the distribution.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
-
DataMelt 3.0 © DataMelt by jWork.ORG