A simulation of knowledge transfer through generations
- To use please run the either of the following code on terminal:
$ npm start
$ node index.js
-
Data are categorized separately under /data folder. A knowledge object is defined under each data category which is intended to allow multiple knowledge that represents multiple persons.
-
Population creation using specified number. Selection of data for the population is randomized which allows a chance to select a data that has similar knowledge.
-
Implemented version of TF-IDF based on understanding, for checking similarity of strings.
-
Devised an implementation of Genetic Algorithm concepts.
- Defined learn() function that acts as a mutation function, it uses the learningRate property as a mutation rate.
- Defined crossover() function that creates 3 offsprings, 2 of them are based on the parents average and crossover chance to acquire their parents knowledge, and 3rd one is a wildcard that used combined result of the first 2 offspring. A default parent is set to the best possible candidate and a default crossoverChance of 0.5 is defined which triggers whether a random or the second best candidate is selected as a partner parent.
- Defined credibility property which acts as a fitness value. Credibility is computed using computeCredibility() function which then uses that implementation of the TF-IDF approach to check whether a member of the population has a knowledge regarding the target specified on index.js. Each knowledge contained by the person is resized accordingly to fit the size TF-IDF matrix of the target which is the subtracted after to get the error distance, which is then summed up and averaged before applying the adjustment to the credibility.
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Eagan Martin
Copyright © 2019, Eagan Martin. Release under the MIT License