cost

Cost functions play an important role in neural networks. They give neural networks an indication of 'how wrong' they are; a.k.a. how far they are from the desired outputs. Also in fitness functions, cost functions play an important role.

Source:
See:

Methods

(static) BINARY (targets, outputs) → {number} open an issue

Binary Error

Parameters:
Name Type Description
targets Array.<number> | number

Ideal value

outputs Array.<number> | number

Actual values

Returns:

misses The amount of times targets value was missed

Example
      Copy
      let { methods, Network } = require("@liquid-carrot/carrot");

let myNetwork = new Network(5, 10, 5);
myNetwork.train(trainingData, {
  log: 1,
  iterations: 500,
  error: 0.03,
  rate: 0.05,
  cost: methods.cost.BINARY
});
    
Source:
See:

(static) CROSS_ENTROPY (targets, outputs) → {number} open an issue

Cross entropy error

Parameters:
Name Type Description
targets Array.<number> | number

Ideal value

outputs Array.<number> | number

Actual values

Returns:
Example
      Copy
      let { methods, Network } = require("@liquid-carrot/carrot");

let myNetwork = new Network(5, 10, 5);
myNetwork.train(trainingData, { cost: methods.cost.CROSS_ENTROPY });
    
Source:
See:

(static) HINGE (targets, outputs) → {number} open an issue

Hinge loss, for classifiers

Parameters:
Name Type Description
targets Array.<number> | number

Ideal value

outputs Array.<number> | number

Actual values

Returns:
Example
      Copy
      let { methods, Network } = require("@liquid-carrot/carrot");

let myNetwork = new Network(5, 10, 5);
myNetwork.train(trainingData, {
  log: 1,
  iterations: 500,
  error: 0.03,
  rate: 0.05,
  cost: methods.cost.HINGE
});
    
Source:

(static) MAE (targets, outputs) → {number} open an issue

Mean Absolute Error

Parameters:
Name Type Description
targets Array.<number> | number

Ideal value

outputs Array.<number> | number

Actual values

Returns:
Example
      Copy
      let { methods, Network } = require("@liquid-carrot/carrot");

let myNetwork = new Network(5, 10, 5);
myNetwork.train(trainingData, {
  log: 1,
  iterations: 500,
  error: 0.03,
  rate: 0.05,
  cost: methods.cost.MAE
});
    
Source:

(static) MAPE (targets, outputs) → {number} open an issue

Mean Absolute Percentage Error

Parameters:
Name Type Description
targets Array.<number> | number

Ideal value

outputs Array.<number> | number

Actual values

Returns:
Example
      Copy
      let { methods, Network } = require("@liquid-carrot/carrot");

let myNetwork = new Network(5, 10, 5);
myNetwork.train(trainingData, {
  log: 1,
  iterations: 500,
  error: 0.03,
  rate: 0.05,
  cost: methods.cost.MAPE
});
    
Source:

(static) MSE (targets, outputs) → {number} open an issue

Mean Squared Error

Parameters:
Name Type Description
targets Array.<number> | number

Ideal value

outputs Array.<number> | number

Actual values

Returns:
Example
      Copy
      let { methods, Network } = require("@liquid-carrot/carrot");

let myNetwork = new Network(5, 10, 5);
myNetwork.train(trainingData, { cost: methods.cost.MSE });
    
Source:

(static) MSLE (targets, outputs) → {number} open an issue

Mean Squared Logarithmic Error

Parameters:
Name Type Description
targets Array.<number> | number

Ideal value

outputs Array.<number> | number

Actual values

Returns:
Example
      Copy
      let { methods, Network } = require("@liquid-carrot/carrot");

let myNetwork = new Network(5, 10, 5);
myNetwork.train(trainingData, {
  log: 1,
  iterations: 500,
  error: 0.03,
  rate: 0.05,
  cost: methods.cost.MSLE
});
    
Source:

(static) WAPE (targets, outputs) → {number} open an issue

Weighted Absolute Percentage Error (WAPE)

Parameters:
Name Type Description
targets Array.<number> | number

Ideal value

outputs Array.<number> | number

Actual values

Returns:
Example
      Copy
      let { methods, Network } = require("@liquid-carrot/carrot");

let myNetwork = new Network(5, 10, 5);
myNetwork.train(trainingData, {
  cost: methods.cost.WAPE
});
    
Source: