Package org.tribuo

Class CategoricalIDInfo

All Implemented Interfaces:
Serializable, Cloneable, ProtoSerializable<org.tribuo.protos.core.VariableInfoProto>, VariableIDInfo, VariableInfo

public class CategoricalIDInfo extends CategoricalInfo implements VariableIDInfo
Same as a CategoricalInfo, but with an additional int id field.
See Also:
  • Field Details

    • CURRENT_VERSION

      public static final int CURRENT_VERSION
      Protobuf serialization version.
      See Also:
  • Constructor Details

    • CategoricalIDInfo

      public CategoricalIDInfo(CategoricalInfo info, int id)
      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 the message.
    • 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 interface VariableIDInfo
      Returns:
      The id number.
    • generateRealInfo

      public RealIDInfo generateRealInfo()
      Generates a RealIDInfo that matches this CategoricalInfo and also contains an id number.
      Overrides:
      generateRealInfo in class CategoricalInfo
      Returns:
      A RealInfo representing the data in this CategoricalInfo.
    • copy

      public CategoricalIDInfo copy()
      Description copied from interface: VariableInfo
      Returns a copy of this variable info.
      Specified by:
      copy in interface VariableInfo
      Overrides:
      copy in class CategoricalInfo
      Returns:
      A copy.
    • makeIDInfo

      public CategoricalIDInfo makeIDInfo(int id)
      Description copied from interface: VariableInfo
      Generates a VariableIDInfo subclass which represents the same feature.
      Specified by:
      makeIDInfo in interface VariableInfo
      Overrides:
      makeIDInfo in class CategoricalInfo
      Parameters:
      id - The id number.
      Returns:
      A VariableInfo with the same information, plus the id.
    • rename

      public CategoricalIDInfo rename(String newName)
      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 interface VariableInfo
      Overrides:
      rename in class CategoricalInfo
      Parameters:
      newName - The new name.
      Returns:
      A VariableInfo subclass with the new name.
    • toString

      public String toString()
      Overrides:
      toString in class CategoricalInfo
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class CategoricalInfo
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class CategoricalInfo