C# Class NSoft.NFramework.Numerics.Distributions.Discrete.Categorical

Implements the categorical distribution. For details about this distribution, see Wikipedia - Categorical distribution. This distribution is sometimes called the Discrete distribution.

The distribution is parameterized by a vector of ratios: in other words, the parameter does not have to be normalized and sum to 1. The reason is that some vectors can't be exactly normalized to sum to 1 in floating point representation.

The distribution will use the System.Random by default. Users can set the random number generator by using the RandomSource property.

The statistics classes will check all the incoming parameters whether they are in the allowed range. This might involve heavy computation. Optionally, by setting Control.CheckDistributionParameters to false, all parameter checks can be turned off.

Inheritance: IDiscreteDistribution
Afficher le fichier Open project: debop/NFramework

Méthodes publiques

Méthode Description
Categorical ( Histogram histogram, Func randomFactory = null ) : System
Categorical ( double p, Func randomFactory = null ) : System
CumulativeDistribution ( double x ) : double

확률 분포 계산을 위한 누적분포함수

Probability ( int k ) : double

분포의 확률

ProbabilityLn ( int k ) : double

분포의 Log 확률

Sample ( ) : int

분포의 데이타를 반환합니다.

Samples ( ) : IEnumerable

분포의 무작위 데이타를 열거합니다.

ToString ( ) : string

Private Methods

Méthode Description
AssertParameters ( IEnumerable p ) : void
DoSamples ( Random rnd, double cdf ) : IEnumerable

Returns one trials from the categorical distribution.

SetParameters ( double p ) : void
UnnormalizedCdf ( double p ) : double[]

Computes the unnormalized cumulative distribution function. This method performs no parameter checking.

Method Details

Categorical() public méthode

public Categorical ( Histogram histogram, Func randomFactory = null ) : System
histogram NSoft.NFramework.Numerics.Statistics.Histogram
randomFactory Func
Résultat System

Categorical() public méthode

public Categorical ( double p, Func randomFactory = null ) : System
p double
randomFactory Func
Résultat System

CumulativeDistribution() public méthode

확률 분포 계산을 위한 누적분포함수
public CumulativeDistribution ( double x ) : double
x double The location at which to compute the cumulative distribution function.
Résultat double

Probability() public méthode

분포의 확률
public Probability ( int k ) : double
k int
Résultat double

ProbabilityLn() public méthode

분포의 Log 확률
public ProbabilityLn ( int k ) : double
k int
Résultat double

Sample() public méthode

분포의 데이타를 반환합니다.
public Sample ( ) : int
Résultat int

Samples() public méthode

분포의 무작위 데이타를 열거합니다.
public Samples ( ) : IEnumerable
Résultat IEnumerable

ToString() public méthode

public ToString ( ) : string
Résultat string