Package org.tribuo
Class FeatureMap
java.lang.Object
org.tribuo.FeatureMap
- All Implemented Interfaces:
Serializable
,Iterable<VariableInfo>
- Direct Known Subclasses:
ImmutableFeatureMap
,MutableFeatureMap
A map from Strings to
VariableInfo
objects storing
information about a feature.- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected final Map<String,
VariableInfo> Map from the feature names to their info. -
Constructor Summary
ModifierConstructorDescriptionprotected
Constructs an empty feature map.protected
FeatureMap
(Map<String, ? extends VariableInfo> m) Constructs a feature map wrapping the supplied map.protected
FeatureMap
(FeatureMap map) Constructs a deep copy of the supplied feature map. -
Method Summary
Modifier and TypeMethodDescriptionboolean
domainEquals
(FeatureMap other) Check if this feature map contains the same features as the supplied one.Gets the variable info associated with that feature name, or null if it's unknown.iterator()
keySet()
Returns all the feature names in the domain.int
size()
Returns the number of features in the domain.Same as the toString, but ordered by name, and with newlines.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
m
Map from the feature names to their info.
-
-
Constructor Details
-
FeatureMap
protected FeatureMap()Constructs an empty feature map. -
FeatureMap
Constructs a deep copy of the supplied feature map.- Parameters:
map
- The map to copy.
-
FeatureMap
Constructs a feature map wrapping the supplied map.Note the map is not defensively copied.
- Parameters:
m
- The map to wrap.
-
-
Method Details
-
get
Gets the variable info associated with that feature name, or null if it's unknown.- Parameters:
name
- The feature name.- Returns:
- The variable info or null.
-
size
public int size()Returns the number of features in the domain.- Returns:
- The number of features.
-
toString
-
keySet
Returns all the feature names in the domain.- Returns:
- The feature names.
-
iterator
- Specified by:
iterator
in interfaceIterable<VariableInfo>
-
toReadableString
Same as the toString, but ordered by name, and with newlines.- Returns:
- A String representation of this FeatureMap.
-
domainEquals
Check if this feature map contains the same features as the supplied one.- Parameters:
other
- The feature map to check.- Returns:
- True if the two feature maps contain the same named features.
-