Class GibbsSampling
Gibbs sampling algorithm - includes block Gibbs sampling
Implements
Inherited Members
Namespace: Microsoft.ML.Probabilistic.Algorithms
Assembly: Microsoft.ML.Probabilistic.Compiler.dll
Syntax
public class GibbsSampling : AlgorithmBase, IAlgorithm
Fields
DefaultSideChannels
Declaration
public static bool DefaultSideChannels
Field Value
| Type | Description |
|---|---|
| Boolean |
UseSideChannels
Declaration
public bool UseSideChannels
Field Value
| Type | Description |
|---|---|
| Boolean |
Properties
BurnIn
The number of samples to discard at the beginning
Declaration
public int BurnIn { get; set; }
Property Value
| Type | Description |
|---|---|
| Int32 |
DefaultNumberOfIterations
Default number of iterations for Gibbs sampling
Declaration
public override int DefaultNumberOfIterations { get; set; }
Property Value
| Type | Description |
|---|---|
| Int32 |
Overrides
Name
Name of the algorithm
Declaration
public override string Name { get; }
Property Value
| Type | Description |
|---|---|
| String |
Overrides
ShortName
Short name of the algorithm
Declaration
public override string ShortName { get; }
Property Value
| Type | Description |
|---|---|
| String |
Overrides
Thin
Reduction factor when constructing sample and conditional lists
Declaration
public int Thin { get; set; }
Property Value
| Type | Description |
|---|---|
| Int32 |
Methods
ForEachDefaultQueryType(Action<QueryType>)
Get the default inference query types for a variable for this algorithm.
Declaration
public override void ForEachDefaultQueryType(Action<QueryType> action)
Parameters
| Type | Name | Description |
|---|---|---|
| Action<QueryType> | action |
Overrides
GetAlgorithmConversionOperator(Type, IAlgorithm, Boolean, List<Object>)
Gets the operator which converts a message to/from another algorithm
Declaration
public override MethodReference GetAlgorithmConversionOperator(Type channelType, IAlgorithm alg2, bool isFromFactor, List<object> args)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | channelType | Type of message |
| IAlgorithm | alg2 | The other algorithm |
| Boolean | isFromFactor | True if from, false if to |
| List<Object> | args | Where to add arguments of the operator |
Returns
| Type | Description |
|---|---|
| MethodReference | A method reference for the operator |
Overrides
GetEvidenceMethodName(List<ICompilerAttribute>)
Gets the suffix for Gibbs Sampling evidence method Evidence is not supported or supportable for Gibbs. The message update methods are marked as unsupported so that an appropriate error message is generated by the model compiler
Declaration
public override string GetEvidenceMethodName(List<ICompilerAttribute> factorAttributes)
Parameters
| Type | Name | Description |
|---|---|---|
| List<ICompilerAttribute> | factorAttributes |
Returns
| Type | Description |
|---|---|
| String |
Overrides
GetMessagePrototype(ChannelInfo, MessageDirection, IExpression, String, IList<QueryType>)
Get the message prototype in the specified direction
Declaration
public override IExpression GetMessagePrototype(ChannelInfo channelInfo, MessageDirection direction, IExpression marginalPrototypeExpression, string path, IList<QueryType> queryTypes)
Parameters
| Type | Name | Description |
|---|---|---|
| ChannelInfo | channelInfo | The channel information |
| MessageDirection | direction | The direction |
| IExpression | marginalPrototypeExpression | The marginal prototype expression |
| String | path | Path name of message |
| IList<QueryType> | queryTypes | The set of queries to support. Only used for marginal channels. |
Returns
| Type | Description |
|---|---|
| IExpression | An expression for the method prototype |
Overrides
GetOperatorMethodSuffix(List<ICompilerAttribute>)
Gets the suffix for Gibbs Sampling operator methods
Declaration
public override string GetOperatorMethodSuffix(List<ICompilerAttribute> factorAttributes)
Parameters
| Type | Name | Description |
|---|---|---|
| List<ICompilerAttribute> | factorAttributes |
Returns
| Type | Description |
|---|---|
| String |
Overrides
GetQueryTypeBinding(QueryType)
Get the query type binding for Gibbs sampling - this is the path to the given query type relative to the raw marginal type.
Declaration
public override string GetQueryTypeBinding(QueryType qt)
Parameters
| Type | Name | Description |
|---|---|---|
| QueryType | qt | The query type |
Returns
| Type | Description |
|---|---|
| String |
Overrides
GetVariableFactor(Boolean, Boolean)
Declaration
public override Delegate GetVariableFactor(bool derived, bool initialised)
Parameters
| Type | Name | Description |
|---|---|---|
| Boolean | derived | |
| Boolean | initialised |
Returns
| Type | Description |
|---|---|
| Delegate |
Overrides
ModifyFactorAttributes(IExpression, AttributeRegistry<Object, ICompilerAttribute>)
Allows the algorithm to modify the attributes on a factor. For example, in Gibbs sampling different message types are passed depending on the context. This is signalled to the MessageTransform by attaching a MessagePath attribute to the method invoke expression for the factor. If the factor is a 'variable' pseudo-factor (UsesEqualsDef) then all incoming variables are Distributions. Otherwise, incoming messages will depend on the grouping
Declaration
public override void ModifyFactorAttributes(IExpression factorExpression, AttributeRegistry<object, ICompilerAttribute> factorAttributes)
Parameters
| Type | Name | Description |
|---|---|---|
| IExpression | factorExpression | The factor expression |
| AttributeRegistry<Object, ICompilerAttribute> | factorAttributes | Attribute registry |