Interface WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.IWeightFunctionFactory<TWeightFunction>
Interface for a factory of weight functions, that is reponsible for performing operations that result in weight functions, but not necessarily accept them as arguments.
Namespace: Microsoft.ML.Probabilistic.Distributions.Automata
Assembly: Microsoft.ML.Probabilistic.dll
Syntax
[Quality(QualityBand.Experimental)]
public interface IWeightFunctionFactory<TWeightFunction>
where TWeightFunction : WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.IWeightFunction<TWeightFunction>, new()
Type Parameters
Name | Description |
---|---|
TWeightFunction | The type of a concrete weight function class. |
Methods
ConstantLog(Double, TElementDistribution)
Creates a weight function which maps every allowed sequence to a given value and maps all other sequences to zero. A sequence is allowed if all its elements have non-zero probability under a given distribution.
Declaration
TWeightFunction ConstantLog(double logValue, TElementDistribution allowedElements)
Parameters
Type | Name | Description |
---|---|---|
Double | logValue | The logarithm of the value to map every sequence to. |
TElementDistribution | allowedElements | The distribution representing allowed sequence elements. |
Returns
Type | Description |
---|---|
TWeightFunction | The created weight function |
ConstantOnSupportOfLog(Double, TWeightFunction)
Creates a weight function constant on the support of a given weight function.
Declaration
TWeightFunction ConstantOnSupportOfLog(double logValue, TWeightFunction weightFunction)
Parameters
Type | Name | Description |
---|---|---|
Double | logValue | The logarithm of the desired value on the support of |
TWeightFunction | weightFunction | The weight function. |
Returns
Type | Description |
---|---|
TWeightFunction | The created weight function |
Exceptions
Type | Condition |
---|---|
NotImplementedException | Thrown if if the |
FromAutomaton(TAutomaton)
Creates a weight function that is equal to the provided automaton on all sequences.
Declaration
TWeightFunction FromAutomaton(TAutomaton automaton)
Parameters
Type | Name | Description |
---|---|---|
TAutomaton | automaton | An automaton defining the weight function. |
Returns
Type | Description |
---|---|
TWeightFunction | The created point mass weight function. |
FromValues(IEnumerable<KeyValuePair<TSequence, Double>>)
Creates a weight function that assigns provided weights to provided sequences and zero weights to all other sequnces.
Declaration
TWeightFunction FromValues(IEnumerable<KeyValuePair<TSequence, double>> sequenceWeightPairs)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<KeyValuePair<TSequence, Double>> | sequenceWeightPairs | Pairs of sequences and corresponding weights |
Returns
Type | Description |
---|---|
TWeightFunction | The created point mass weight function. |
PointMass(TSequence)
Creates a point mass weight function.
Declaration
TWeightFunction PointMass(TSequence point)
Parameters
Type | Name | Description |
---|---|---|
TSequence | point | The point. |
Returns
Type | Description |
---|---|
TWeightFunction | The created point mass weight function. |
Sum(IEnumerable<TWeightFunction>)
Computes the sum of given weight functions.
Declaration
TWeightFunction Sum(IEnumerable<TWeightFunction> weightFunctions)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<TWeightFunction> | weightFunctions | The weight functions to sum. |
Returns
Type | Description |
---|---|
TWeightFunction | The sum of the given weight functions |
Zero()
Creates a weight function which is zero everywhere.
Declaration
TWeightFunction Zero()
Returns
Type | Description |
---|---|
TWeightFunction | The created weight function |