A variable in a model
| C# | Visual Basic | Visual C++ |
public abstract class Variable : ConstrainableExpression, IVariable, IModelExpression, CanGetContainers, HasObservedValue
Public MustInherit Class Variable _ Inherits ConstrainableExpression _ Implements IVariable, IModelExpression, CanGetContainers, HasObservedValue
public ref class Variable abstract : public ConstrainableExpression, IVariable, IModelExpression, CanGetContainers, HasObservedValue
| All Members | Methods | Properties | |||
| Icon | Member | Description |
|---|---|---|
| AddAttribute(Object) |
Adds an attribute to this variable. Attributes can be used
to modify how inference is performed on this variable.
| |
| AddAttributes(array<Object>[]()[]) |
Adds multiple attributes to this variable.
| |
| AddAttributes(IEnumerable<(Of <(Object>)>)) |
Adds multiple attributes to this variable.
| |
| AddDefinitionAttribute(Object) |
Add an attribute to the factor defining this variable.
| |
| Array<(Of <(T>)>)(Range) |
Creates a 1D array of variables of size given by the specified range.
| |
| Array<(Of <(T>)>)(Range, Range) |
Creates a 2D array of variables of size given by the specified ranges.
| |
| Array<(Of <(T>)>)(Range, Range, Range) |
Creates a 3D array of variables of size given by the specified ranges.
| |
| Array<(Of <(T>)>)(IList<(Of <(Range>)>)) |
Creates an array of variables of size given by the specified ranges.
| |
| Array<(Of <(T>)>)(VariableArray<(Of <(T>)>), Range) |
Creates a jagged array of variables
| |
| Array<(Of <(T>)>)(VariableArray2D<(Of <(T>)>), Range) |
Creates a jagged array of variables
| |
| Array<(Of <(T>)>)(VariableArray<(Of <(T>)>), Range, Range) |
Creates a 2-D jagged array of variables
| |
| Array<(Of <(T>)>)(VariableArray<(Of <(T>)>), Range, Range, Range) |
Creates a 3-D jagged array of variables
| |
| Array<(Of <(T>)>)(VariableArray<(Of <(VariableArray<(Of <(T>)>), array<array<T>[]()[]>[]()[]>)>), Range) |
Creates a jagged array of variables
| |
| Array<(Of <(TItem, TArray>)>)(TItem, Range) |
Generic mechanism for creating arrays of variables
| |
| Attrib(Object) |
Inline method for adding an attribute to a variable. This method
returns the variable object, so that is can be used in an inline expression.
e.g. Variable.GaussianFromMeanAndVariance(0,1).Attrib(new MyAttribute());
| |
| Bernoulli(Double) |
Creates a boolean random variable with the specified probability of being true.
| |
| Bernoulli(Variable<(Of <(Double>)>)) |
Creates a boolean random variable with the specified probability of being true.
| |
| BernoulliFromLogOdds(Double) |
Creates a boolean random variable from log odds.
| |
| Beta(Double, Double) |
Creates a beta distributed random variable from initial counts.
| |
| BetaFromMeanAndVariance(Double, Double) |
Creates a beta distributed random variable with specified mean and variance
| |
| BetaPointMass(Double) |
Creates a beta distributed random variable that is a Pointmass at mean
| |
| Case(Variable<(Of <(Int32>)>), Int32) |
Opens a stochastic case statement, active when the integer argument has the specified value.
| |
| Constant<(Of <(T>)>)(T) |
Defines a constant
| |
| Constant<(Of <(T>)>)(array<T>[]()[]) |
Defines a constant which is a 1D array.
| |
| Constant<(Of <(T>)>)(array<T>[]()[], Range) |
Defines a constant which is a 1D array.
| |
| Constant<(Of <(T>)>)(array<T,2>[,](,)[,]) |
Defines a constant which is a 2D array.
| |
| Constant<(Of <(T>)>)(array<T,2>[,](,)[,], Range, Range) |
Defines a constant which is a 2D array.
| |
| Constant<(Of <(T>)>)(array<array<T>[]()[]>[]()[], Range, Range) |
Defines a constant which is a 2-D jagged array
| |
| Constant<(Of <(T>)>)(array<array<T,2>[,](,)[,]>[]()[], Range, Range, Range) |
Defines a constant array of 2-D arrays
| |
| Constant<(Of <(T>)>)(array<array<array<T>[]()[]>[]()[]>[]()[], Range, Range, Range) |
Defines a constant 3-D jagged array
| |
| Constrain<(Of <(T>)>)(ConstrainMethod<(Of <(T>)>), Variable<(Of <(T>)>)) |
Applies a constraint using a constraint method with one argument.
| |
| Constrain<(Of <(T1, T2>)>)(ConstrainMethod<(Of <(T1, T2>)>), Variable<(Of <(T1>)>), Variable<(Of <(T2>)>)) |
Applies a constraint using a constraint method with two arguments.
| |
| Constrain<(Of <(T1, T2, T3>)>)(ConstrainMethod<(Of <(T1, T2, T3>)>), Variable<(Of <(T1>)>), Variable<(Of <(T2>)>), Variable<(Of <(T3>)>)) |
Applies a constraint using a constraint method with three arguments.
| |
| Constrain<(Of <(T1, T2, T3, T4>)>)(ConstrainMethod<(Of <(T1, T2, T3, T4>)>), Variable<(Of <(T1>)>), Variable<(Of <(T2>)>), Variable<(Of <(T3>)>), Variable<(Of <(T4>)>)) |
Applies a constraint using a constraint method with four arguments.
| |
| ConstrainBetween(Variable<(Of <(Double>)>), Variable<(Of <(Double>)>), Variable<(Of <(Double>)>)) |
Constrains a double variable to be between two limits.
| |
| ConstrainBetween(Variable<(Of <(Double>)>), Double, Double) |
Constrains a double variable to be between two limits.
| |
| ConstrainEqual<(Of <(T>)>)(Variable<(Of <(T>)>), Variable<(Of <(T>)>)) |
Constrains two variables to be equal.
| |
| ConstrainEqual<(Of <(T>)>)(T, Variable<(Of <(T>)>)) |
Constrains a variable to equal a constant value.
| |
| ConstrainEqual<(Of <(T>)>)(Variable<(Of <(T>)>), T) |
Constrains a variable to equal a constant value.
| |
| ConstrainEqualRandom<(Of <(T, TDist>)>)(Variable<(Of <(T>)>), Variable<(Of <(TDist>)>)) |
Constrains a variable to be equal to a random sample from a distribution.
| |
| ConstrainEqualRandom<(Of <(T, TDist>)>)(T, Variable<(Of <(TDist>)>)) |
Constrains a value to be equal to a random sample from a distribution.
| |
| ConstrainEqualRandom<(Of <(T, TDist>)>)(Variable<(Of <(T>)>), TDist) |
Constrains a variable to be equal to a random sample from a known distribution.
| |
| ConstrainFalse(Variable<(Of <(Boolean>)>)) |
Constrains a boolean variable to be false.
| |
| ConstrainPositive(Variable<(Of <(Double>)>)) |
Constrains a double variable to be positive.
| |
| ConstrainTrue(Variable<(Of <(Boolean>)>)) |
Constrains a boolean variable to be true.
| |
| Copy<(Of <(T>)>)(Variable<(Of <(T>)>)) |
Returns a copy of the argument
| |
| Dirichlet(array<Double>[]()[]) |
Creates a Dirichlet-distributed random variable with the specified pseudo-counts
| |
| Dirichlet(Range, array<Double>[]()[]) |
Creates a Dirichlet-distributed random variable with the specified pseudo-counts
| |
| Dirichlet(Vector) |
Creates a Dirichlet-distributed random variable with the specified pseudo-counts
| |
| Dirichlet(Range, Vector) |
Creates a Dirichlet-distributed random variable with the specified pseudo-counts
| |
| DirichletPointMass(Vector) |
Creates a Dirichlet random variable that is a Pointmass with probabilities prob
| |
| DirichletPointMass(array<Double>[]()[]) |
Creates a Dirichlet random variable that is a Pointmass with probabilities prob
| |
| DirichletUniform(Int32) |
Creates a uniform Dirichlet random variable of given dimension
| |
| DirichletUniform(Range) |
Creates a uniform Dirichlet random variable of dimension given by a range.
| |
| Discrete(array<Double>[]()[]) |
Creates a discrete random variable with the specified probabilities of having value 0,1,...,(probs.Length-1).
| |
| Discrete(Range, array<Double>[]()[]) |
Creates a discrete random variable with the specified probabilities of having value 0,1,...,(probs.Length-1).
| |
| Discrete(Vector) |
Creates a discrete random variable with the specified probabilities of having value 0,1,...,(v.Count-1).
| |
| Discrete(Range, Vector) |
Creates a discrete random variable with the specified probabilities of having value 0,1,...,(v.Count-1).
| |
| Discrete(Variable<(Of <(Vector>)>)) |
Creates a discrete random variable with the specified probabilities of having value 0,1,...,(probs.Value.Length-1).
| |
| Discrete(Range, Variable<(Of <(Vector>)>)) |
Creates a discrete random variable with the specified probabilities of having value 0,1,...,(probs.Value.Length-1).
| |
| DiscretePointMass(Int32, Int32) |
Creates a discrete random variable that is a Pointmass at Value
| |
| DiscreteUniform(Int32) |
Creates a discrete random variable distributed uniformly across 0,1,...,(size-1).
| |
| DiscreteUniform(Range) |
Creates a discrete random variable distributed uniformly across 0,1,...,(range.Size-1).
| |
| Exp(Variable<(Of <(Double>)>)) |
Returns a variable which takes e to the power of another random variable
| |
| ForEach(Range) |
Creates a new 'for each' block
| |
| GammaFromMeanAndVariance(Double, Double) |
Creates a Gamma-distributed random variable from its mean and variance parameters.
| |
| GammaFromShapeAndScale(Double, Double) |
Creates a Gamma-distributed random variable from its shape and scale parameters.
| |
| GaussianFromMeanAndPrecision(Variable<(Of <(Double>)>), Variable<(Of <(Double>)>)) |
Creates a Gaussian-distributed random variable from its mean and precision.
| |
| GaussianFromMeanAndPrecision(Double, Variable<(Of <(Double>)>)) |
Creates a Gaussian-distributed random variable from its mean and precision.
| |
| GaussianFromMeanAndPrecision(Variable<(Of <(Double>)>), Double) |
Creates a Gaussian-distributed random variable from its mean and precision.
| |
| GaussianFromMeanAndPrecision(Double, Double) |
Creates a Gaussian-distributed random variable from its mean and precision.
| |
| GaussianFromMeanAndVariance(Variable<(Of <(Double>)>), Double) |
Creates a Gaussian-distributed random variable from its mean and variance.
| |
| GaussianFromMeanAndVariance(Double, Double) |
Creates a Gaussian-distributed random variable from its mean and variance.
| |
| GetAttributes<(Of <(AttributeType>)>)()()() |
Get all attributes of this variable having type AttributeType.
| |
| GetContainers<(Of <(T>)>)()()() |
List of containers for this variable (ForEachBlock, IfBlock, etc.)
| |
| GetDomainType()()() |
Gets the domain type of a Variable<T>
| |
| GetExpression()()() |
Gets a syntax tree which refers to this variable in MSL.
(Overrides ConstrainableExpression.GetExpression()()().) | |
| GetItems<(Of <(T>)>)(Variable<(Of <(array<T>[]()[]>)>), VariableArray<(Of <(Int32>)>)) |
Gets a variable array containing (possibly duplicated) items of a source array
| |
| GetItems<(Of <(T>)>)(Variable<(Of <(IList<(Of <(T>)>)>)>), VariableArray<(Of <(Int32>)>)) |
Gets a variable array containing (possibly duplicated) items of a source array
| |
| GetItems<(Of <(T>)>)(Variable<(Of <(array<T>[]()[]>)>), Variable<(Of <(array<Int32>[]()[]>)>), Range) | Obsolete.
Gets a variable array which is a subarray of a source array
DEPRECATED
| |
| GetItems<(Of <(T>)>)(Variable<(Of <(IList<(Of <(T>)>)>)>), Variable<(Of <(array<Int32>[]()[]>)>), Range) | Obsolete.
Gets a variable array which is a subarray of a source array.
DEPRECATED
| |
| GetItems<(Of <(T>)>)(Variable<(Of <(array<T>[]()[]>)>), Variable<(Of <(IList<(Of <(Int32>)>)>)>), Range) | Obsolete.
Gets a variable array which is a subarray of a source array.
DEPRECATED
| |
| GetItems<(Of <(T>)>)(Variable<(Of <(IList<(Of <(T>)>)>)>), Variable<(Of <(IList<(Of <(Int32>)>)>)>), Range) | Obsolete.
Gets a variable array which is a subarray of a source array.
DEPRECATED
| |
| GetItems<(Of <(T>)>)(Variable<(Of <(array<T>[]()[]>)>), ConstantArray<(Of <(Int32>)>)) | Obsolete.
Gets a variable array which is a subarray of a source array.
DEPRECATED
| |
| GetItems<(Of <(T>)>)(Variable<(Of <(array<T>[]()[]>)>), GivenArray<(Of <(Int32>)>)) | Obsolete.
Gets a variable array which is a subarray of a source array
DEPRECATED
| |
| GetValueRange()()() |
Get the ValueRange attribute of this variable, if any has been set.
| |
| GetValueRange(Boolean) |
Get the ValueRange attribute of this variable, if any has been set.
| |
| Given<(Of <(T>)>)()()() | Obsolete.
Defines a new given.
| |
| Given<(Of <(T>)>)(Range) | Obsolete.
Defines a new given array
| |
| Given<(Of <(T>)>)(Range, Range) | Obsolete.
Defines a new given doubly-indexed array
| |
| If(Variable<(Of <(Boolean>)>)) |
Opens a stochastic if statement, active when the argument is true.
| |
| IfNot(Variable<(Of <(Boolean>)>)) |
Opens a stochastic if statement, active when the argument is false.
| |
| InnerProduct(Variable<(Of <(Vector>)>), Variable<(Of <(Vector>)>)) |
Returns a double random variable which is the inner product of two vector variables.
| |
| InnerProduct(Vector, Variable<(Of <(Vector>)>)) |
Returns a double random variable which is the inner product of a vector and a vector variable.
| |
| InnerProduct(Variable<(Of <(Vector>)>), Vector) |
Returns a double random variable which is the inner product of a vector and a vector variable.
| |
| IsBetween(Variable<(Of <(Double>)>), Variable<(Of <(Double>)>), Variable<(Of <(Double>)>)) |
Returns a boolean random variable indicating if the supplied double random variable is between
the specified limits.
| |
| IsBetween(Variable<(Of <(Double>)>), Variable<(Of <(Double>)>), Double) |
Returns a boolean random variable indicating if the supplied double random variable is between
the specified limits.
| |
| IsBetween(Variable<(Of <(Double>)>), Double, Variable<(Of <(Double>)>)) |
Returns a boolean random variable indicating if the supplied double random variable is between
the specified limits.
| |
| IsBetween(Variable<(Of <(Double>)>), Double, Double) |
Returns a boolean random variable indicating if the supplied double random variable is between
the specified limits.
| |
| IsDefined |
True if the variable is defined in the current condition context.
| |
| IsObserved |
Is Observed property
| |
| IsPositive(Variable<(Of <(Double>)>)) |
Returns a boolean random variable indicating if the supplied double random variable is positive.
| |
| IsReadOnly |
Read only property
| |
| LookupOperatorFactor<(Of <(T1>)>)(Operator) |
Retrieves the factor method corresponding to a particular operator.
| |
| MatrixMultiply(IVariableArray2D<(Of <(Double>)>), IVariableArray2D<(Of <(Double>)>)) |
Returns a 2-D array of variables which is the matrix product of two other 2-D arrays of variables
| |
| MatrixTimesVector(Variable<(Of <(Matrix>)>), Variable<(Of <(Vector>)>)) |
Returns a Vector variable which is the product of a Matrix variable with a Vector variable
| |
| Max(Variable<(Of <(Double>)>), Variable<(Of <(Double>)>)) |
Returns a double variable which is the max of two double variables
| |
| Name |
Name
(Overrides ConstrainableExpression.Name.) | |
| New<(Of <(T>)>)()()() |
Creates a variable with no definition.
| |
| Observed<(Of <(T>)>)(T) |
Creates a variable and observes it.
| |
| Observed<(Of <(T>)>)(array<T>[]()[]) |
Creates a variable array and observes it.
| |
| Observed<(Of <(T>)>)(array<T,2>[,](,)[,]) |
Creates a 2D variable array and observes it.
| |
| Observed<(Of <(T>)>)(array<T>[]()[], Range) |
Creates a variable array and observes it.
| |
| Observed<(Of <(T>)>)(array<T,2>[,](,)[,], Range, Range) |
Creates a 2D variable array and observes it.
| |
| HasObservedValue..::.ObservedValue |
Observed value property
| |
| Poisson(Double) |
Creates a Poisson-distributed random variable with the specified mean
| |
| Poisson(Variable<(Of <(Double>)>)) |
Creates a Poisson-distributed random variable with the specified mean
| |
| Random<(Of <(T>)>)(IDistribution<(Of <(T>)>)) |
Creates a random variable with the specified prior distribution.
| |
| Random<(Of <(T, TDist>)>)(Variable<(Of <(TDist>)>)) |
Creates a random variable with the specified prior distribution
| |
| RegisterOperatorFactor(Operator, Delegate) |
Registers a factor method against a particular operator.
| |
| SetValueRange(Range) |
Set the ValueRange attribute of this variable, replacing any previously set.
| |
| Subarray<(Of <(T>)>)(Variable<(Of <(array<T>[]()[]>)>), VariableArray<(Of <(Int32>)>)) |
Gets a variable array containing different items of a source array
| |
| Sum(Variable<(Of <(IList<(Of <(Double>)>)>)>)) |
Returns a double variable which is the sum of the elements of an array variable.
For sum of two variables, just use the + operator
| |
| Sum(Variable<(Of <(array<Double>[]()[]>)>)) |
Returns a double variable which is the sum of the elements of an array variable.
For sum of two variables, just use the + operator
| |
| Switch(Variable<(Of <(Int32>)>)) |
Opens a stochastic switch statement using the specified condition variable. This is equivalent
to creating a set of identical Variable.Case() statements for each value of i. Within a switch block,
you can use the variable i as an array index.
| |
| VectorGaussianFromMeanAndPrecision(Variable<(Of <(Vector>)>), Variable<(Of <(PositiveDefiniteMatrix>)>)) |
Creates a Gaussian-distributed random vector from a mean vector and precision positive definite matrix.
| |
| VectorGaussianFromMeanAndPrecision(Vector, Variable<(Of <(PositiveDefiniteMatrix>)>)) |
Creates a Gaussian-distributed random vector from a mean vector and precision positive definite matrix.
| |
| VectorGaussianFromMeanAndPrecision(Variable<(Of <(Vector>)>), PositiveDefiniteMatrix) |
Creates a Gaussian-distributed random vector from a mean vector and precision positive definite matrix.
| |
| VectorGaussianFromMeanAndPrecision(Vector, PositiveDefiniteMatrix) |
Creates a Gaussian-distributed random vector from a mean vector and precision positive definite matrix.
| |
| VectorGaussianFromMeanAndVariance(Vector, PositiveDefiniteMatrix) |
Creates a Gaussian-distributed random vector from a mean vector and variance positive definite matrix.
| |
| VectorGaussianFromMeanAndVariance(Variable<(Of <(Vector>)>), PositiveDefiniteMatrix) |
Creates a Gaussian-distributed random vector from a mean vector and variance positive definite matrix.
| |
| WishartFromShapeAndScale(Double, PositiveDefiniteMatrix) |
Creates a Wishart-distributed random matrix from its shape and scale parameters.
|
Variables can be base or derived. A base Variable is explicitly declared as a variable in MSL.
A derived Variable is simply an expression built from variables.
For example, the expression a[i] is a derived Variable called an item variable.
Every method that manipulates Variable objects must be aware of this distinction.