metasyn.distribution.categorical.MultinoulliDistribution
- class metasyn.distribution.categorical.MultinoulliDistribution(labels, probs)
Categorical distribution using labels and probabilities.
This class represents a multinoulli (categorical) distribution. It is used in cases where there are multiple potential outcomes, each with a specified probability. The class stores the labels for each category and their corresponding probabilities.
- Parameters:
labels (list of str) – The labels for each category in the distribution, representing the possible outcomes.
probs (list of float) – The probabilities or frequencies of each category. These will be normalized internally.
Examples
>>> MultinoulliDistribution(labels=["a", "b", "b"], probs=[0.1, 0.3, 0.6]) >>> MultinoulliDistribution(labels=[1, 3, 6], probs=[0.3, 0.4, 0.3])
- name
core.multinoulli
- unique
False
- version
1.0
- var_type
[‘categorical’, ‘discrete’, ‘string’]
- __init__(labels, probs)
- Parameters:
labels (ndarray[tuple[Any, ...], dtype[str_ | int64]] | list[str | int])
probs (ndarray[tuple[Any, ...], dtype[float64]] | list[float])
Methods
__init__(labels, probs)default_distribution([var_type])Get a distribution with default parameters.
draw()Draw a random element from the fitted distribution.
draw_list(n)Draw a list of values from the distribution.
draw_reset()Reset the drawing of elements to start again.
from_dict(dist_dict)Create a distribution from a dictionary.
information_criterion(values)Get the BIC value for a particular set of values.
matches_name(name)Check whether the name matches the distribution.
provides_var_type(var_type)schema()Create sub-schema to validate GMF file.
to_dict()Convert the distribution to a dictionary.
Attributes
The identifier for the implemented distribution
Whether the distribution creates only unique values
The variable type of the distribution
Version of the implemented distribution