Class MultiLabelVotingCombiner
java.lang.Object
org.tribuo.multilabel.ensemble.MultiLabelVotingCombiner
- All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.config.Configurable,com.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>,Serializable,EnsembleCombiner<MultiLabel>,ProtoSerializable<org.tribuo.protos.core.EnsembleCombinerProto>
A combiner which performs a weighted or unweighted vote independently across the predicted labels in each multi-label.
This uses the thresholded predictions from each ensemble member.
This class is stateless and thread safe.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intProtobuf serialization version.Fields inherited from interface org.tribuo.protos.ProtoSerializable
DESERIALIZATION_METHOD_NAME, PROVENANCE_SERIALIZER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncombine(ImmutableOutputInfo<MultiLabel> outputInfo, List<Prediction<MultiLabel>> predictions) Combine the predictions.combine(ImmutableOutputInfo<MultiLabel> outputInfo, List<Prediction<MultiLabel>> predictions, float[] weights) Combine the supplied predictions.static MultiLabelVotingCombinerdeserializeFromProto(int version, String className, com.google.protobuf.Any message) Deserialization factory.booleanexportCombiner(ONNXNode input) Exports this voting combiner to ONNX.exportCombiner(ONNXNode input, T weight) Exports this voting combiner to ONNXcom.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenanceThe type witness used when deserializing the combiner from a protobuf.inthashCode()org.tribuo.protos.core.EnsembleCombinerProtoSerializes this object to a protobuf.toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.oracle.labs.mlrg.olcut.config.Configurable
postConfig
-
Field Details
-
CURRENT_VERSION
public static final int CURRENT_VERSIONProtobuf serialization version.- See Also:
-
-
Constructor Details
-
MultiLabelVotingCombiner
public MultiLabelVotingCombiner()Constructs a voting combiner.
-
-
Method Details
-
deserializeFromProto
public static MultiLabelVotingCombiner deserializeFromProto(int version, String className, com.google.protobuf.Any message) Deserialization factory.- Parameters:
version- The serialized object version.className- The class name.message- The serialized data.- Returns:
- The deserialized object.
-
serialize
public org.tribuo.protos.core.EnsembleCombinerProto serialize()Description copied from interface:ProtoSerializableSerializes this object to a protobuf.- Specified by:
serializein interfaceProtoSerializable<org.tribuo.protos.core.EnsembleCombinerProto>- Returns:
- The protobuf.
-
combine
public Prediction<MultiLabel> combine(ImmutableOutputInfo<MultiLabel> outputInfo, List<Prediction<MultiLabel>> predictions) Description copied from interface:EnsembleCombinerCombine the predictions.- Specified by:
combinein interfaceEnsembleCombiner<MultiLabel>- Parameters:
outputInfo- The output domain.predictions- The predictions to combine.- Returns:
- The ensemble prediction.
-
combine
public Prediction<MultiLabel> combine(ImmutableOutputInfo<MultiLabel> outputInfo, List<Prediction<MultiLabel>> predictions, float[] weights) Description copied from interface:EnsembleCombinerCombine the supplied predictions. predictions.size() must equal weights.length.- Specified by:
combinein interfaceEnsembleCombiner<MultiLabel>- Parameters:
outputInfo- The output domain.predictions- The predictions to combine.weights- The weights to use for each prediction.- Returns:
- The ensemble prediction.
-
toString
-
getProvenance
public com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance getProvenance()- Specified by:
getProvenancein interfacecom.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>
-
getTypeWitness
Description copied from interface:EnsembleCombinerThe type witness used when deserializing the combiner from a protobuf.The default implementation throws
UnsupportedOperationExceptionfor compatibility with implementations which don't use protobuf serialization. This implementation will be removed in the next major version of Tribuo.- Specified by:
getTypeWitnessin interfaceEnsembleCombiner<MultiLabel>- Returns:
- The output class this object produces.
-
exportCombiner
Exports this voting combiner to ONNX.The input should be a 3-tensor [batch_size, num_outputs, num_ensemble_members].
- Specified by:
exportCombinerin interfaceEnsembleCombiner<MultiLabel>- Parameters:
input- The input tensor to combine.- Returns:
- the final node proto representing the voting operation.
-
exportCombiner
Exports this voting combiner to ONNXThe input should be a 3-tensor [batch_size, num_outputs, num_ensemble_members].
- Specified by:
exportCombinerin interfaceEnsembleCombiner<MultiLabel>- Type Parameters:
T- The type of the weights input reference.- Parameters:
input- The input tensor to combine.weight- The combination weight node.- Returns:
- the final node proto representing the voting operation.
-
equals
-
hashCode
-