NAME
errfunc.h - error functions for optimization routines
SYNOPSIS
Error functions currently in this module include the standard Quadratic, the logistic error function, and Huber's error function.
#include <errfunc.h>
double opt_err_quadratic(double output,
double target, double *derivative,
double *second_derivative);
double opt_err_logistic(double output,
double target, double *derivative,
double *second_derivative);
double opt_err_huber(double output,
double target, double *derivative,
double *second_derivative);
double opt_err_cross_entropy(double output,
double target, double *derivative,
double *second_derivative);
double opt_err_symmetric_cross_entropy(double output,
double target, double *derivative,
double *second_derivative);
DESCRIPTION
The eror functions declared in this module can be used with the optimization package. Each function takes four arguments: an actual output, a target value for the output, and two pointers to doubles where the first and second derivatives are computed and stored. The error value is returned.
Function Definitions
The following function prototypes are given in the header file errfunc.h.
double opt_err_quadratic(double output,
double target, double *derivative,
double *second_derivative);
The standard quadratic error function: 0.5 * (output - target)^2.
double opt_err_logistic(double output,
double target, double *derivative,
double *second_derivative);
This is the logistic error function from statistics, defined as ln(cosh(e)), where e is the difference between the actual and the desired outputs.
double opt_err_huber(double output,
double target, double *derivative,
double *second_derivative);
Huber's function is also from robust estimation. It is defined as e*e/2 for |e| <= 1 and |e| - 1/2 for |e| > 1, where e is the difference between the actual and the desired outputs.
double opt_err_cross_entropy(double output,
double target, double *derivative,
double *second_derivative);
Cross entropy error function which is useful for classification problems. This function expects target and output to be strictly binary.
double opt_err_symmetric_cross_entropy(double output,
double target, double *derivative,
double *second_derivative);
Same as cross entropy but renormalizes target and output with (x + 1) / 2, to make the function suitable for (-1, 1) outputs.
AUTHOR
Gary William Flake (gary.flake@usa.net).