Class StringDictionaryWeightFunction
WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.DictionaryWeightFunction<TThis> specialized for strings.
Inheritance
Implements
Inherited Members
Namespace: Microsoft.ML.Probabilistic.Distributions.Automata
Assembly: Microsoft.ML.Probabilistic.dll
Syntax
[Serializable]
[DataContract]
[Quality(QualityBand.Experimental)]
public class StringDictionaryWeightFunction : WeightFunctions<string, char, ImmutableDiscreteChar, StringManipulator, StringAutomaton>.DictionaryWeightFunction<StringDictionaryWeightFunction>, WeightFunctions<string, char, ImmutableDiscreteChar, StringManipulator, StringAutomaton>.IWeightFunction<StringDictionaryWeightFunction>, WeightFunctions<string, char, ImmutableDiscreteChar, StringManipulator, StringAutomaton>.IWeightFunction, IEquatable<StringDictionaryWeightFunction>
Constructors
StringDictionaryWeightFunction()
Declaration
public StringDictionaryWeightFunction()
Methods
AsAutomaton()
Converts the current StringDictionaryWeightFunction to a deterministic automaton, compressing shared suffixes. When the current StringDictionaryWeightFunction is normalized, the resulting automaton is stochastic.
Declaration
public override StringAutomaton AsAutomaton()
Returns
Type | Description |
---|---|
StringAutomaton | A deterministic StringAutomaton. |
Overrides
GetLogNormalizerOfProduct(StringDictionaryWeightFunction)
Computes the logarithm of the normalizer (sum of values of the weight function on all sequences) of the product of the current and the given weight functions.
Declaration
protected override double GetLogNormalizerOfProduct(StringDictionaryWeightFunction weightFunction)
Parameters
Type | Name | Description |
---|---|---|
StringDictionaryWeightFunction | weightFunction |
Returns
Type | Description |
---|---|
Double | The logarithm of the normalizer. |
Overrides
Product(StringDictionaryWeightFunction)
Computes the product of the current weight function and a given one.
Declaration
public override StringDictionaryWeightFunction Product(StringDictionaryWeightFunction weightFunction)
Parameters
Type | Name | Description |
---|---|---|
StringDictionaryWeightFunction | weightFunction |
Returns
Type | Description |
---|---|
StringDictionaryWeightFunction | The computed product. |
Overrides
SetDistinctWeights(IEnumerable<KeyValuePair<String, Weight>>)
Replaces the internal sequence to weight dictionary with a new one using the supplied sequenceWeightPairs
.
If the supplied collection is expected to not contain multiple entries for the same sequence.
Declaration
protected override void SetDistinctWeights(IEnumerable<KeyValuePair<string, Weight>> sequenceWeightPairs)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<KeyValuePair<String, Weight>> | sequenceWeightPairs |
Overrides
Remarks
Should only ever be called in factory methods.
SetWeights(IEnumerable<KeyValuePair<String, Weight>>)
Replaces the internal sequence to weight dictionary with a new one using the supplied sequenceWeightPairs
.
If the supplied collection contains multiple entries for the same sequence, the weights for that sequence are summed.
Declaration
protected override void SetWeights(IEnumerable<KeyValuePair<string, Weight>> sequenceWeightPairs)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<KeyValuePair<String, Weight>> | sequenceWeightPairs |
Overrides
Remarks
Should only ever be called in factory methods.