Class DataPoint

  • Direct Known Subclasses:
    DenseDataPoint, SparseDataPoint

    public abstract class DataPoint
    extends java.lang.Object
    Author:
    vdang This class implements objects to be ranked. In the context of Information retrieval, each instance is a query-url pair represented by a n-dimentional feature vector. It should be general enough for other ranking applications as well (not limited to just IR I hope).
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected DataPoint()
      Default constructor.
      protected DataPoint​(java.lang.String text)
      The input must have the form:
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      double getCached()  
      java.lang.String getDescription()  
      abstract float getFeatureValue​(int fid)
      Get the value of the feature with the given feature ID
      abstract float[] getFeatureVector()
      Gets the value of all features as a dense array of feature values.
      java.lang.String getID()  
      protected static java.lang.String getKey​(java.lang.String pair)  
      float getLabel()  
      int getNumberOfKnownFeatures()  
      protected static java.lang.String getValue​(java.lang.String pair)  
      protected static boolean isUnknown​(float fVal)  
      protected float[] parse​(java.lang.String text)
      Parse the given line of text to construct a dense array of feature values and reset metadata.
      void resetCached()  
      void setCached​(double c)  
      void setDescription​(java.lang.String description)  
      abstract void setFeatureValue​(int fid, float fval)
      Set the value of the feature with the given feature ID
      abstract void setFeatureVector​(float[] dfVals)
      Sets the value of all features with the provided dense array of feature values
      void setID​(java.lang.String id)  
      void setLabel​(float label)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • missingZero

        public static boolean missingZero
      • MAX_FEATURE

        public static int MAX_FEATURE
      • FEATURE_INCREASE

        public static int FEATURE_INCREASE
      • UNKNOWN

        protected static float UNKNOWN
      • label

        protected float label
      • id

        protected java.lang.String id
      • description

        protected java.lang.String description
      • fVals

        protected float[] fVals
      • knownFeatures

        protected int knownFeatures
      • cached

        protected double cached
    • Constructor Detail

      • DataPoint

        protected DataPoint()
        Default constructor. No-op.
      • DataPoint

        protected DataPoint​(java.lang.String text)
        The input must have the form:
        Parameters:
        text -
    • Method Detail

      • isUnknown

        protected static boolean isUnknown​(float fVal)
      • getKey

        protected static java.lang.String getKey​(java.lang.String pair)
      • getValue

        protected static java.lang.String getValue​(java.lang.String pair)
      • parse

        protected float[] parse​(java.lang.String text)
        Parse the given line of text to construct a dense array of feature values and reset metadata.
        Parameters:
        text -
        Returns:
        Dense array of feature values
      • getFeatureValue

        public abstract float getFeatureValue​(int fid)
        Get the value of the feature with the given feature ID
        Parameters:
        fid -
        Returns:
      • setFeatureValue

        public abstract void setFeatureValue​(int fid,
                                             float fval)
        Set the value of the feature with the given feature ID
        Parameters:
        fid -
        fval -
      • setFeatureVector

        public abstract void setFeatureVector​(float[] dfVals)
        Sets the value of all features with the provided dense array of feature values
      • getFeatureVector

        public abstract float[] getFeatureVector()
        Gets the value of all features as a dense array of feature values.
      • getID

        public java.lang.String getID()
      • setID

        public void setID​(java.lang.String id)
      • getLabel

        public float getLabel()
      • setLabel

        public void setLabel​(float label)
      • getDescription

        public java.lang.String getDescription()
      • setDescription

        public void setDescription​(java.lang.String description)
      • setCached

        public void setCached​(double c)
      • getCached

        public double getCached()
      • resetCached

        public void resetCached()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getNumberOfKnownFeatures

        public int getNumberOfKnownFeatures()