# selection

Genetic Algorithm Selection Methods (Genetic Operator)

Source:
See:

### Example

``````let { architect, methods } = require("@liquid-carrot/carrot");

let myNetwork = new architect.Perceptron(1,1,1);
let myTrainingSet = [{ input:[0], output:[1]}, { input:[1], output:[0]}];

myNetwork.evolve(myTrainingSet, {
generations: 10,
selection: methods.selection.POWER // eg.
});``````

### Members

#### (static, constant) FITNESS_PROPORTIONATE :object

• object
##### Example
``````let { architect, methods } = require("@liquid-carrot/carrot");

let myNetwork = new architect.Perceptron(1,1,1);
let myTrainingSet = [{ input:[0], output:[1]}, { input:[1], output:[0]}];

myNetwork.evolve(myTrainingSet, {
generations: 10,
selection: methods.selection.FITNESS_PROPORTIONATE // eg.
});``````
Source:
Default Value:
• ``````{
"name": "FITNESS_PROPORTIONATE"
}``````

#### (static, constant) POWER :object

A random decimal value between 0 and 1 will be generated (e.g. 0.5) then this value will get an exponential value (power, default is 4). So 0.5**4 = 0.0625. This is converted into an index for the array of the current population, sorted from fittest to worst.

• object
##### Example
``````let { architect, methods } = require("@liquid-carrot/carrot");

let myNetwork = new architect.Perceptron(1,1,1);
let myTrainingSet = [{ input:[0], output:[1]}, { input:[1], output:[0]}];

myNetwork.evolve(myTrainingSet, {
generations: 10,
selection: methods.selection.POWER // eg.
});``````
Source:
Default Value:
• ``````{
"name": "POWER",
"power": 4
}``````

#### (static, constant) TOURNAMENT :object

• object
##### Example
``````let { architect, methods } = require("@liquid-carrot/carrot");

let myNetwork = new architect.Perceptron(1,1,1);
let myTrainingSet = [{ input:[0], output:[1]}, { input:[1], output:[0]}];

myNetwork.evolve(myTrainingSet, {
generations: 10,
selection: methods.selection.TOURNAMENT // eg.
});``````
Source:
Default Value:
• ``````{
"name": "TOURNAMENT",
"size": 5,
"probability": 0.5
}``````