UNPKG

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) 654 B
var ErrorFunction = require('../errorFunction'); /** * The standard linear error function, simply returns the difference * between the actual and ideal. */ class LinearError extends ErrorFunction { /** * @inheritDoc */ calculateError(activationFunction, before, after, ideal, actual, error, derivShift, significance = 1.0) { let deriv; for (let i = 0; i < actual.length; i++) { deriv = activationFunction.derivativeFunction(before[i], after[i]); error[i] = ((ideal[i] - actual[i]) * significance) * deriv; } } } module.exports = LinearError;