Package ciir.umass.edu.learning
Class DataPoint
- java.lang.Object
-
- ciir.umass.edu.learning.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).
-
-
Field Summary
Fields Modifier and Type Field Description protected doublecachedprotected java.lang.Stringdescriptionstatic intFEATURE_INCREASEprotected float[]fValsprotected java.lang.Stringidprotected intknownFeaturesprotected floatlabelstatic intMAX_FEATUREstatic booleanmissingZeroprotected static floatUNKNOWN
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description doublegetCached()java.lang.StringgetDescription()abstract floatgetFeatureValue(int fid)Get the value of the feature with the given feature IDabstract float[]getFeatureVector()Gets the value of all features as a dense array of feature values.java.lang.StringgetID()protected static java.lang.StringgetKey(java.lang.String pair)floatgetLabel()intgetNumberOfKnownFeatures()protected static java.lang.StringgetValue(java.lang.String pair)protected static booleanisUnknown(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.voidresetCached()voidsetCached(double c)voidsetDescription(java.lang.String description)abstract voidsetFeatureValue(int fid, float fval)Set the value of the feature with the given feature IDabstract voidsetFeatureVector(float[] dfVals)Sets the value of all features with the provided dense array of feature valuesvoidsetID(java.lang.String id)voidsetLabel(float label)java.lang.StringtoString()
-
-
-
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
-
-
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:
toStringin classjava.lang.Object
-
getNumberOfKnownFeatures
public int getNumberOfKnownFeatures()
-
-