Package org.tribuo
Class SelectedFeatureSet
java.lang.Object
org.tribuo.SelectedFeatureSet
- All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.provenance.Provenancable<FeatureSetProvenance>
,Serializable
,ProtoSerializable<org.tribuo.protos.core.FeatureSetProto>
public final class SelectedFeatureSet
extends Object
implements ProtoSerializable<org.tribuo.protos.core.FeatureSetProto>, com.oracle.labs.mlrg.olcut.provenance.Provenancable<FeatureSetProvenance>, Serializable
A record-like class for a selected feature set.
Uses record style accessors as it may be refactored into a record one day.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Protobuf serialization version.Fields inherited from interface org.tribuo.protos.ProtoSerializable
DESERIALIZATION_METHOD_NAME, PROVENANCE_SERIALIZER
-
Constructor Summary
ConstructorDescriptionSelectedFeatureSet
(List<String> featureNames, List<Double> featureScores, boolean isOrdered, FeatureSetProvenance provenance) Create a selected feature set. -
Method Summary
Modifier and TypeMethodDescriptionstatic SelectedFeatureSet
deserializeFromProto
(int version, String className, com.google.protobuf.Any message) Deserialization factory.boolean
Checks if thisSelectedFeatureSet
is equal to the supplied object.The selected feature names in a possibly ordered list.The selected feature scores in a possibly ordered list.int
hashCode()
Computes the hash code.boolean
Is this feature set ordered?The provenance of the feature set.org.tribuo.protos.core.FeatureSetProto
Serializes this object to a protobuf.toString()
-
Field Details
-
CURRENT_VERSION
public static final int CURRENT_VERSIONProtobuf serialization version.- See Also:
-
-
Constructor Details
-
SelectedFeatureSet
public SelectedFeatureSet(List<String> featureNames, List<Double> featureScores, boolean isOrdered, FeatureSetProvenance provenance) Create a selected feature set.- Parameters:
featureNames
- The feature names.featureScores
- The feature scores.isOrdered
- Is this feature set ordered?provenance
- The provenance of the feature selection.
-
-
Method Details
-
deserializeFromProto
public static SelectedFeatureSet deserializeFromProto(int version, String className, com.google.protobuf.Any message) throws com.google.protobuf.InvalidProtocolBufferException Deserialization factory.- Parameters:
version
- The serialized object version.className
- The class name.message
- The serialized data.- Returns:
- The deserialized object.
- Throws:
com.google.protobuf.InvalidProtocolBufferException
- If the protobuf could not be parsed from themessage
.
-
featureNames
The selected feature names in a possibly ordered list.- Returns:
- The selected feature names.
-
featureScores
The selected feature scores in a possibly ordered list.If the algorithm did not produce scores then these values are all
Double.NaN
.- Returns:
- The selected feature scores.
-
provenance
The provenance of the feature set.- Returns:
- The feature set provenance.
-
getProvenance
- Specified by:
getProvenance
in interfacecom.oracle.labs.mlrg.olcut.provenance.Provenancable<FeatureSetProvenance>
-
isOrdered
public boolean isOrdered()Is this feature set ordered?- Returns:
- True if the set is ordered.
-
serialize
public org.tribuo.protos.core.FeatureSetProto serialize()Description copied from interface:ProtoSerializable
Serializes this object to a protobuf.- Specified by:
serialize
in interfaceProtoSerializable<org.tribuo.protos.core.FeatureSetProto>
- Returns:
- The protobuf.
-
equals
Checks if thisSelectedFeatureSet
is equal to the supplied object.Equals is defined as containing the same features, in the same order, with the same scores, and with the same provenance information. As that provenance includes machine information and timestamps, this means equals is defined as did this object derive from the same computation as the supplied object.
-
hashCode
public int hashCode()Computes the hash code.The hash code depends on the provenance object, and is not just a function of the feature names and scores, to be consistent with the definition of equals.
-
toString
-