Header menu logo FSharp.Stats

LabelledCategorical<'Label> Type

A wrapper around the Categorical distribution that associates each probability with a custom label of type 'Label.

Constructors

Constructor Description

LabelledCategorical(labels, probs)

Full Usage: LabelledCategorical(labels, probs)

Parameters:
    labels : 'Label[] - An array of labels for each category (must be unique).
    probs : float[] - An array of probabilities for each label (must sum to 1).

Returns: LabelledCategorical<'Label>

Initializes a new instance of the LabelledCategorical distribution using label-probability pairs.

labels : 'Label[]

An array of labels for each category (must be unique).

probs : float[]

An array of probabilities for each label (must sum to 1).

Returns: LabelledCategorical<'Label>

Instance members

Instance member Description

this.CDF

Full Usage: this.CDF

Parameters:
    label : 'Label - The label to evaluate the cumulative probability up to.

Returns: float The cumulative probability.

Returns the cumulative probability up to and including the given label.

label : 'Label

The label to evaluate the cumulative probability up to.

Returns: float

The cumulative probability.

this.Labels

Full Usage: this.Labels

Returns: 'Label[]

Gets the array of category labels.

Returns: 'Label[]

this.MeanLabel

Full Usage: this.MeanLabel

Returns: 'Label The label whose index is closest to the mean.

Returns the label closest to the expected (mean) index of the distribution.

Returns: 'Label

The label whose index is closest to the mean.

this.PMF

Full Usage: this.PMF

Parameters:
    label : 'Label - The label to query.

Returns: float The probability associated with the label, or 0.0 if the label is not found.

Returns the probability of a given label.

label : 'Label

The label to query.

Returns: float

The probability associated with the label, or 0.0 if the label is not found.

this.Probabilities

Full Usage: this.Probabilities

Returns: float[]

Gets the array of probabilities associated with the labels.

Returns: float[]

this.Sample

Full Usage: this.Sample

Returns: 'Label A label corresponding to a sampled category.

Draws a random sample from the distribution and returns the sampled label.

Returns: 'Label

A label corresponding to a sampled category.

this.Support

Full Usage: this.Support

Returns: 'Label[]

Returns the array of labels (support of the distribution).

Returns: 'Label[]

Static members

Static member Description

LabelledCategorical.Estimate(labels) (counts)

Full Usage: LabelledCategorical.Estimate(labels) (counts)

Parameters:
    labels : 'Label[] - An array of labels.
    counts : int[] - An array of counts corresponding to each label.

Returns: LabelledCategorical<'Label> A new LabelledCategorical distribution.

Estimates a distribution from labels and counts (frequencies).

labels : 'Label[]

An array of labels.

counts : int[]

An array of counts corresponding to each label.

Returns: LabelledCategorical<'Label>

A new LabelledCategorical distribution.

LabelledCategorical.Fit(observations)

Full Usage: LabelledCategorical.Fit(observations)

Parameters:
    observations : 'Label[] - An array of observed labels.

Returns: LabelledCategorical<'Label> A new LabelledCategorical distribution with probabilities estimated from observed frequencies.

Fits a LabelledCategorical distribution from a set of labeled observations.

observations : 'Label[]

An array of observed labels.

Returns: LabelledCategorical<'Label>

A new LabelledCategorical distribution with probabilities estimated from observed frequencies.

LabelledCategorical.FromCdfUnnormalized(labels, cdf)

Full Usage: LabelledCategorical.FromCdfUnnormalized(labels, cdf)

Parameters:
    labels : 'Label[] - Labels corresponding to cumulative weights.
    cdf : float[] - Unnormalized cumulative weights (must be increasing).

Returns: LabelledCategorical<'Label> A normalized LabelledCategorical distribution.

Initializes a LabelledCategorical distribution from labels and a cumulative unnormalized weight vector.

labels : 'Label[]

Labels corresponding to cumulative weights.

cdf : float[]

Unnormalized cumulative weights (must be increasing).

Returns: LabelledCategorical<'Label>

A normalized LabelledCategorical distribution.

Type something to start searching.