de.fu_berlin.ties.eval
Class Accuracy

java.lang.Object
  extended by de.fu_berlin.ties.io.BaseStorable
      extended by de.fu_berlin.ties.eval.Accuracy
All Implemented Interfaces:
AccuracyView, Storable

public class Accuracy
extends BaseStorable
implements AccuracyView

Counts true and false items and measures the accuracy: A = true / (true + false).

Instances of this class are not thread-safe.

Version:
$Revision: 1.2 $, $Date: 2004/05/18 13:46:10 $, $Author: siefkes $
Author:
Christian Siefkes

Field Summary
static String KEY_ACCURACY
          Serialization key for the accuracy.
static String KEY_FALSE_COUNT
          Serialization key for the number of false items.
static String KEY_TRUE_COUNT
          Serialization key for the number of true items.
 
Constructor Summary
Accuracy()
          Creates a new empty instance, without using a prefix.
Accuracy(FieldMap fieldMap)
          Creates a new instance from a field map, fulfilling the Storable contract.
Accuracy(FieldMap fieldMap, String prefixString)
          Creates a new instance from a field map, using a prefix.
Accuracy(String prefixString)
          Creates a new empty instance.
 
Method Summary
 double getAccuracy()
          Calculates and returns the accuracy: A = true / (true + false).
 long getFalseCount()
          Returns the number of false decisions.
 long getTrueCount()
          Returns the number of true decisions.
 void incFalseCount()
          Increases the number of false decisions by one.
 void incTrueCount()
          Increases the number of true decisions by one.
 FieldMap storeFields()
          Stores all relevant fields of this object in a field map for serialization.
 
Methods inherited from class de.fu_berlin.ties.io.BaseStorable
toString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

KEY_ACCURACY

public static final String KEY_ACCURACY
Serialization key for the accuracy.

See Also:
Constant Field Values

KEY_FALSE_COUNT

public static final String KEY_FALSE_COUNT
Serialization key for the number of false items.

See Also:
Constant Field Values

KEY_TRUE_COUNT

public static final String KEY_TRUE_COUNT
Serialization key for the number of true items.

See Also:
Constant Field Values
Constructor Detail

Accuracy

public Accuracy()
Creates a new empty instance, without using a prefix.


Accuracy

public Accuracy(String prefixString)
Creates a new empty instance.

Parameters:
prefixString - An optional prefix used for (de)serializing this instance; should typically end in a space; empty string if not used

Accuracy

public Accuracy(FieldMap fieldMap)
         throws IllegalArgumentException
Creates a new instance from a field map, fulfilling the Storable contract.

Parameters:
fieldMap - map containing the serialized fields
Throws:
IllegalArgumentException - if at least one of the parameters is negative or missing

Accuracy

public Accuracy(FieldMap fieldMap,
                String prefixString)
         throws IllegalArgumentException
Creates a new instance from a field map, using a prefix.

Parameters:
fieldMap - map containing the serialized fields
prefixString - An optional prefix used for (de)serializing this instance; should typically end in a space; empty string if not used
Throws:
IllegalArgumentException - if at least one of the parameters is negative or missing
Method Detail

getAccuracy

public double getAccuracy()
Calculates and returns the accuracy: A = true / (true + false).

Specified by:
getAccuracy in interface AccuracyView
Returns:
the accuracy

getFalseCount

public long getFalseCount()
Returns the number of false decisions.

Specified by:
getFalseCount in interface AccuracyView
Returns:
the number of false decisions

getTrueCount

public long getTrueCount()
Returns the number of true decisions.

Specified by:
getTrueCount in interface AccuracyView
Returns:
the number of true decisions

incFalseCount

public void incFalseCount()
Increases the number of false decisions by one.


incTrueCount

public void incTrueCount()
Increases the number of true decisions by one.


storeFields

public FieldMap storeFields()
Stores all relevant fields of this object in a field map for serialization. An equivalent object can be created by calling FieldMap.createObject(Class) on the created field map.

Specified by:
storeFields in interface Storable
Returns:
the created field map


Copyright © 2003-2004 Christian Siefkes. All Rights Reserved.