Skip to content

Family metadata

Transpilation metadata for registered distribution families.

family_meta

Transpilation metadata for registered distribution families.

FamilyMeta records target names, argument aliases, runtime classes, and event ranks not supplied uniformly by PyTorch. This module also defines the finite atom sets and weights used to lower marginalize blocks. Minimal distribution classes expose constraints for families without a direct torch.distributions class.

FAMILY_META module-attribute

FAMILY_META: dict[str, FamilyMeta] = {'Normal': FamilyMeta(qvr_name='Normal', distribution_class=td.Normal, quivers_class=ConditionalNormal, target_names={'stan': 'normal', 'numpyro': 'Normal', 'pyro': 'Normal', 'pymc': 'Normal', 'edward2': 'Normal', 'turing': 'Normal', 'gen': 'normal', 'church': 'gaussian', 'webppl': 'Gaussian', 'bugs': 'dnorm', 'jags': 'dnorm'}, arg_aliases={'bugs': {'scale': 'tau'}, 'jags': {'scale': 'tau'}, 'pymc': {'loc': 'mu', 'scale': 'sigma'}, 'webppl': {'loc': 'mu', 'scale': 'sigma'}}), 'LogitNormal': FamilyMeta(qvr_name='LogitNormal', distribution_class=_LogitNormal, quivers_class=ConditionalLogitNormal, target_names={'stan': 'logit_normal', 'numpyro': 'LogitNormal', 'pyro': 'LogitNormal', 'pymc': 'LogitNormal', 'edward2': 'LogitNormal'}, arg_aliases={'pymc': {'loc': 'mu', 'scale': 'sigma'}}), 'Beta': FamilyMeta(qvr_name='Beta', distribution_class=td.Beta, quivers_class=ConditionalBeta, target_names={'stan': 'beta', 'numpyro': 'Beta', 'pyro': 'Beta', 'pymc': 'Beta', 'edward2': 'Beta', 'turing': 'Beta', 'gen': 'beta', 'church': 'beta', 'webppl': 'Beta', 'bugs': 'dbeta', 'jags': 'dbeta'}, arg_aliases={'pymc': {'concentration1': 'alpha', 'concentration0': 'beta'}, 'webppl': {'concentration1': 'a', 'concentration0': 'b'}}), 'TruncatedNormal': FamilyMeta(qvr_name='TruncatedNormal', distribution_class=_TruncatedNormal, quivers_class=ConditionalTruncatedNormal, target_names={'numpyro': 'TruncatedNormal', 'pyro': 'TruncatedNormal', 'pymc': 'TruncatedNormal', 'edward2': 'TruncatedNormal', 'turing': 'truncated', 'gen': 'truncated_normal', 'stan': 'normal', 'bugs': 'dnorm', 'jags': 'dnorm'}, arg_aliases={'pymc': {'loc': 'mu', 'scale': 'sigma', 'low': 'lower', 'high': 'upper'}, 'bugs': {'scale': 'tau'}, 'jags': {'scale': 'tau'}}), 'Dirichlet': FamilyMeta(qvr_name='Dirichlet', event_rank=1, distribution_class=td.Dirichlet, quivers_class=ConditionalDirichlet, target_names={'stan': 'dirichlet', 'numpyro': 'Dirichlet', 'pyro': 'Dirichlet', 'pymc': 'Dirichlet', 'edward2': 'Dirichlet', 'turing': 'Dirichlet', 'gen': 'dirichlet', 'church': 'dirichlet', 'webppl': 'Dirichlet', 'bugs': 'ddirch', 'jags': 'ddirich'}, arg_aliases={'pymc': {'concentration': 'a'}, 'webppl': {'concentration': 'alpha'}}), 'Cauchy': FamilyMeta(qvr_name='Cauchy', distribution_class=td.Cauchy, quivers_class=ConditionalCauchy, target_names={'stan': 'cauchy', 'numpyro': 'Cauchy', 'pyro': 'Cauchy', 'pymc': 'Cauchy', 'edward2': 'Cauchy', 'turing': 'Cauchy', 'gen': 'cauchy', 'church': 'cauchy', 'webppl': 'Cauchy', 'bugs': 'dt', 'jags': 'dt'}, arg_aliases={'bugs': {'scale': 'tau'}, 'jags': {'scale': 'tau'}, 'pymc': {'loc': 'alpha', 'scale': 'beta'}, 'webppl': {'loc': 'location'}}), 'Laplace': FamilyMeta(qvr_name='Laplace', distribution_class=td.Laplace, quivers_class=ConditionalLaplace, target_names={'stan': 'double_exponential', 'numpyro': 'Laplace', 'pyro': 'Laplace', 'pymc': 'Laplace', 'edward2': 'Laplace', 'turing': 'Laplace', 'gen': 'laplace', 'webppl': 'Laplace', 'bugs': 'ddexp', 'jags': 'ddexp'}, arg_aliases={'bugs': {'scale': 'tau'}, 'jags': {'scale': 'tau'}, 'pymc': {'loc': 'mu', 'scale': 'b'}, 'webppl': {'loc': 'location', 'scale': 'scale'}}), 'Gumbel': FamilyMeta(qvr_name='Gumbel', distribution_class=td.Gumbel, quivers_class=ConditionalGumbel, target_names={'stan': 'gumbel', 'numpyro': 'Gumbel', 'pyro': 'Gumbel', 'pymc': 'Gumbel', 'edward2': 'Gumbel', 'turing': 'Gumbel'}, arg_aliases={'pymc': {'loc': 'mu', 'scale': 'beta'}}), 'LogNormal': FamilyMeta(qvr_name='LogNormal', distribution_class=td.LogNormal, quivers_class=ConditionalLogNormal, target_names={'stan': 'lognormal', 'numpyro': 'LogNormal', 'pyro': 'LogNormal', 'pymc': 'LogNormal', 'edward2': 'LogNormal', 'turing': 'LogNormal', 'gen': 'lognormal', 'church': 'lognormal', 'webppl': 'LogNormal', 'bugs': 'dlnorm', 'jags': 'dlnorm'}, arg_aliases={'pymc': {'loc': 'mu', 'scale': 'sigma'}}), 'StudentT': FamilyMeta(qvr_name='StudentT', distribution_class=td.StudentT, quivers_class=ConditionalStudentT, target_names={'stan': 'student_t', 'numpyro': 'StudentT', 'pyro': 'StudentT', 'pymc': 'StudentT', 'edward2': 'StudentT', 'turing': 'TDist', 'church': 'student-t', 'webppl': 'StudentT', 'bugs': 'dt', 'jags': 'dt'}, arg_aliases={'pymc': {'df': 'nu', 'loc': 'mu', 'scale': 'sigma'}}), 'Exponential': FamilyMeta(qvr_name='Exponential', distribution_class=td.Exponential, quivers_class=ConditionalExponential, target_names={'stan': 'exponential', 'numpyro': 'Exponential', 'pyro': 'Exponential', 'pymc': 'Exponential', 'edward2': 'Exponential', 'turing': 'Exponential', 'gen': 'exponential', 'church': 'exponential', 'webppl': 'Exponential', 'bugs': 'dexp', 'jags': 'dexp'}, arg_aliases={'pymc': {'rate': 'lam'}, 'webppl': {'rate': 'a'}}), 'Gamma': FamilyMeta(qvr_name='Gamma', distribution_class=td.Gamma, quivers_class=ConditionalGamma, target_names={'stan': 'gamma', 'numpyro': 'Gamma', 'pyro': 'Gamma', 'pymc': 'Gamma', 'edward2': 'Gamma', 'turing': 'Gamma', 'gen': 'gamma', 'church': 'gamma', 'webppl': 'Gamma', 'bugs': 'dgamma', 'jags': 'dgamma'}, arg_aliases={'pymc': {'concentration': 'alpha', 'rate': 'beta'}, 'webppl': {'concentration': 'shape', 'rate': 'scale'}}), 'Chi2': FamilyMeta(qvr_name='Chi2', distribution_class=td.Chi2, quivers_class=ConditionalChi2, target_names={'stan': 'chi_square', 'numpyro': 'Chi2', 'pyro': 'Chi2', 'pymc': 'ChiSquared', 'edward2': 'Chi2', 'turing': 'Chisq', 'bugs': 'dchisqr', 'jags': 'dchisqr'}, arg_aliases={'pymc': {'df': 'nu'}}), 'HalfCauchy': FamilyMeta(qvr_name='HalfCauchy', distribution_class=td.HalfCauchy, quivers_class=ConditionalHalfCauchy, target_names={'stan': 'cauchy', 'numpyro': 'HalfCauchy', 'pyro': 'HalfCauchy', 'pymc': 'HalfCauchy', 'edward2': 'HalfCauchy', 'turing': 'truncated', 'gen': 'cauchy', 'church': 'cauchy', 'webppl': 'Cauchy', 'bugs': 'dt', 'jags': 'dt'}, arg_aliases={'pymc': {'scale': 'beta'}, 'webppl': {'scale': 'scale', 'loc': 'location'}, 'bugs': {'scale': 'tau'}, 'jags': {'scale': 'tau'}}), 'HalfNormal': FamilyMeta(qvr_name='HalfNormal', distribution_class=td.HalfNormal, quivers_class=ConditionalHalfNormal, target_names={'stan': 'normal', 'numpyro': 'HalfNormal', 'pyro': 'HalfNormal', 'pymc': 'HalfNormal', 'edward2': 'HalfNormal', 'turing': 'truncated', 'gen': 'normal', 'church': 'gaussian', 'webppl': 'Gaussian', 'bugs': 'dnorm', 'jags': 'dnorm'}, arg_aliases={'pymc': {'scale': 'sigma'}, 'webppl': {'scale': 'sigma', 'loc': 'mu'}, 'bugs': {'scale': 'tau'}, 'jags': {'scale': 'tau'}}), 'InverseGamma': FamilyMeta(qvr_name='InverseGamma', distribution_class=td.InverseGamma, quivers_class=ConditionalInverseGamma, target_names={'stan': 'inv_gamma', 'numpyro': 'InverseGamma', 'pyro': 'InverseGamma', 'pymc': 'InverseGamma', 'edward2': 'InverseGamma', 'turing': 'InverseGamma'}, arg_aliases={'pymc': {'concentration': 'alpha', 'rate': 'beta'}}), 'Weibull': FamilyMeta(qvr_name='Weibull', distribution_class=td.Weibull, quivers_class=ConditionalWeibull, target_names={'stan': 'weibull', 'numpyro': 'Weibull', 'pyro': 'Weibull', 'pymc': 'Weibull', 'edward2': 'Weibull', 'turing': 'Weibull', 'gen': 'weibull', 'church': 'weibull', 'webppl': 'Weibull', 'bugs': 'dweib', 'jags': 'dweib'}, arg_aliases={'pymc': {'concentration': 'alpha', 'scale': 'beta'}}), 'Pareto': FamilyMeta(qvr_name='Pareto', distribution_class=td.Pareto, quivers_class=ConditionalPareto, target_names={'stan': 'pareto', 'numpyro': 'Pareto', 'pyro': 'Pareto', 'pymc': 'Pareto', 'edward2': 'Pareto', 'turing': 'Pareto', 'church': 'pareto', 'bugs': 'dpar', 'jags': 'dpar'}, arg_aliases={'pymc': {'alpha': 'alpha', 'scale': 'm'}}), 'Kumaraswamy': FamilyMeta(qvr_name='Kumaraswamy', distribution_class=td.Kumaraswamy, quivers_class=ConditionalKumaraswamy, target_names={'stan': 'kumaraswamy', 'numpyro': 'Kumaraswamy', 'pyro': 'Kumaraswamy', 'pymc': 'Kumaraswamy', 'edward2': 'Kumaraswamy', 'gen': 'kumaraswamy', 'turing': 'Kumaraswamy', 'webppl': 'Kumaraswamy'}, arg_aliases={'pymc': {'concentration1': 'a', 'concentration0': 'b'}}), 'ContinuousBernoulli': FamilyMeta(qvr_name='ContinuousBernoulli', distribution_class=td.ContinuousBernoulli, quivers_class=ConditionalContinuousBernoulli, target_names={'stan': 'continuous_bernoulli', 'numpyro': 'ContinuousBernoulli', 'pyro': 'ContinuousBernoulli', 'edward2': 'ContinuousBernoulli', 'pymc': 'ContinuousBernoulli', 'turing': 'ContinuousBernoulli', 'gen': 'continuous_bernoulli', 'webppl': 'ContinuousBernoulli'}), 'FisherSnedecor': FamilyMeta(qvr_name='FisherSnedecor', distribution_class=td.FisherSnedecor, quivers_class=ConditionalFisherSnedecor, target_names={'numpyro': 'FisherSnedecor', 'pyro': 'FisherSnedecor', 'turing': 'FDist', 'jags': 'df'}, arg_aliases={'jags': {'df1': 'n', 'df2': 'm'}}), 'Uniform': FamilyMeta(qvr_name='Uniform', distribution_class=td.Uniform, quivers_class=ConditionalUniform, target_names={'stan': 'uniform', 'numpyro': 'Uniform', 'pyro': 'Uniform', 'pymc': 'Uniform', 'edward2': 'Uniform', 'turing': 'Uniform', 'gen': 'uniform', 'church': 'uniform', 'webppl': 'Uniform', 'bugs': 'dunif', 'jags': 'dunif'}, arg_aliases={'pymc': {'low': 'lower', 'high': 'upper'}, 'webppl': {'low': 'a', 'high': 'b'}}), 'MultivariateNormal': FamilyMeta(qvr_name='MultivariateNormal', event_rank=1, distribution_class=td.MultivariateNormal, quivers_class=ConditionalMultivariateNormal, target_names={'stan': 'multi_normal', 'numpyro': 'MultivariateNormal', 'pyro': 'MultivariateNormal', 'pymc': 'MvNormal', 'edward2': 'MultivariateNormalFullCovariance', 'turing': 'MvNormal', 'gen': 'mvnormal', 'church': 'multivariate-gaussian', 'webppl': 'MultivariateGaussian', 'bugs': 'dmnorm', 'jags': 'dmnorm'}, arg_aliases={'pymc': {'loc': 'mu', 'covariance_matrix': 'cov'}, 'webppl': {'loc': 'mu', 'covariance_matrix': 'cov'}}, structured_lowering=StructuredSampleLowering(args=(StructuredDataArg(arg_name='loc', axis_indices=(0,), constraint_kind='real_vector'), StructuredDataArg(arg_name='covariance_matrix', axis_indices=(0, 0), constraint_kind='positive_definite')), event_axis_source=OverOrCodomainAxes(axis_count=1), sample_constraint_kind='real_vector')), 'LowRankMVN': FamilyMeta(qvr_name='LowRankMVN', event_rank=1, distribution_class=td.LowRankMultivariateNormal, quivers_class=ConditionalLowRankMVN, target_names={'numpyro': 'LowRankMultivariateNormal', 'pyro': 'LowRankMultivariateNormal'}, arg_aliases={'pymc': {'loc': 'mu', 'cov_factor': 'W', 'cov_diag': 'diag'}}), 'RelaxedBernoulli': FamilyMeta(qvr_name='RelaxedBernoulli', distribution_class=td.RelaxedBernoulli, quivers_class=ConditionalRelaxedBernoulli, target_names={'numpyro': 'RelaxedBernoulli', 'pyro': 'RelaxedBernoulli', 'edward2': 'RelaxedBernoulli'}), 'RelaxedOneHotCategorical': FamilyMeta(qvr_name='RelaxedOneHotCategorical', event_rank=1, distribution_class=td.RelaxedOneHotCategorical, quivers_class=ConditionalRelaxedOneHotCategorical, target_names={'numpyro': 'RelaxedOneHotCategorical', 'pyro': 'RelaxedOneHotCategorical', 'edward2': 'RelaxedOneHotCategorical'}), 'Wishart': FamilyMeta(qvr_name='Wishart', event_rank=2, distribution_class=td.Wishart, quivers_class=ConditionalWishart, target_names={'stan': 'wishart', 'numpyro': 'Wishart', 'pyro': 'Wishart', 'pymc': 'Wishart', 'edward2': 'Wishart', 'turing': 'Wishart', 'bugs': 'dwish', 'jags': 'dwish'}, arg_aliases={'pymc': {'df': 'nu', 'covariance_matrix': 'V'}}), 'InverseWishart': FamilyMeta(qvr_name='InverseWishart', event_rank=2, distribution_class=_InverseWishart, quivers_class=ConditionalInverseWishart, target_names={'stan': 'inv_wishart', 'numpyro': 'InverseWishart', 'pyro': 'InverseWishart', 'turing': 'InverseWishart'}), 'MatrixNormal': FamilyMeta(qvr_name='MatrixNormal', event_rank=2, distribution_class=_MatrixNormal, quivers_class=ConditionalMatrixNormal, target_names={'stan': 'matrix_normal', 'numpyro': 'MatrixNormal', 'pyro': 'MatrixNormal', 'pymc': 'MatrixNormal', 'edward2': 'MatrixNormalLinearOperator', 'turing': 'MatrixNormal', 'gen': 'matrix_normal', 'webppl': 'MatrixNormal', 'church': 'matrix-normal'}, arg_aliases={'pymc': {'loc': 'mu', 'row_covariance': 'rowcov', 'col_covariance': 'colcov'}}, structured_lowering=StructuredSampleLowering(args=(StructuredDataArg(arg_name='loc', axis_indices=(0, 1), constraint_kind='real_matrix'), StructuredDataArg(arg_name='row_covariance', axis_indices=(0, 0), constraint_kind='positive_definite'), StructuredDataArg(arg_name='col_covariance', axis_indices=(1, 1), constraint_kind='positive_definite')), event_axis_source=OverOrCodomainAxes(axis_count=2), sample_constraint_kind='real_matrix')), 'GP': FamilyMeta(qvr_name='GP', event_rank=1, distribution_class=_GaussianProcess, quivers_class=ConditionalGaussianProcess, target_names={'edward2': 'MultivariateNormalFullCovariance', 'stan': 'multi_normal', 'numpyro': 'MultivariateNormal', 'pyro': 'MultivariateNormal', 'pymc': 'MvNormal', 'turing': 'MvNormal', 'gen': 'mvnormal', 'webppl': 'MultivariateGaussian', 'church': 'multivariate-gaussian', 'bugs': 'dmnorm', 'jags': 'dmnorm'}, structured_lowering=StructuredSampleLowering(args=(StructuredZeroVectorArg(arg_name='mean'), StructuredKernelArg(arg_name='covariance_matrix', x_input_name='x')), event_axis_source=DomainGridAxis(), sample_constraint_kind='real_vector', always_apply=True)), 'Horseshoe': FamilyMeta(qvr_name='Horseshoe', distribution_class=_Horseshoe, quivers_class=ConditionalHorseshoe, target_names={}), 'Bernoulli': FamilyMeta(qvr_name='Bernoulli', distribution_class=td.Bernoulli, quivers_class=ConditionalBernoulli, target_names={'stan': 'bernoulli', 'numpyro': 'Bernoulli', 'pyro': 'Bernoulli', 'pymc': 'Bernoulli', 'edward2': 'Bernoulli', 'turing': 'Bernoulli', 'gen': 'bernoulli', 'church': 'flip', 'webppl': 'Bernoulli', 'bugs': 'dbern', 'jags': 'dbern'}, arg_aliases={'pymc': {'probs': 'p'}, 'webppl': {'probs': 'p'}}), 'Categorical': FamilyMeta(qvr_name='Categorical', distribution_class=td.Categorical, quivers_class=ConditionalCategorical, target_names={'stan': 'categorical', 'numpyro': 'Categorical', 'pyro': 'Categorical', 'pymc': 'Categorical', 'edward2': 'Categorical', 'turing': 'Categorical', 'gen': 'categorical', 'church': 'categorical', 'webppl': 'Categorical', 'bugs': 'dcat', 'jags': 'dcat'}, arg_aliases={'pymc': {'probs': 'p', 'logits': 'logit_p'}, 'webppl': {'probs': 'ps'}}), 'Poisson': FamilyMeta(qvr_name='Poisson', distribution_class=td.Poisson, quivers_class=ConditionalPoisson, target_names={'stan': 'poisson', 'numpyro': 'Poisson', 'pyro': 'Poisson', 'pymc': 'Poisson', 'edward2': 'Poisson', 'turing': 'Poisson', 'gen': 'poisson', 'church': 'poisson', 'webppl': 'Poisson', 'bugs': 'dpois', 'jags': 'dpois'}, arg_aliases={'pymc': {'rate': 'mu'}, 'webppl': {'rate': 'mu'}}), 'NegativeBinomial': FamilyMeta(qvr_name='NegativeBinomial', distribution_class=td.NegativeBinomial, quivers_class=ConditionalNegativeBinomial, target_names={'stan': 'neg_binomial_2', 'numpyro': 'NegativeBinomial2', 'pyro': 'NegativeBinomial', 'pymc': 'NegativeBinomial', 'edward2': 'NegativeBinomial', 'turing': 'NegativeBinomial', 'gen': 'neg_binom', 'church': 'negative-binomial', 'webppl': 'NegativeBinomial', 'bugs': 'dnegbin', 'jags': 'dnegbin'}, arg_aliases={'pymc': {'probs': 'p', 'total_count': 'n'}}), 'Geometric': FamilyMeta(qvr_name='Geometric', distribution_class=td.Geometric, quivers_class=ConditionalGeometric, target_names={'numpyro': 'Geometric', 'pyro': 'Geometric', 'pymc': 'Geometric', 'edward2': 'Geometric', 'turing': 'Geometric', 'gen': 'geometric', 'church': 'geometric'}, arg_aliases={'pymc': {'probs': 'p'}}), 'Binomial': FamilyMeta(qvr_name='Binomial', distribution_class=td.Binomial, quivers_class=ConditionalBinomial, target_names={'stan': 'binomial', 'numpyro': 'Binomial', 'pyro': 'Binomial', 'pymc': 'Binomial', 'edward2': 'Binomial', 'turing': 'Binomial', 'webppl': 'Binomial', 'bugs': 'dbin', 'jags': 'dbin'}, arg_aliases={'pymc': {'probs': 'p', 'total_count': 'n'}, 'webppl': {'probs': 'p', 'total_count': 'n'}}), 'VonMises': FamilyMeta(qvr_name='VonMises', distribution_class=td.VonMises, quivers_class=ConditionalVonMises, target_names={'stan': 'von_mises', 'numpyro': 'VonMises', 'pyro': 'VonMises', 'pymc': 'VonMises', 'edward2': 'VonMises', 'turing': 'VonMises'}, arg_aliases={'pymc': {'loc': 'mu', 'concentration': 'kappa'}}), 'LogisticNormal': FamilyMeta(qvr_name='LogisticNormal', event_rank=1, distribution_class=td.LogisticNormal, quivers_class=ConditionalLogisticNormal, target_names={'numpyro': 'LogisticNormal', 'pyro': 'LogisticNormal', 'webppl': 'LogisticNormal'}, arg_aliases={'webppl': {'loc': 'mu', 'scale': 'sigma'}}), 'OneHotCategorical': FamilyMeta(qvr_name='OneHotCategorical', event_rank=1, distribution_class=td.OneHotCategorical, quivers_class=ConditionalOneHotCategorical, target_names={'numpyro': 'OneHotCategorical', 'pyro': 'OneHotCategorical', 'edward2': 'OneHotCategorical'}, arg_aliases={'pymc': {'probs': 'p'}}), 'LKJCholesky': FamilyMeta(qvr_name='LKJCholesky', event_rank=2, distribution_class=td.LKJCholesky, quivers_class=ConditionalLKJCholesky, target_names={'stan': 'lkj_corr_cholesky', 'numpyro': 'LKJCholesky', 'pyro': 'LKJCorrCholesky', 'pymc': 'LKJCholesky', 'edward2': 'LKJ', 'turing': 'LKJCholesky', 'gen': 'lkj_cholesky', 'webppl': 'LKJCholesky'}, arg_aliases={'pymc': {'concentration': 'eta'}}), 'Mixture': FamilyMeta(qvr_name='Mixture', distribution_class=td.MixtureSameFamily, quivers_class=ConditionalMixture, target_names={'numpyro': 'MixtureSameFamily', 'pyro': 'MixtureSameFamily', 'pymc': 'Mixture', 'edward2': 'MixtureSameFamily', 'turing': 'MixtureModel', 'webppl': 'Mixture', 'jags': 'dpois'}, arg_aliases={'pymc': {'mixture_distribution': 'w', 'component_distribution': 'comp_dists'}}), 'MixtureNormal': FamilyMeta(qvr_name='MixtureNormal', distribution_class=MixtureNormal, quivers_class=ConditionalMixtureNormal, target_names={'numpyro': 'MixtureSameFamily', 'pyro': 'MixtureSameFamily', 'edward2': 'MixtureSameFamily', 'pymc': 'NormalMixture', 'turing': 'MixtureModel', 'stan': 'log_mix', 'gen': 'HomogeneousMixture', 'webppl': 'Mixture'}, arg_aliases={'pymc': {'weights': 'w', 'loc': 'mu', 'scale': 'sigma'}}), 'Independent': FamilyMeta(qvr_name='Independent', distribution_class=td.Independent, quivers_class=ConditionalIndependent, target_names={'numpyro': 'Independent', 'pyro': 'Independent', 'edward2': 'Independent'}), 'Transformed': FamilyMeta(qvr_name='Transformed', distribution_class=td.TransformedDistribution, quivers_class=ConditionalTransformed, target_names={'numpyro': 'TransformedDistribution', 'pyro': 'TransformedDistribution', 'edward2': 'TransformedDistribution'}), 'Truncated': FamilyMeta(qvr_name='Truncated', distribution_class=_Truncated, quivers_class=Truncated, target_names={'pymc': 'Truncated', 'numpyro': 'TruncatedDistribution', 'pyro': 'TruncatedDistribution', 'turing': 'truncated'}, arg_aliases={'pymc': {'base_distribution': 'dist'}}), 'ZeroInflatedPoisson': FamilyMeta(qvr_name='ZeroInflatedPoisson', distribution_class=ZeroInflatedPoisson, target_names={}), 'HurdlePoisson': FamilyMeta(qvr_name='HurdlePoisson', distribution_class=HurdlePoisson, target_names={}), 'ZeroOneInflatedBeta': FamilyMeta(qvr_name='ZeroOneInflatedBeta', distribution_class=ZeroOneInflatedBeta, target_names={}), 'Restrict': FamilyMeta(qvr_name='Restrict', distribution_class=Restrict, target_names={}), 'Normalize': FamilyMeta(qvr_name='Normalize', distribution_class=Normalize, target_names={}), 'PointMass': FamilyMeta(qvr_name='PointMass', distribution_class=PointMass, target_names={}), 'LKJCorrelationFactor': FamilyMeta(qvr_name='LKJCorrelationFactor', event_rank=2, distribution_class=_LKJCorrelationFactor, quivers_class=LKJCorrelationFactor, target_names={'pymc': 'LKJCorr', 'stan': 'lkj_corr', 'numpyro': 'LKJ', 'pyro': 'LKJ'}), 'BetaBinomial': FamilyMeta(qvr_name='BetaBinomial', distribution_class=BetaBinomial, quivers_class=ConditionalBetaBinomial, target_names={'stan': 'beta_binomial', 'numpyro': 'BetaBinomial', 'pyro': 'BetaBinomial', 'pymc': 'BetaBinomial', 'edward2': 'BetaBinomial', 'turing': 'BetaBinomial', 'bugs': 'dbetabin', 'jags': 'dbetabin', 'gen': 'beta_binomial', 'webppl': 'BetaBinomial'}, arg_aliases={'pymc': {'concentration1': 'alpha', 'concentration0': 'beta', 'total_count': 'n'}}), 'OrderedLogistic': FamilyMeta(qvr_name='OrderedLogistic', distribution_class=OrderedLogistic, quivers_class=ConditionalOrderedLogistic, target_names={'stan': 'ordered_logistic', 'numpyro': 'OrderedLogistic', 'pyro': 'OrderedLogistic', 'pymc': 'OrderedLogistic'}), 'OrderedProbit': FamilyMeta(qvr_name='OrderedProbit', distribution_class=OrderedProbit, quivers_class=ConditionalOrderedProbit, target_names={'stan': 'ordered_probit', 'numpyro': 'OrderedProbit', 'pyro': 'OrderedProbit', 'pymc': 'OrderedProbit'}), 'Logistic': FamilyMeta(qvr_name='Logistic', distribution_class=Logistic, quivers_class=ConditionalLogistic, target_names={'stan': 'logistic', 'numpyro': 'Logistic', 'pyro': 'Logistic', 'pymc': 'Logistic', 'edward2': 'Logistic', 'turing': 'Logistic', 'bugs': 'dlogis', 'jags': 'dlogis', 'gen': 'logistic', 'webppl': 'Logistic'}, arg_aliases={'pymc': {'loc': 'mu', 'scale': 's'}}), 'HalfStudentT': FamilyMeta(qvr_name='HalfStudentT', distribution_class=HalfStudentT, quivers_class=ConditionalHalfStudentT, target_names={'stan': 'student_t', 'numpyro': 'HalfStudentT', 'pyro': 'HalfStudentT', 'pymc': 'HalfStudentT', 'edward2': 'HalfStudentT', 'bugs': 'dt', 'jags': 'dt', 'gen': 'half_student_t', 'turing': 'HalfStudentT', 'webppl': 'HalfStudentT'}, arg_aliases={'pymc': {'df': 'nu', 'scale': 'sigma'}, 'bugs': {'scale': 'tau'}, 'jags': {'scale': 'tau'}})}

The transpile-time family registry, keyed by QVR family name.

MarginalizeAtomSet

MarginalizeAtomSet = Literal['binary', 'class_index']

How a marginalized latent's atoms are enumerated.

"binary" integrates over the two atoms 0 and 1; "class_index" integrates over every index of the family's support.

FamilyMeta didactic-model

FamilyMeta(*, qvr_name: str, distribution_class: type[Distribution] = field(opaque=True), target_names: dict[str, str], arg_aliases: dict[str, dict[str, str]] = field(default_factory=lambda: {}), quivers_class: type[ContinuousMorphism] | None = field(default=None, opaque=True), structured_lowering: StructuredSampleLowering | None = None, event_rank: int = 0)

Bases: Model

Static transpile-only metadata for one distribution family.

event_rank is the rank of the distribution's natural event shape (Normal.event_shape == () -> 0; Dirichlet.event_shape == (K,) -> 1; LKJCholesky.event_shape == (K, K) -> 2). Renderers consult this to compute the residual user-declared event dims: given a sample with plate.event_dims = (e1, ..., eN), the family produces the trailing event_rank dims natively and the leading N - event_rank dims must be lifted into the rendered distribution (NumPyro / Pyro .expand([...]).to_event(...), Edward2 sample_shape=[...]). PyMC labels every plate axis with a named dims coordinate, so it needs no residual lift. Default is 0; vector families override to 1, matrix families to 2.

BetaBinomial

BetaBinomial(total_count: Tensor, concentration1: Tensor, concentration0: Tensor, validate_args: bool | None = None)

Bases: Distribution

Beta-Binomial: Binomial(n, p) with p ~ Beta(c1, c0).

The marginal pmf is

p(k; n, a, b) = C(n, k) * B(a + k, b + n - k) / B(a, b),

where B(.,.) is the beta function. log_prob evaluates this in log space via torch.lgamma. sample draws p ~ Beta(a, b) then k ~ Binomial(n, p), matching the generative definition.

Source code in src/quivers/transpile/family_meta.py
def __init__(
    self,
    total_count: torch.Tensor,
    concentration1: torch.Tensor,
    concentration0: torch.Tensor,
    validate_args: bool | None = None,
) -> None:
    self.total_count = total_count
    self.concentration1 = concentration1
    self.concentration0 = concentration0
    super().__init__(validate_args=validate_args)

mean property

mean: Tensor

E[K] = n * a / (a + b).

variance property

variance: Tensor

Closed-form Beta-Binomial variance.

log_prob

log_prob(value: Tensor) -> Tensor

log p(value; n, a, b) via the closed-form Beta-Binomial pmf.

Source code in src/quivers/transpile/family_meta.py
def log_prob(self, value: torch.Tensor) -> torch.Tensor:
    """``log p(value; n, a, b)`` via the closed-form Beta-Binomial pmf."""
    n = self.total_count.to(value.dtype)
    a = self.concentration1.to(value.dtype)
    b = self.concentration0.to(value.dtype)
    k = value.to(value.dtype)
    log_comb = (
        torch.lgamma(n + 1.0) - torch.lgamma(k + 1.0) - torch.lgamma(n - k + 1.0)
    )
    log_beta_post = (
        torch.lgamma(a + k) + torch.lgamma(b + n - k) - torch.lgamma(a + b + n)
    )
    log_beta_prior = torch.lgamma(a) + torch.lgamma(b) - torch.lgamma(a + b)
    return log_comb + log_beta_post - log_beta_prior

sample

sample(sample_shape: Size = Size()) -> Tensor

Two-stage draw: p ~ Beta(a, b); k ~ Binomial(n, p).

Source code in src/quivers/transpile/family_meta.py
def sample(self, sample_shape: torch.Size = torch.Size()) -> torch.Tensor:
    """Two-stage draw: ``p ~ Beta(a, b)``; ``k ~ Binomial(n, p)``."""
    p = torch.distributions.Beta(self.concentration1, self.concentration0).sample(
        sample_shape
    )
    return torch.distributions.Binomial(
        total_count=self.total_count, probs=p
    ).sample()

OrderedLogistic

OrderedLogistic(eta: Tensor, cutpoints: Tensor, validate_args: bool | None = None)

Bases: Distribution

Ordered-logistic over len(cutpoints) + 1 ordered categories.

Source code in src/quivers/transpile/family_meta.py
def __init__(
    self,
    eta: torch.Tensor,
    cutpoints: torch.Tensor,
    validate_args: bool | None = None,
) -> None:
    self.eta = eta
    self.cutpoints = cutpoints
    super().__init__(validate_args=validate_args)

OrderedProbit

OrderedProbit(eta: Tensor, cutpoints: Tensor, validate_args: bool | None = None)

Bases: Distribution

Ordered-probit over len(cutpoints) + 1 ordered categories.

Source code in src/quivers/transpile/family_meta.py
def __init__(
    self,
    eta: torch.Tensor,
    cutpoints: torch.Tensor,
    validate_args: bool | None = None,
) -> None:
    self.eta = eta
    self.cutpoints = cutpoints
    super().__init__(validate_args=validate_args)

Logistic

Logistic(loc: Tensor, scale: Tensor, validate_args: bool | None = None)

Bases: Distribution

Logistic location-scale distribution on the real line.

Source code in src/quivers/transpile/family_meta.py
def __init__(
    self,
    loc: torch.Tensor,
    scale: torch.Tensor,
    validate_args: bool | None = None,
) -> None:
    self.loc = loc
    self.scale = scale
    super().__init__(validate_args=validate_args)

HalfStudentT

HalfStudentT(df: Tensor, scale: Tensor, validate_args: bool | None = None)

Bases: Distribution

Half-StudentT: a StudentT folded around zero (support on the nonnegative reals).

Source code in src/quivers/transpile/family_meta.py
def __init__(
    self,
    df: torch.Tensor,
    scale: torch.Tensor,
    validate_args: bool | None = None,
) -> None:
    self.df = df
    self.scale = scale
    super().__init__(validate_args=validate_args)

ClassIndexOutcome didactic-model

ClassIndexOutcome(*, alphabet_args: tuple[str, ...], extent_offset: int = 0)

Bases: Model

Describe how an index-valued family's arguments determine its alphabet.

alphabet_args lists, in preference order, arguments whose trailing extent determines the class count. For instance, Categorical may use probs or logits. Adding extent_offset to that extent gives the alphabet size: probability vectors use zero, while an ordered family's K - 1 cutpoints use one. A declared morphism's codomain remains the primary source of the value-space size.

MarginalizeSupport didactic-model

MarginalizeSupport(*, atoms: MarginalizeAtomSet, weight_family: str, weight_arg: str, size: int | None = None)

Bases: Model

The finite atom set a marginalize block integrates a latent over.

atoms names the enumeration:

  • "binary": the two atoms 0 and 1, size 2. The Bernoulli relaxations share this support with Bernoulli, and share its weights too: the atoms are weighted by the discrete Bernoulli log-pmf [log1p(-p), log(p)], never by the relaxation's own density at 0 and 1.
  • "class_index": the atoms 0, ..., K - 1. The width K is the trailing extent of the family's probability argument, a call-site fact rather than a family fact, so size is None and the caller supplies it.

weight_family names the family whose log-density at an atom is that atom's log-prior weight, and weight_arg the argument position carrying the probability tensor that family reads.

finite_enumerable_at_call_site

finite_enumerable_at_call_site(family_meta: FamilyMeta, args: tuple[IRArg, ...]) -> bool

True iff the latent's declared index axis names the family's support.

This is the plate question, not the integration question: a True answer means the marginalize index sizes the family's own support (so the reduction sums the axis away and the latent carries no plate dim for it), and a False answer means the index replicates the latent, one value per index.

Returns True for Bernoulli, Categorical, OrderedLogistic, OrderedProbit unconditionally. For Binomial returns True only when args[0] (total_count) is a literal IRArgNumber; False when it is a reference.

A False answer does not mean the latent cannot be integrated out. The Bernoulli relaxations replicate along their index and are still integrable over the two atoms 0 and 1; ask marginalize_support for that.

PARAMETER DESCRIPTION
family_meta

The latent's family metadata.

TYPE: FamilyMeta

args

The latent's IR arguments, in family order.

TYPE: tuple[IRArg, ...]

RETURNS DESCRIPTION
bool

Whether the marginalize index sizes the family's own support.

Source code in src/quivers/transpile/family_meta.py
def finite_enumerable_at_call_site(
    family_meta: FamilyMeta,
    args: tuple[IRArg, ...],
) -> bool:
    """True iff the latent's declared index axis names the family's support.

    This is the plate question, not the integration question: a True
    answer means the marginalize index sizes the family's own support
    (so the reduction sums the axis away and the latent carries no
    plate dim for it), and a False answer means the index replicates
    the latent, one value per index.

    Returns True for Bernoulli, Categorical, OrderedLogistic,
    OrderedProbit unconditionally. For Binomial returns True only
    when `args[0]` (`total_count`) is a literal
    [`IRArgNumber`][quivers.transpile.ir.IRArgNumber]; False when it
    is a reference.

    A False answer does not mean the latent cannot be integrated out.
    The Bernoulli relaxations replicate along their index and are
    still integrable over the two atoms 0 and 1; ask
    [`marginalize_support`][quivers.transpile.family_meta.marginalize_support]
    for that.

    Parameters
    ----------
    family_meta
        The latent's family metadata.
    args
        The latent's IR arguments, in family order.

    Returns
    -------
    bool
        Whether the marginalize index sizes the family's own support.
    """
    name = family_meta.qvr_name
    if name in _ALWAYS_ENUMERABLE:
        return True
    if name == "Binomial":
        return bool(args) and isinstance(args[0], IRArgNumber)
    return False

class_index_outcome

class_index_outcome(family_meta: FamilyMeta) -> ClassIndexOutcome | None

Return the ClassIndexOutcome for family_meta, or None when the family's value is not a subscript into an alphabet.

PARAMETER DESCRIPTION
family_meta

The family metadata.

TYPE: FamilyMeta

RETURNS DESCRIPTION
ClassIndexOutcome or None

How the family's value indexes an alphabet, or None.

Source code in src/quivers/transpile/family_meta.py
def class_index_outcome(
    family_meta: FamilyMeta,
) -> ClassIndexOutcome | None:
    """Return the
    [`ClassIndexOutcome`][quivers.transpile.family_meta.ClassIndexOutcome]
    for `family_meta`, or `None` when the family's value is not a
    subscript into an alphabet.

    Parameters
    ----------
    family_meta
        The family metadata.

    Returns
    -------
    ClassIndexOutcome or None
        How the family's value indexes an alphabet, or ``None``.
    """
    return _CLASS_INDEX_OUTCOMES.get(family_meta.qvr_name)

marginalize_support

marginalize_support(family_meta: FamilyMeta) -> MarginalizeSupport | None

Return the atom set a marginalize integrates family_meta over, or None when the family carries no agreed marginal.

None is the signal to raise marginalize:non-finite-support: the QVR compiler refuses the same families, so a renderer that substituted a live draw would score a different measure than the reference.

PARAMETER DESCRIPTION
family_meta

The latent's family metadata.

TYPE: FamilyMeta

RETURNS DESCRIPTION
MarginalizeSupport or None

The atoms the reduction integrates over, or None when the family has no agreed finite marginal.

Source code in src/quivers/transpile/family_meta.py
def marginalize_support(
    family_meta: FamilyMeta,
) -> MarginalizeSupport | None:
    """Return the atom set a `marginalize` integrates `family_meta`
    over, or `None` when the family carries no agreed marginal.

    `None` is the signal to raise `marginalize:non-finite-support`:
    the QVR compiler refuses the same families, so a renderer that
    substituted a live draw would score a different measure than the
    reference.

    Parameters
    ----------
    family_meta
        The latent's family metadata.

    Returns
    -------
    MarginalizeSupport or None
        The atoms the reduction integrates over, or ``None`` when the
        family has no agreed finite marginal.
    """
    return _MARGINALIZE_SUPPORT.get(family_meta.qvr_name)