Class GetItemsOp<T>
Inherited Members
Namespace: Microsoft.ML.Probabilistic.Factors
Assembly: Microsoft.ML.Probabilistic.dll
Syntax
[FactorMethod(typeof(Collection), "GetItems<>", new Type[]{}, Default = true)]
[Quality(QualityBand.Mature)]
[Buffers(new string[]{"marginal"})]
public static class GetItemsOp<T>
Type Parameters
Name | Description |
---|---|
T | The type of an 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 : SettableToProduct<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 array elements. |
ArrayType | The type of the resulting array. |
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>([SkipIfAllUniform] 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 array elements. |
ArrayType | The type of the resulting array. |
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 |
|
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 : SettableToUniform, SettableToProduct<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 array elements. |
ArrayType | The type of the resulting array. |
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 array elements. |
ArrayType | The type of the resulting array. |
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(IReadOnlyList<T>, IReadOnlyList<T>, IReadOnlyList<Int32>)
Evidence message for VMP.
Declaration
public static double AverageLogFactor(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 | Zero. |
Remarks
In Variational Message Passing, the evidence contribution of a deterministic factor is zero. Adding up these values across all factors and variables gives the log-evidence estimate for VMP.
AverageLogFactor<DistributionType>(IReadOnlyList<DistributionType>, IReadOnlyList<DistributionType>)
Evidence message for VMP.
Declaration
public static double AverageLogFactor<DistributionType>(IReadOnlyList<DistributionType> items, IReadOnlyList<DistributionType> array)
where DistributionType : SettableToProduct<DistributionType>, CanGetLogAverageOf<DistributionType>
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyList<DistributionType> | items | Incoming message from |
IReadOnlyList<DistributionType> | array | Incoming message from |
Returns
Type | Description |
---|---|
Double | Zero. |
Type Parameters
Name | Description |
---|---|
DistributionType | The type of a distribution over array elements. |
Remarks
In Variational Message Passing, the evidence contribution of a deterministic factor is zero. Adding up these values across all factors and variables gives the log-evidence estimate for VMP.
AverageLogFactor<DistributionType>(IReadOnlyList<DistributionType>, IReadOnlyList<T>)
Evidence message for VMP.
Declaration
public static double AverageLogFactor<DistributionType>(IReadOnlyList<DistributionType> items, IReadOnlyList<T> array)
where DistributionType : CanGetLogProb<T>
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyList<DistributionType> | items | Incoming message from |
IReadOnlyList<T> | array | Incoming message from |
Returns
Type | Description |
---|---|
Double | Zero. |
Type Parameters
Name | Description |
---|---|
DistributionType | The type of a distribution over array elements. |
Remarks
In Variational Message Passing, the evidence contribution of a deterministic factor is zero. Adding up these values across all factors and variables gives the log-evidence estimate for VMP.
AverageLogFactor<DistributionType>(IReadOnlyList<T>, IReadOnlyList<DistributionType>)
Evidence message for VMP.
Declaration
public static double AverageLogFactor<DistributionType>(IReadOnlyList<T> items, IReadOnlyList<DistributionType> array)
where DistributionType : HasPoint<T>, CanGetLogProb<T>
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyList<T> | items | Incoming message from |
IReadOnlyList<DistributionType> | array | Incoming message from |
Returns
Type | Description |
---|---|
Double | Zero. |
Type Parameters
Name | Description |
---|---|
DistributionType | The type of a distribution over array elements. |
Remarks
In Variational Message Passing, the evidence contribution of a deterministic factor is zero. Adding up these values across all factors and variables gives the log-evidence estimate for VMP.
ItemsAverageConditional<ArrayType, DistributionType>(DistributionType, ArrayType, ArrayType, IReadOnlyList<Int32>, Int32, DistributionType)
EP message to items
.
Declaration
public static DistributionType ItemsAverageConditional<ArrayType, DistributionType>(DistributionType items, ArrayType array, [SkipIfAllUniform] ArrayType marginal, IReadOnlyList<int> indices, int resultIndex, DistributionType result)
where ArrayType : IList<DistributionType> where DistributionType : SettableToProduct<DistributionType>, SettableToRatio<DistributionType>
Parameters
Type | Name | Description |
---|---|---|
DistributionType | items | Incoming message from |
ArrayType | array | Incoming message from |
ArrayType | marginal | Buffer |
IReadOnlyList<Int32> | indices | Constant value for |
Int32 | resultIndex | Index of the |
DistributionType | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
DistributionType |
|
Type Parameters
Name | Description |
---|---|
ArrayType | The type of an array for the marginal. |
DistributionType | The type of a distribution over array elements. |
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)
.
ItemsAverageLogarithm<DistributionType>(IReadOnlyList<DistributionType>, IReadOnlyList<Int32>, Int32, DistributionType)
VMP message to items
.
Declaration
public static DistributionType ItemsAverageLogarithm<DistributionType>([SkipIfAllUniform] IReadOnlyList<DistributionType> array, IReadOnlyList<int> indices, int resultIndex, DistributionType result)
where DistributionType : SettableTo<DistributionType>
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyList<DistributionType> | array | Incoming message from |
IReadOnlyList<Int32> | indices | Constant value for |
Int32 | resultIndex | Index of the |
DistributionType | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
DistributionType |
|
Type Parameters
Name | Description |
---|---|
DistributionType | The type of a distribution over array elements. |
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 |
|
ItemsAverageLogarithm2<DistributionType, ResultType>(IReadOnlyList<DistributionType>, IReadOnlyList<Int32>, ResultType)
Declaration
public static ResultType ItemsAverageLogarithm2<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 | |
IReadOnlyList<Int32> | indices | |
ResultType | result |
Returns
Type | Description |
---|---|
ResultType |
Type Parameters
Name | Description |
---|---|
DistributionType | |
ResultType |
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 array elements. |
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 array elements. |
Remarks
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 : IDistribution<T>, SettableToProduct<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 array elements. |
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 array elements. |
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 : HasPoint<T>, 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 array elements. |
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>, IReadOnlyList<DistributionType>, IReadOnlyList<Int32>, IReadOnlyList<DistributionType>)
Evidence message for EP.
Declaration
public static double LogEvidenceRatio<DistributionType>(IReadOnlyList<DistributionType> items, IReadOnlyList<DistributionType> array, IReadOnlyList<int> indices, IReadOnlyList<DistributionType> to_items)
where DistributionType : SettableToUniform, SettableToProduct<DistributionType>, CanGetLogAverageOf<DistributionType>, ICloneable
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyList<DistributionType> | items | Incoming message from |
IReadOnlyList<DistributionType> | array | Incoming message from |
IReadOnlyList<Int32> | indices | Constant value for |
IReadOnlyList<DistributionType> | to_items | Previous outgoing message to |
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 array elements. |
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>, IReadOnlyList<T>, IReadOnlyList<Int32>)
Evidence message for EP.
Declaration
public static double LogEvidenceRatio<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 contribution the EP model evidence. |
Type Parameters
Name | Description |
---|---|
DistributionType | The type of a distribution over array elements. |
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<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 : HasPoint<T>, 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 array elements. |
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.
Marginal<ArrayType, DistributionType>(IReadOnlyList<DistributionType>, IReadOnlyList<DistributionType>, ArrayType)
Declaration
[SkipIfAllUniform(new string[]{"array", "to_array"})]
public static ArrayType Marginal<ArrayType, DistributionType>(IReadOnlyList<DistributionType> array, IReadOnlyList<DistributionType> to_array, ArrayType result)
where ArrayType : IList<DistributionType>, SettableTo<ArrayType> where DistributionType : SettableToProduct<DistributionType>
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyList<DistributionType> | array | |
IReadOnlyList<DistributionType> | to_array | |
ArrayType | result |
Returns
Type | Description |
---|---|
ArrayType |
Type Parameters
Name | Description |
---|---|
ArrayType | The type of an array for the marginal. |
DistributionType | The type of a distribution over array elements. |
Marginal2<ArrayType, DistributionType>(ArrayType, IReadOnlyList<DistributionType>, IReadOnlyList<Int32>, ArrayType)
Declaration
[SkipIfAllUniform(new string[]{"array", "items"})]
public static ArrayType Marginal2<ArrayType, DistributionType>(ArrayType array, IReadOnlyList<DistributionType> items, IReadOnlyList<int> indices, ArrayType result)
where ArrayType : IList<DistributionType>, SettableTo<ArrayType> where DistributionType : SettableToProduct<DistributionType>
Parameters
Type | Name | Description |
---|---|---|
ArrayType | array | Incoming message from |
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 |
---|---|
ArrayType | The type of an array for the marginal. |
DistributionType | The type of a distribution over array elements. |
Remarks
MarginalIncrement<ArrayType, DistributionType>(ArrayType, DistributionType, DistributionType, IReadOnlyList<Int32>, Int32)
Declaration
public static ArrayType MarginalIncrement<ArrayType, DistributionType>(ArrayType result, DistributionType to_item, DistributionType item, IReadOnlyList<int> indices, int resultIndex)
where ArrayType : IList<DistributionType>, SettableTo<ArrayType> where DistributionType : SettableToProduct<DistributionType>
Parameters
Type | Name | Description |
---|---|---|
ArrayType | result | Modified to contain the outgoing message. |
DistributionType | to_item | |
DistributionType | item | |
IReadOnlyList<Int32> | indices | Constant value for |
Int32 | resultIndex | Index of the |
Returns
Type | Description |
---|---|
ArrayType |
|
Type Parameters
Name | Description |
---|---|
ArrayType | The type of an array for the marginal. |
DistributionType | The type of a distribution over array elements. |
Remarks
MarginalInit<ArrayType>(ArrayType)
Initialize the buffer marginal
.
Declaration
public static ArrayType MarginalInit<ArrayType>(ArrayType array)
where ArrayType : ICloneable
Parameters
Type | Name | Description |
---|---|---|
ArrayType | array | Incoming message from |
Returns
Type | Description |
---|---|
ArrayType | Initial value of buffer |
Type Parameters
Name | Description |
---|---|
ArrayType | The type of an array for the marginal. |
Remarks
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|