mixle.utils.automatic.factories module¶
Estimator builders for automatically-typed data.
Builds estimators for mixle.stats. By default the plain maximum-likelihood estimators are produced; pass use_bstats=True to build the Bayesian path, which attaches the conjugate default prior for each family so estimation performs the closed-form conjugate / MAP update.
- get_optional_estimator(est, missing_value=None, use_bstats=False)[source]
- get_length_estimator(len_dict, pseudo_count=None, emp_suff_stat=True, use_bstats=False)[source]
Length model for sequences.
Observed lengths are often bounded protocol/domain facts, not Poisson counts, so use an integer categorical model while the support is small. Fall back to a Poisson only when length support is broad enough to look count-like.
- get_sequence_estimator(est, len_dict=None, pseudo_count=None, emp_suff_stat=True, use_bstats=False)[source]
- get_set_estimator(member_dict, num_sets, pseudo_count=None, emp_suff_stat=True, use_bstats=False)[source]
Bernoulli set model with membership probabilities from observed sets.
- get_ignored_estimator(use_bstats=False)[source]
- Parameters:
use_bstats (bool)
- Return type:
ParameterEstimator
- get_composite_estimator(ests, use_bstats=False)[source]
- get_dict_record_estimator(keys, ests)[source]
- get_categorical_estimator(vdict, pseudo_count=None, emp_suff_stat=True, use_bstats=False)[source]
- get_integer_categorical_estimator(vdict, pseudo_count=None, emp_suff_stat=True, use_bstats=False)[source]
- get_poisson_estimator(vdict, pseudo_count=None, emp_suff_stat=True, use_bstats=False)[source]
- get_gaussian_estimator(vdict, pseudo_count=None, emp_suff_stat=True, use_bstats=False)[source]
- get_lognormal_estimator(vdict, pseudo_count=None, emp_suff_stat=True, use_bstats=False)[source]
Return a LogGaussian (log-normal) estimator fit to the log of strictly-positive values.
- get_gamma_estimator(vdict, pseudo_count=None, emp_suff_stat=True, use_bstats=False)[source]
Return a Gamma estimator initialized from the method-of-moments fit of positive values.
- get_student_t_estimator(vdict, pseudo_count=None, emp_suff_stat=True, use_bstats=False)[source]
Return a fixed-df Student-t estimator; df is set from the excess kurtosis of the data.
- get_gaussian_mixture_estimator(vdict, pseudo_count=None, emp_suff_stat=True, use_bstats=False, n_components=2)[source]
Return a K-component Gaussian mixture estimator (robust init) for multimodal numeric data.
- get_multivariate_gaussian_estimator(dim, use_bstats=False)[source]
- get_dpm_mixture(data, rng=None, max_components=20, max_its=100, delta=1.0e-6, pseudo_count=1.0, print_iter=1, out=None)[source]
Fit a Dirichlet process mixture to automatically-typed data.
Component estimators are constructed with get_estimator(use_bstats=True) (one independent conjugate-prior instance per stick), and the truncated stick-breaking posterior is fit with variational inference via mixle.inference.estimation.fit.
- Parameters:
data – Sequence of observations of any auto-detectable type.
rng (Optional[RandomState]) – Source of randomness for initialization.
max_components (int) – Truncation level of the stick-breaking representation.
max_its (int) – Maximum number of variational iterations.
delta (float) – Stop when the ELBO improves by less than delta.
pseudo_count (Optional[float]) – Prior strength for the component priors.
print_iter (int) – Progress print frequency.
out – Output stream for iteration logging (defaults to sys.stdout).
- Returns:
DirichletProcessMixtureDistribution fit to the data.