Skip to content

Commit

Permalink
Add missing neat functions to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
christianechevarria committed Jun 14, 2019
1 parent 20d143a commit e213b4a
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/neat.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ let Neat = function(inputs, outputs, dataset, options) {
/**
* Creates a new population
*
* @memberof Neat
*
* @param {Network} network - Template network used to create population - _other networks will be "identical twins"_
* @param {number} size - Number of network in created population - _how many identical twins created in new population_
*
Expand Down Expand Up @@ -188,6 +190,8 @@ let Neat = function(inputs, outputs, dataset, options) {
/**
* Selects a random mutation method for a genome according to the parameters
*
* @memberof Neat
*
* @param genome
*/
self.selectMutationMethod = function (genome, allowedMutations, efficientMutation) {
Expand Down Expand Up @@ -341,6 +345,8 @@ let Neat = function(inputs, outputs, dataset, options) {
*
* Should be called after `evaluate()`
*
* @memberof Neat
*
* @return {Network} Selected genome for offspring generation
*/
self.getParent = function () {
Expand Down Expand Up @@ -406,6 +412,8 @@ let Neat = function(inputs, outputs, dataset, options) {
/**
* Selects two genomes from the population with `getParent()`, and returns the offspring from those parents. NOTE: Population MUST be sorted
*
* @memberof Neat
*
* @returns {Network} Child network
*/
self.getOffspring = function () {
Expand All @@ -417,6 +425,8 @@ let Neat = function(inputs, outputs, dataset, options) {

/**
* Mutates the given (or current) population
*
* @memberof Neat
*/
self.mutate = function () {
// Elitist genomes should not be included
Expand All @@ -433,6 +443,8 @@ let Neat = function(inputs, outputs, dataset, options) {
/**
* Evaluates the current population, basically sets their `.score` property
*
* @memberof Neat
*
* @return {Network} Fittest Network
*/
self.evaluate = async function (dataset) {
Expand Down Expand Up @@ -469,6 +481,8 @@ let Neat = function(inputs, outputs, dataset, options) {
/**
* Returns the fittest genome of the current population
*
* @memberof Neat
*
* @returns {Network} Current population's fittest genome
*/
self.getFittest = function () {
Expand All @@ -484,6 +498,8 @@ let Neat = function(inputs, outputs, dataset, options) {
/**
* Returns the average fitness of the current population
*
* @memberof Neat
*
* @returns {number} Average fitness of the current population
*/
self.getAverage = function () {
Expand All @@ -502,6 +518,8 @@ let Neat = function(inputs, outputs, dataset, options) {
*
* Can be used later with `fromJSON(json)` to reload the population
*
* @memberof Neat
*
* @return {object[]} A set of genomes (a population) represented as JSON objects.
*/
self.toJSON = function exportPopulation() {
Expand All @@ -515,6 +533,8 @@ let Neat = function(inputs, outputs, dataset, options) {
/**
* Imports population from a json. Must be an array of networks converted to JSON objects.
*
* @memberof Neat
*
* @param {object[]} json set of genomes (a population) represented as JSON objects.
*/
self.fromJSON = function importPopulation(json) {
Expand Down

0 comments on commit e213b4a

Please sign in to comment.