## Variable types and their distributions

The following table shows what types of variables are supported by Infer.NET, along with the distributions which are available for representing uncertainty in each type. You can create variables for each of these types using the static methods on Variable for each distribution. Some distributions with experimental quality band are not shown in this table.

 Variable type Restrictions Distribution Distribution Class Example of use bool - Bernoulli Bernoulli Two coins tutorial double - Gaussian Gaussian Learning a Gaussian tutorial double between 0 and infinity Gamma Gamma Learning a Gaussian tutorial double between 0 and 1 Beta Beta Clinical trial tutorial double between settable lower and upper bounds Truncated Gaussian TruncatedGaussian - double between 0 and settable period length Wrapped Gaussian WrappedGaussian - double between a lower bound and infinity Pareto Pareto - int between 0 and D-1 inclusive Discrete (categorical) Discrete Latent Dirichlet Allocation int between 0 and infinity Poisson Poisson - int between 0 and N inclusive Binomial Binomial - enum - Discrete over enum values DiscreteEnum - Vector - Vector Gaussian VectorGaussian Mixture of Gaussians tutorial Vector each element between 0 and 1, elements sum to 1 Dirichlet Dirichlet Latent Dirichlet Allocation PositiveDefiniteMatrix matrix is positive definite Wishart Wishart Mixture of Gaussians tutorial string - Probabilistic automaton StringDistribution Hello, Strings! char - Discrete over char values DiscreteChar - TDomain[] T is a value-type distributionover a domain TDomain Array of distributions considered asa distribution over an array DistributionStructArray - TDomain[,] T is a value-type distributionover a domain TDomain 2-D Array of distributions considered asa distribution over a 2-D array DistributionStructArray2D - TDomain[] T is a reference-type distributionover a domain TDomain Array of distributions considered asa distribution over an array DistributionRefArray - TDomain[,] T is a reference-type distributionover a domain TDomain 2-D Array of distributions considered asa distribution over a 2-D array DistributionRefArray2D - ISparseList - Sparse list of distributionsconsidered as a distribution over a sparse list of bools SparseBernoulliList - ISparseList elements between 0 and 1 Sparse list of distributionsconsidered as a distribution over asparse list of doubles SparseBetaList - ISparseList - Sparse list of Gaussian distributionsconsidered as a distribution over asparse list of doubles SparseGaussianList - ISparseList elements between 0 and infinity Sparse list of Gamma distributionsconsidered as a distribution over asparse list of doubles SparseGammaList - IList elements between 0 and N-1 inclusive SparseBernoulliList where domain islist of indices with value true BernoulliIntegerSubset - IFunction - Sparse Gaussian Process SparseGP Gaussian process classifier

Notes:
• For descriptions of the Vector and PositiveDefiniteMatrix see the page on Vector and Matrix types.
• DistributionRefArray<T, TDomain> can be used to represent a distribution over an arbitrarily deep jagged array domain. For example, the following alias (which can be copied and pasted into you code) represents a 2-deep array of Gaussians considered as a distribution over a 2-deep jagged array of double:
•  `using GaussianArrayArray = DistributionRefArray, double[]>;`
• Posterior distributions for array variables can be passed back as either .NET arrays of distributions (for example `Gaussian`[][]), or as distribution arrays (for example `GaussianArrayArray `using the above alias). The former can be achieved by using (for example) `Gaussian`[][] as the type parameter in the Infer method. The latter is the native format which is therefore is more efficient and needs no casting or type parameter.
• IFunction is an interface type which is used as the domain type for a SparseGP distribution.  This interface has a single Evaluate method for a Vector domain:  `double Evaluate(Vector v);`