de.fu_berlin.ties.eval
Class Accuracy

java.lang.Object
  extended byde.fu_berlin.ties.io.BaseStorable
      extended byde.fu_berlin.ties.eval.Accuracy
All Implemented Interfaces:
Storable

public class Accuracy
extends BaseStorable

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

Instances of this class are not thread-safe.

Version:
$Revision: 1.1 $, $Date: 2004/02/25 17:56:54 $, $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.
Accuracy(FieldMap fieldMap)
          Creates a new instance from a field map, fulfilling the Storable contract.
 
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. An equivalent object can be created by calling FieldMap.createObject(Class) on the created field map.
 
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.


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
Method Detail

getAccuracy

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

Returns:
the accuracy

getFalseCount

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

Returns:
the number of false decisions

getTrueCount

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

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.

Returns:
the created field map


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