Class ConfidencePredictingSequenceModel
java.lang.Object
org.tribuo.sequence.SequenceModel<Label>
org.tribuo.classification.sequence.ConfidencePredictingSequenceModel
- All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.provenance.Provenancable<ModelProvenance>
,Serializable
- Direct Known Subclasses:
CRFModel
A Sequence model which can provide confidence predictions for subsequence predictions.
Used to provide confidence scores on a per subsequence level.
The exemplar of this is providing a confidence score for each Named Entity present in a SequenceExample.
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A range class used to define a subsequence of a SequenceExample. -
Field Summary
Fields inherited from class org.tribuo.sequence.SequenceModel
featureIDMap, name, outputIDMap, provenanceOutput
-
Constructor Summary
ModifierConstructorDescriptionprotected
ConfidencePredictingSequenceModel
(String name, ModelProvenance description, ImmutableFeatureMap featureIDMap, ImmutableOutputInfo<Label> labelIDMap) Constructs a ConfidencePredictingSequenceModel with the supplied parameters. -
Method Summary
Modifier and TypeMethodDescriptionstatic <SUB extends ConfidencePredictingSequenceModel.Subsequence>
List<Double>multiplyWeights
(List<Prediction<Label>> predictions, List<SUB> subsequences) A scoring method which multiplies together the per prediction scores.abstract <SUB extends ConfidencePredictingSequenceModel.Subsequence>
List<Double>scoreSubsequences
(SequenceExample<Label> example, List<Prediction<Label>> predictions, List<SUB> subsequences) The scoring function for the subsequences.Methods inherited from class org.tribuo.sequence.SequenceModel
getFeatureIDMap, getName, getOutputIDInfo, getProvenance, getTopFeatures, predict, predict, predict, setName, toMaxLabels, toString, validate
-
Constructor Details
-
ConfidencePredictingSequenceModel
protected ConfidencePredictingSequenceModel(String name, ModelProvenance description, ImmutableFeatureMap featureIDMap, ImmutableOutputInfo<Label> labelIDMap) Constructs a ConfidencePredictingSequenceModel with the supplied parameters.- Parameters:
name
- The model name.description
- The model provenance.featureIDMap
- The feature domain.labelIDMap
- The output domain.
-
-
Method Details
-
scoreSubsequences
public abstract <SUB extends ConfidencePredictingSequenceModel.Subsequence> List<Double> scoreSubsequences(SequenceExample<Label> example, List<Prediction<Label>> predictions, List<SUB> subsequences) The scoring function for the subsequences. Provides the scores which should be assigned to each subsequence.- Type Parameters:
SUB
- The subsequence type.- Parameters:
example
- The input sequence example.predictions
- The predictions produced by this model.subsequences
- The subsequences to score.- Returns:
- The scores for the subsequences.
-
multiplyWeights
public static <SUB extends ConfidencePredictingSequenceModel.Subsequence> List<Double> multiplyWeights(List<Prediction<Label>> predictions, List<SUB> subsequences) A scoring method which multiplies together the per prediction scores.- Type Parameters:
SUB
- The subsequence type.- Parameters:
predictions
- The element level predictions.subsequences
- The subsequences denoting prediction boundaries.- Returns:
- A list of scores for each subsequence.
-