encog
Version:
Encog is a NodeJs ES6 framework based on the Encog Machine Learning Framework by Jeff Heaton, plus some the of basic data manipulation helpers.
22 lines (20 loc) • 648 B
JavaScript
const ErrorFunction = require('../errorFunction');
/**
* Implements a cross entropy error function. This can be used with backpropagation to
* sometimes provide better performance than the standard linear error function.
* @author jheaton
*
*/
class CrossEntropyError extends ErrorFunction {
/**
* @inheritDoc
*/
calculateError(activationFunction, before, after,
ideal, actual, error, derivShift,
significance = 1.0) {
for (let i = 0; i < actual.length; i++) {
error[i] = (ideal[i] - actual[i]) * significance;
}
}
}
module.exports = CrossEntropyError;