gov.sandia.cognition.text.evaluation
Class DefaultPrecisionRecallPair

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.text.evaluation.DefaultPrecisionRecallPair
All Implemented Interfaces:
PrecisionRecallPair, CloneableSerializable, Pair<Double,Double>, Serializable, Cloneable

@PublicationReference(author="Wikipedia",
                      title="Precision and Recall",
                      type=WebPage,
                      url="http://en.wikipedia.org/wiki/Precision_and_recall",
                      year=2009)
public class DefaultPrecisionRecallPair
extends AbstractCloneableSerializable
implements PrecisionRecallPair

A default implementation of the PrecisionRecallPair interface.

Since:
3.0
Author:
Justin Basilico
See Also:
Serialized Form

Field Summary
static double DEFAULT_PRECISION
          The default precision is 0.0.
static double DEFAULT_RECALL
          The default recall is 0.0.
 
Constructor Summary
DefaultPrecisionRecallPair()
          Creates a new DefaultPrecisionRecallPair.
DefaultPrecisionRecallPair(double precision, double recall)
          Creates a new DefaultPrecisionRecallPair.
 
Method Summary
 Double getFirst()
          Gets the first element, which is the precision.
 double getPrecision()
          Gets the precision.
 double getRecall()
          Gets the recall.
 Double getSecond()
          Gets the second element, which is the recall.
 void setPrecision(double precision)
          Sets the precision.
 void setRecall(double recall)
          Sets the recall.
 String toString()
           
 
Methods inherited from class gov.sandia.cognition.util.AbstractCloneableSerializable
clone
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_PRECISION

public static final double DEFAULT_PRECISION
The default precision is 0.0.

See Also:
Constant Field Values

DEFAULT_RECALL

public static final double DEFAULT_RECALL
The default recall is 0.0.

See Also:
Constant Field Values
Constructor Detail

DefaultPrecisionRecallPair

public DefaultPrecisionRecallPair()
Creates a new DefaultPrecisionRecallPair.


DefaultPrecisionRecallPair

public DefaultPrecisionRecallPair(double precision,
                                  double recall)
Creates a new DefaultPrecisionRecallPair.

Parameters:
precision - The precision. Must be between 0.0 and 1.0, inclusive.
recall - The recall. Must be between 0.0 and 1.0, inclusive.
Method Detail

getPrecision

public double getPrecision()
Description copied from interface: PrecisionRecallPair
Gets the precision. It is a value between 0.0 and 1.0, inclusive. It is equal to: tp / (tp + fp).

Specified by:
getPrecision in interface PrecisionRecallPair
Returns:
The precision.

setPrecision

public void setPrecision(double precision)
Sets the precision. Must be between 0.0 and 1.0, inclusive.

Parameters:
precision - The precision.

getRecall

public double getRecall()
Description copied from interface: PrecisionRecallPair
Gets the recall. It is a value between 0.0 and 1.0, inclusive. It is equal to: tp / (tp + fn).

Specified by:
getRecall in interface PrecisionRecallPair
Returns:
The recall.

setRecall

public void setRecall(double recall)
Sets the recall. Must be between 0.0 and 1.0, inclusive.

Parameters:
recall - The recall.

getFirst

public Double getFirst()
Gets the first element, which is the precision.

Specified by:
getFirst in interface Pair<Double,Double>
Returns:
The precision.

getSecond

public Double getSecond()
Gets the second element, which is the recall.

Specified by:
getSecond in interface Pair<Double,Double>
Returns:
The recall.

toString

public String toString()
Overrides:
toString in class Object