com.penguinwerks.jodene
Class ErrorManager

java.lang.Object
  extended bycom.penguinwerks.jodene.ErrorManager

public class ErrorManager
extends java.lang.Object

The error manager allows you to configure error calculators and maintains a history of errors. During training the current errors are available as the error report. After training all error reports, in order, are moved to the history.

Author:
Paul Hoehne

Constructor Summary
ErrorManager()
          Creates a new instance of ErrorManager
 
Method Summary
 void accumulateError(java.util.Map expected, java.util.Map actual)
          Calculates the error using the available error calculators.
 void addCalculator(java.lang.String name, ErrorCalculator calculator)
          Adds a new calculator with the given name to the error manager.
 void clearErrors()
          Clears the error report, moving it to the error History.
 ErrorCalculator getCalculator(java.lang.String name)
          Returns an error calculator with a given name.
 double getError(java.lang.String name)
          Returns the error for a given error calculator.
 int getErrorHistorySize()
          Returns the size of the error history.
 java.util.List getHistoricalErrors(java.lang.String name)
          Returns the error history for a given error calculator.
 double getLastError(java.lang.String name)
          Returns the last error value for a given calculator.
 java.util.Map getLastErrors()
          Returns the last error report in history.
 java.util.Map getReport()
          Returns the error report, which contains the errors, organized by name.
 int getSize()
          Returns the number of error calculators configured.
 java.util.List listCalculators()
          Returns the list of calculator names.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ErrorManager

public ErrorManager()
Creates a new instance of ErrorManager

Method Detail

getSize

public int getSize()
Returns the number of error calculators configured.

Returns:
The number of error calculators.

addCalculator

public void addCalculator(java.lang.String name,
                          ErrorCalculator calculator)
Adds a new calculator with the given name to the error manager.

Parameters:
calculator - The error calculator.
name - The name of the error calculator.

accumulateError

public void accumulateError(java.util.Map expected,
                            java.util.Map actual)
Calculates the error using the available error calculators. The results are saved into the error report property.

Parameters:
expected - The expected values from the example.
actual - The actual values obtained by evaluating the network.

getError

public double getError(java.lang.String name)
Returns the error for a given error calculator. This takes the error from the error report. When training is complete this will always report 0, because the error report has been moved to the error history.

Parameters:
name - The name of the error calculator.
Returns:
The error value.

clearErrors

public void clearErrors()
Clears the error report, moving it to the error History.


getReport

public java.util.Map getReport()
Returns the error report, which contains the errors, organized by name. This is moved to the error history at the end of each epoch during training.

Returns:
The current error report.

getErrorHistorySize

public int getErrorHistorySize()
Returns the size of the error history. This may be a specious function, however, the error history may change to a sized window of k error reports, instead of all the error reports.

Returns:
The number of history elements.

getHistoricalErrors

public java.util.List getHistoricalErrors(java.lang.String name)
Returns the error history for a given error calculator.

Parameters:
name - The name of the error calculator.
Returns:
The history of errors for the given calculator.

getLastErrors

public java.util.Map getLastErrors()
Returns the last error report in history. During training this is different from the current error report. After training there is no current report, just history.

Returns:
The last error report in the error history.

getLastError

public double getLastError(java.lang.String name)
Returns the last error value for a given calculator. During training the current error value is in the error report, and the latest history is in the last history record. After training there is only history.

Parameters:
name - The name of the error calculator.
Returns:
The error value.

listCalculators

public java.util.List listCalculators()
Returns the list of calculator names. These are all the calculators that have been registered with this error manager.

Returns:
The list of calculator names.

getCalculator

public ErrorCalculator getCalculator(java.lang.String name)
Returns an error calculator with a given name.

Parameters:
name - The name of the error calculator.
Returns:
The error calculator.