jsat.distributions.discrete
Class Zipf
- java.lang.Object
-
- jsat.distributions.Distribution
-
- jsat.distributions.discrete.DiscreteDistribution
-
- jsat.distributions.discrete.Zipf
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable
public class Zipf extends DiscreteDistribution
This class provides an implementation of the Zipf distribution, a power-law type distribution for discrete values.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description Zipf()Creates a new Zipf distribution of infinite cardinality andskewnessof 1.Zipf(double skew)Creates a new Zipf distribution for a set of infinite cardinalityZipf(double cardinality, double skew)Creates a new Zipf distributionZipf(Zipf toCopy)Copy constructor
-
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.Zipfclone()doublegetCardinality()doublegetSkew()doubleinvCdf(double p)Computes the inverse Cumulative Density Function (CDF-1) at the given point.doublemax()The maximum value for which the#pdf(double)is meant to return a value.doublemean()Computes the mean 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)voidsetCardinality(double cardinality)Sets the cardinality of the distribution, defining the maximum number of items that Zipf can return.voidsetSkew(double skew)Sets the skewness of the distribution.doubleskewness()Computes the skewness of the distribution.doublevariance()Computes the variance of the distribution.-
Methods inherited from class jsat.distributions.discrete.DiscreteDistribution
cdf, logPmf
-
Methods inherited from class jsat.distributions.Distribution
median, sample, sampleVec, standardDeviation
-
-
-
-
Constructor Detail
-
Zipf
public Zipf(double cardinality, double skew)Creates a new Zipf distribution- Parameters:
cardinality- the number of possible selections (orDouble.POSITIVE_INFINITY)skew- the skewness of the distribution (must be positive value)
-
Zipf
public Zipf(double skew)
Creates a new Zipf distribution for a set of infinite cardinality- Parameters:
skew- the skewness of the distribution (must be positive value)
-
Zipf
public Zipf()
Creates a new Zipf distribution of infinite cardinality andskewnessof 1.
-
Zipf
public Zipf(Zipf toCopy)
Copy constructor- Parameters:
toCopy- the object to copy
-
-
Method Detail
-
setCardinality
public void setCardinality(double cardinality)
Sets the cardinality of the distribution, defining the maximum number of items that Zipf can return.- Parameters:
cardinality- the maximum output range of the distribution, can beinfinite.
-
getCardinality
public double getCardinality()
- Returns:
- the cardinality (maximum value) of the distribution
-
setSkew
public void setSkew(double skew)
Sets the skewness of the distribution. Lower values spread out the probability distribution, while higher values concentrate on the lowest ranks.- Parameters:
skew- the positive value for the distribution's skew
-
getSkew
public double getSkew()
- Returns:
- the skewness of the distribution
-
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)
-
invCdf
public double invCdf(double p)
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 classDiscreteDistribution- Parameters:
p- the probability value- Returns:
- the value such that the CDF would return p
-
clone
public Zipf clone()
- Specified by:
clonein classDiscreteDistribution
-
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
-
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.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG