MultinomialEstimator

class pqp.estimation.MultinomialEstimator(data, observed=None, prior=0, coerce=True)

Bases: Estimator

Estimates the distribution of a categorical variable using a multinomial likelihood and dirichlet prior

At a basic level, this estimator estimates the probability of an observation using the proportion of past observations which are identical. When prior is set to zero, this is exactly what it does, and positivty is not guaranteed.

If you set prior to a positive value, this is interpreted as a number of “virtual” observations. The estimator behaves as if, before fitting to the data, it had already seen this many data points. It distributes this likelihood evenly across all possible observations in the domain of the variables. This guarantess positivity.

Parameters:
  • data (Data) – The data to use for the distribution

  • observed (list) – The variables which are considered observed, defaults to all

  • prior (float) – The prior strength, defaults to 0

  • coerce (bool) – If True, coerce the data to a Data object, defaults to True

Methods Summary

domain_of(var)

Return the domain of a Variable

estimate(**kwargs)

Estimate the value of an expression

get_observed()

Return the set of Variables that are considered observed in the model

Methods Documentation

domain_of(var)

Return the domain of a Variable

Parameters:

var (Variable or str) – The variable to get the domain of

Returns:

the domain of the variable

Return type:

Domain

estimate(**kwargs)

Estimate the value of an expression

Parameters:
  • expr (AbstractExpression) – The expression to estimate

  • assignments (dict) – dict of variable assignments (optional)

Returns:

the result of the estimation

Return type:

EstimationResult

get_observed()

Return the set of Variables that are considered observed in the model

Returns:

the observed variables

Return type:

set