Class SubarrayOp<T>
Provides outgoing messages for Subarray<T>(IReadOnlyList<T>, IReadOnlyList<Int32>), given random arguments to the function.
Inherited Members
Namespace: Microsoft.ML.Probabilistic.Factors
Assembly: Microsoft.ML.Probabilistic.dll
Syntax
[FactorMethod(typeof(Collection), "Subarray<>", new Type[]{})]
[Quality(QualityBand.Mature)]
public static class SubarrayOp<T>
Type Parameters
Name | Description |
---|---|
T | The type of an array item. |
Methods
ArrayAverageConditional<DistributionType, ArrayType>(IReadOnlyList<DistributionType>, IReadOnlyList<Int32>, ArrayType)
EP message to array
.
Declaration
public static ArrayType ArrayAverageConditional<DistributionType, ArrayType>([SkipIfAllUniform] IReadOnlyList<DistributionType> items, IReadOnlyList<int> indices, ArrayType result)
where DistributionType : SettableTo<DistributionType> where ArrayType : IList<DistributionType>, SettableToUniform
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyList<DistributionType> | items | Incoming message from |
IReadOnlyList<Int32> | indices | Constant value for |
ArrayType | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
ArrayType |
|
Type Parameters
Name | Description |
---|---|
DistributionType | The type of a distribution over an array item. |
ArrayType | The type of the outgoing message. |
Remarks
The outgoing message is a distribution matching the moments of array
as the random arguments are varied. The formula is proj[p(array) sum_(items) p(items) factor(items,array,indices)]/p(array)
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
ArrayAverageConditional<DistributionType, ArrayType>(IReadOnlyList<T>, IReadOnlyList<Int32>, ArrayType)
EP message to array
.
Declaration
public static ArrayType ArrayAverageConditional<DistributionType, ArrayType>(IReadOnlyList<T> items, IReadOnlyList<int> indices, ArrayType result)
where DistributionType : HasPoint<T> where ArrayType : IList<DistributionType>, SettableToUniform
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyList<T> | items | Incoming message from |
IReadOnlyList<Int32> | indices | Constant value for |
ArrayType | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
ArrayType |
|
Type Parameters
Name | Description |
---|---|
DistributionType | The type of a distribution over an array item. |
ArrayType | The type of the outgoing message. |
Remarks
The outgoing message is a distribution matching the moments of array
as the random arguments are varied. The formula is proj[p(array) sum_(items) p(items) factor(items,array,indices)]/p(array)
.
ArrayAverageLogarithm<DistributionType, ArrayType>(IReadOnlyList<DistributionType>, IReadOnlyList<Int32>, ArrayType)
VMP message to array
.
Declaration
public static ArrayType ArrayAverageLogarithm<DistributionType, ArrayType>([SkipIfAllUniform] IReadOnlyList<DistributionType> items, IReadOnlyList<int> indices, ArrayType result)
where DistributionType : SettableTo<DistributionType> where ArrayType : IList<DistributionType>, SettableToUniform
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyList<DistributionType> | items | Incoming message from |
IReadOnlyList<Int32> | indices | Constant value for |
ArrayType | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
ArrayType |
|
Type Parameters
Name | Description |
---|---|
DistributionType | The type of a distribution over an array item. |
ArrayType | The type of the outgoing message. |
Remarks
The outgoing message is the factor viewed as a function of array
with items
integrated out. The formula is sum_items p(items) factor(items,array,indices)
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
ArrayAverageLogarithm<DistributionType, ArrayType>(IReadOnlyList<T>, IReadOnlyList<Int32>, ArrayType)
VMP message to array
.
Declaration
public static ArrayType ArrayAverageLogarithm<DistributionType, ArrayType>(IReadOnlyList<T> items, IReadOnlyList<int> indices, ArrayType result)
where DistributionType : HasPoint<T> where ArrayType : IList<DistributionType>, SettableToUniform
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyList<T> | items | Incoming message from |
IReadOnlyList<Int32> | indices | Constant value for |
ArrayType | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
ArrayType |
|
Type Parameters
Name | Description |
---|---|
DistributionType | The type of a distribution over an array item. |
ArrayType | The type of the outgoing message. |
Remarks
The outgoing message is the factor viewed as a function of array
with items
integrated out. The formula is sum_items p(items) factor(items,array,indices)
.
AverageLogFactor()
Evidence message for VMP.
Declaration
public static double AverageLogFactor()
Returns
Type | Description |
---|---|
Double | Zero. |
Remarks
The formula for the result is log(factor(items,array,indices))
. Adding up these values across all factors and variables gives the log-evidence estimate for VMP.
ItemsAverageConditional<DistributionType, ResultType>(IReadOnlyList<DistributionType>, IReadOnlyList<Int32>, ResultType)
EP message to items
.
Declaration
public static ResultType ItemsAverageConditional<DistributionType, ResultType>([SkipIfAllUniform] IReadOnlyList<DistributionType> array, IReadOnlyList<int> indices, ResultType result)
where DistributionType : SettableTo<DistributionType> where ResultType : IList<DistributionType>
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyList<DistributionType> | array | Incoming message from |
IReadOnlyList<Int32> | indices | Constant value for |
ResultType | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
ResultType |
|
Type Parameters
Name | Description |
---|---|
DistributionType | The type of a distribution over an array item. |
ResultType | The type of the outgoing message. |
Remarks
The outgoing message is a distribution matching the moments of items
as the random arguments are varied. The formula is proj[p(items) sum_(array) p(array) factor(items,array,indices)]/p(items)
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
ItemsAverageConditionalInit<TDist>(DistributionRefArray<TDist, T>, IReadOnlyList<Int32>)
Declaration
public static DistributionRefArray<TDist, T> ItemsAverageConditionalInit<TDist>(DistributionRefArray<TDist, T> array, IReadOnlyList<int> indices)
where TDist : class, SettableTo<TDist>, SettableToProduct<TDist>, SettableToRatio<TDist>, SettableToPower<TDist>, SettableToWeightedSum<TDist>, CanGetLogAverageOf<TDist>, CanGetLogAverageOfPower<TDist>, CanGetAverageLog<TDist>, IDistribution<T>, Sampleable<T>
Parameters
Type | Name | Description |
---|---|---|
DistributionRefArray<TDist, T> | array | Incoming message from |
IReadOnlyList<Int32> | indices | Constant value for |
Returns
Type | Description |
---|---|
DistributionRefArray<TDist, T> |
Type Parameters
Name | Description |
---|---|
TDist | The type of a distribution over an array item. |
Remarks
ItemsAverageConditionalInit<TDist>(DistributionStructArray<TDist, T>, IReadOnlyList<Int32>)
Declaration
public static DistributionStructArray<TDist, T> ItemsAverageConditionalInit<TDist>(DistributionStructArray<TDist, T> array, IReadOnlyList<int> indices)
where TDist : struct, SettableToProduct<TDist>, SettableToRatio<TDist>, SettableToPower<TDist>, SettableToWeightedSum<TDist>, CanGetLogAverageOf<TDist>, CanGetLogAverageOfPower<TDist>, CanGetAverageLog<TDist>, IDistribution<T>, Sampleable<T>
Parameters
Type | Name | Description |
---|---|---|
DistributionStructArray<TDist, T> | array | Incoming message from |
IReadOnlyList<Int32> | indices | Constant value for |
Returns
Type | Description |
---|---|
DistributionStructArray<TDist, T> |
Type Parameters
Name | Description |
---|---|
TDist | The type of a distribution over an array item. |
Remarks
ItemsAverageLogarithm<DistributionType, ResultType>(IReadOnlyList<DistributionType>, IReadOnlyList<Int32>, ResultType)
VMP message to items
.
Declaration
public static ResultType ItemsAverageLogarithm<DistributionType, ResultType>([SkipIfAllUniform] IReadOnlyList<DistributionType> array, IReadOnlyList<int> indices, ResultType result)
where DistributionType : SettableTo<DistributionType> where ResultType : IList<DistributionType>
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyList<DistributionType> | array | Incoming message from |
IReadOnlyList<Int32> | indices | Constant value for |
ResultType | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
ResultType |
|
Type Parameters
Name | Description |
---|---|
DistributionType | The type of a distribution over an array item. |
ResultType | The type of the outgoing message. |
Remarks
The outgoing message is a distribution matching the moments of items
as the random arguments are varied. The formula is proj[sum_(array) p(array) factor(items,array,indices)]
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
ItemsAverageLogarithmInit<TDist>(DistributionRefArray<TDist, T>, IReadOnlyList<Int32>)
Declaration
public static DistributionRefArray<TDist, T> ItemsAverageLogarithmInit<TDist>(DistributionRefArray<TDist, T> array, IReadOnlyList<int> indices)
where TDist : class, SettableTo<TDist>, SettableToProduct<TDist>, SettableToRatio<TDist>, SettableToPower<TDist>, SettableToWeightedSum<TDist>, CanGetLogAverageOf<TDist>, CanGetLogAverageOfPower<TDist>, CanGetAverageLog<TDist>, IDistribution<T>, Sampleable<T>
Parameters
Type | Name | Description |
---|---|---|
DistributionRefArray<TDist, T> | array | Incoming message from |
IReadOnlyList<Int32> | indices | Constant value for |
Returns
Type | Description |
---|---|
DistributionRefArray<TDist, T> |
Type Parameters
Name | Description |
---|---|
TDist | The type of a distribution over an array item. |
Remarks
ItemsAverageLogarithmInit<TDist>(DistributionStructArray<TDist, T>, IReadOnlyList<Int32>)
Declaration
public static DistributionStructArray<TDist, T> ItemsAverageLogarithmInit<TDist>(DistributionStructArray<TDist, T> array, IReadOnlyList<int> indices)
where TDist : struct, SettableToProduct<TDist>, SettableToRatio<TDist>, SettableToPower<TDist>, SettableToWeightedSum<TDist>, CanGetLogAverageOf<TDist>, CanGetLogAverageOfPower<TDist>, CanGetAverageLog<TDist>, IDistribution<T>, Sampleable<T>
Parameters
Type | Name | Description |
---|---|---|
DistributionStructArray<TDist, T> | array | Incoming message from |
IReadOnlyList<Int32> | indices | Constant value for |
Returns
Type | Description |
---|---|
DistributionStructArray<TDist, T> |
Type Parameters
Name | Description |
---|---|
TDist | The type of a distribution over an array item. |
Remarks
ItemsDeriv<ResultType>(ResultType)
Declaration
public static ResultType ItemsDeriv<ResultType>(ResultType result)
where ResultType : SettableToUniform
Parameters
Type | Name | Description |
---|---|---|
ResultType | result |
Returns
Type | Description |
---|---|
ResultType |
Type Parameters
Name | Description |
---|---|
ResultType |
LogAverageFactor(IReadOnlyList<T>, IReadOnlyList<T>, IReadOnlyList<Int32>)
Evidence message for EP.
Declaration
public static double LogAverageFactor(IReadOnlyList<T> items, IReadOnlyList<T> array, IReadOnlyList<int> indices)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyList<T> | items | Incoming message from |
IReadOnlyList<T> | array | Incoming message from |
IReadOnlyList<Int32> | indices | Constant value for |
Returns
Type | Description |
---|---|
Double | Logarithm of the factor's average value across the given argument distributions. |
Remarks
The formula for the result is log(sum_(items,array) p(items,array) factor(items,array,indices))
.
LogAverageFactor<DistributionType>(IReadOnlyList<DistributionType>, IReadOnlyList<DistributionType>, IReadOnlyList<Int32>)
Evidence message for EP.
Declaration
public static double LogAverageFactor<DistributionType>(IReadOnlyList<DistributionType> items, IReadOnlyList<DistributionType> array, IReadOnlyList<int> indices)
where DistributionType : CanGetLogAverageOf<DistributionType>
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyList<DistributionType> | items | Incoming message from |
IReadOnlyList<DistributionType> | array | Incoming message from |
IReadOnlyList<Int32> | indices | Constant value for |
Returns
Type | Description |
---|---|
Double | Logarithm of the factor's average value across the given argument distributions. |
Type Parameters
Name | Description |
---|---|
DistributionType | The type of a distribution over an array item. |
Remarks
The formula for the result is log(sum_(items,array) p(items,array) factor(items,array,indices))
.
LogAverageFactor<DistributionType>(IReadOnlyList<DistributionType>, IReadOnlyList<T>, IReadOnlyList<Int32>)
Evidence message for EP.
Declaration
public static double LogAverageFactor<DistributionType>(IReadOnlyList<DistributionType> items, IReadOnlyList<T> array, IReadOnlyList<int> indices)
where DistributionType : CanGetLogProb<T>
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyList<DistributionType> | items | Incoming message from |
IReadOnlyList<T> | array | Incoming message from |
IReadOnlyList<Int32> | indices | Constant value for |
Returns
Type | Description |
---|---|
Double | Logarithm of the factor's average value across the given argument distributions. |
Type Parameters
Name | Description |
---|---|
DistributionType | The type of a distribution over an array item. |
Remarks
The formula for the result is log(sum_(items,array) p(items,array) factor(items,array,indices))
.
LogAverageFactor<DistributionType>(IReadOnlyList<T>, IReadOnlyList<DistributionType>, IReadOnlyList<Int32>)
Evidence message for EP.
Declaration
public static double LogAverageFactor<DistributionType>(IReadOnlyList<T> items, IReadOnlyList<DistributionType> array, IReadOnlyList<int> indices)
where DistributionType : CanGetLogProb<T>
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyList<T> | items | Incoming message from |
IReadOnlyList<DistributionType> | array | Incoming message from |
IReadOnlyList<Int32> | indices | Constant value for |
Returns
Type | Description |
---|---|
Double | Logarithm of the factor's average value across the given argument distributions. |
Type Parameters
Name | Description |
---|---|
DistributionType | The type of a distribution over an array item. |
Remarks
The formula for the result is log(sum_(items,array) p(items,array) factor(items,array,indices))
.
LogEvidenceRatio(IReadOnlyList<T>, IReadOnlyList<T>, IReadOnlyList<Int32>)
Evidence message for EP.
Declaration
public static double LogEvidenceRatio(IReadOnlyList<T> items, IReadOnlyList<T> array, IReadOnlyList<int> indices)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyList<T> | items | Incoming message from |
IReadOnlyList<T> | array | Incoming message from |
IReadOnlyList<Int32> | indices | Constant value for |
Returns
Type | Description |
---|---|
Double | Logarithm of the factor's contribution the EP model evidence. |
Remarks
The formula for the result is log(sum_(items,array) p(items,array) factor(items,array,indices) / sum_items p(items) messageTo(items))
. Adding up these values across all factors and variables gives the log-evidence estimate for EP.
LogEvidenceRatio<DistributionType>(IReadOnlyList<DistributionType>)
Evidence message for EP.
Declaration
public static double LogEvidenceRatio<DistributionType>(IReadOnlyList<DistributionType> items)
where DistributionType : CanGetLogAverageOf<DistributionType>
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyList<DistributionType> | items | Incoming message from |
Returns
Type | Description |
---|---|
Double | Logarithm of the factor's contribution the EP model evidence. |
Type Parameters
Name | Description |
---|---|
DistributionType | The type of a distribution over an array item. |
Remarks
The formula for the result is log(sum_(items) p(items) factor(items,array,indices) / sum_items p(items) messageTo(items))
. Adding up these values across all factors and variables gives the log-evidence estimate for EP.
LogEvidenceRatio<DistributionType>(IReadOnlyList<T>, IReadOnlyList<DistributionType>, IReadOnlyList<Int32>)
Evidence message for EP.
Declaration
public static double LogEvidenceRatio<DistributionType>(IReadOnlyList<T> items, IReadOnlyList<DistributionType> array, IReadOnlyList<int> indices)
where DistributionType : CanGetLogProb<T>
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyList<T> | items | Incoming message from |
IReadOnlyList<DistributionType> | array | Incoming message from |
IReadOnlyList<Int32> | indices | Constant value for |
Returns
Type | Description |
---|---|
Double | Logarithm of the factor's contribution the EP model evidence. |
Type Parameters
Name | Description |
---|---|
DistributionType | The type of a distribution over an array item. |
Remarks
The formula for the result is log(sum_(items,array) p(items,array) factor(items,array,indices) / sum_items p(items) messageTo(items))
. Adding up these values across all factors and variables gives the log-evidence estimate for EP.