Class MutableFeatureMap
java.lang.Object
org.tribuo.FeatureMap
org.tribuo.MutableFeatureMap
- All Implemented Interfaces:
- Serializable,- Iterable<VariableInfo>,- ProtoSerializable<org.tribuo.protos.core.FeatureDomainProto>
A feature map that can record new feature value observations.
- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intProtobuf serialization version.Fields inherited from class org.tribuo.FeatureMapmFields inherited from interface org.tribuo.protos.ProtoSerializableDESERIALIZATION_METHOD_NAME, PROVENANCE_SERIALIZER
- 
Constructor SummaryConstructorsConstructorDescriptionCreates an empty feature map which converts high cardinality categorical variable infos into reals.MutableFeatureMap(boolean convertHighCardinality) Creates an empty feature map which can optionally convert high cardinality categorical variable infos into reals.
- 
Method SummaryModifier and TypeMethodDescriptionvoidAdds an occurrence of a feature with a given name.voidclear()Clears all the feature observations.static MutableFeatureMapdeserializeFromProto(int version, String className, com.google.protobuf.Any message) Deserialization factory.booleaninthashCode()put(VariableInfo info) Adds a variable info into the feature map.org.tribuo.protos.core.FeatureDomainProtoSerializes this object to a protobuf.Methods inherited from class org.tribuo.FeatureMapdeserialize, domainEquals, get, iterator, keySet, size, toReadableString, toStringMethods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.IterableforEach, spliterator
- 
Field Details- 
CURRENT_VERSIONpublic static final int CURRENT_VERSIONProtobuf serialization version.- See Also:
 
 
- 
- 
Constructor Details- 
MutableFeatureMappublic MutableFeatureMap()Creates an empty feature map which converts high cardinality categorical variable infos into reals.The conversion threshold is CategoricalInfo.THRESHOLD.
- 
MutableFeatureMappublic MutableFeatureMap(boolean convertHighCardinality) Creates an empty feature map which can optionally convert high cardinality categorical variable infos into reals.The conversion threshold is CategoricalInfo.THRESHOLD.- Parameters:
- convertHighCardinality- Should this feature map convert high cardinality categorical variables into real variables?
 
 
- 
- 
Method Details- 
deserializeFromProtopublic static MutableFeatureMap 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 the- message.
 
- 
serializepublic org.tribuo.protos.core.FeatureDomainProto serialize()Description copied from interface:ProtoSerializableSerializes this object to a protobuf.- Returns:
- The protobuf.
 
- 
putAdds a variable info into the feature map.Returns the old one if there was a name collision, otherwise returns null. - Parameters:
- info- The info to add.
- Returns:
- The old variable info or null.
 
- 
addAdds an occurrence of a feature with a given name.- Parameters:
- name- the name of the feature.
- value- the observed value of that feature.
 
- 
clearpublic void clear()Clears all the feature observations.
- 
equals- Overrides:
- equalsin class- FeatureMap
 
- 
hashCodepublic int hashCode()- Overrides:
- hashCodein class- FeatureMap
 
 
-