Package org.tribuo
Class CategoricalIDInfo
java.lang.Object
org.tribuo.SkeletalVariableInfo
org.tribuo.CategoricalInfo
org.tribuo.CategoricalIDInfo
- All Implemented Interfaces:
Serializable
,Cloneable
,ProtoSerializable<org.tribuo.protos.core.VariableInfoProto>
,VariableIDInfo
,VariableInfo
Same as a
CategoricalInfo
, but with an additional int id field.- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Protobuf serialization version.Fields inherited from class org.tribuo.CategoricalInfo
cdf, observedCount, observedValue, THRESHOLD, totalObservations, valueCounts, values
Fields inherited from class org.tribuo.SkeletalVariableInfo
count, name
Fields inherited from interface org.tribuo.protos.ProtoSerializable
DESERIALIZATION_METHOD_NAME, PROVENANCE_SERIALIZER
-
Constructor Summary
ConstructorDescriptionCategoricalIDInfo
(CategoricalInfo info, int id) Constructs a categorical id info copying the information from the supplied info, with the specified id. -
Method Summary
Modifier and TypeMethodDescriptioncopy()
Returns a copy of this variable info.static CategoricalIDInfo
deserializeFromProto
(int version, String className, com.google.protobuf.Any message) Deserialization factory.boolean
Generates aRealIDInfo
that matches this CategoricalInfo and also contains an id number.int
getID()
The id number associated with this variable.int
hashCode()
makeIDInfo
(int id) Generates a VariableIDInfo subclass which represents the same feature.Rename generates a fresh VariableInfo with the new name.toString()
Methods inherited from class org.tribuo.CategoricalInfo
frequencyBasedSample, frequencyBasedSample, getObservationCount, getUniqueObservations, getValues, observe, serialize, uniformSample
Methods inherited from class org.tribuo.SkeletalVariableInfo
getCount, getName
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.tribuo.protos.ProtoSerializable
serialize
Methods inherited from interface org.tribuo.VariableInfo
getCount, getName, uniformSample
-
Field Details
-
CURRENT_VERSION
public static final int CURRENT_VERSIONProtobuf serialization version.- See Also:
-
-
Constructor Details
-
CategoricalIDInfo
Constructs a categorical id info copying the information from the supplied info, with the specified id.- Parameters:
info
- The info to copy.id
- The id number to use.
-
-
Method Details
-
deserializeFromProto
public static CategoricalIDInfo 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
.
-
getID
public int getID()Description copied from interface:VariableIDInfo
The id number associated with this variable.Ids are non-negative integers.
- Specified by:
getID
in interfaceVariableIDInfo
- Returns:
- The id number.
-
generateRealInfo
Generates aRealIDInfo
that matches this CategoricalInfo and also contains an id number.- Overrides:
generateRealInfo
in classCategoricalInfo
- Returns:
- A RealInfo representing the data in this CategoricalInfo.
-
copy
Description copied from interface:VariableInfo
Returns a copy of this variable info.- Specified by:
copy
in interfaceVariableInfo
- Overrides:
copy
in classCategoricalInfo
- Returns:
- A copy.
-
makeIDInfo
Description copied from interface:VariableInfo
Generates a VariableIDInfo subclass which represents the same feature.- Specified by:
makeIDInfo
in interfaceVariableInfo
- Overrides:
makeIDInfo
in classCategoricalInfo
- Parameters:
id
- The id number.- Returns:
- A VariableInfo with the same information, plus the id.
-
rename
Description copied from interface:VariableInfo
Rename generates a fresh VariableInfo with the new name. The name forms part of the hashcode so it's immutable in the object.- Specified by:
rename
in interfaceVariableInfo
- Overrides:
rename
in classCategoricalInfo
- Parameters:
newName
- The new name.- Returns:
- A VariableInfo subclass with the new name.
-
toString
- Overrides:
toString
in classCategoricalInfo
-
equals
- Overrides:
equals
in classCategoricalInfo
-
hashCode
public int hashCode()- Overrides:
hashCode
in classCategoricalInfo
-