This release is 125 versions behind 0.165.7 — the latest version of @stsoftware/neat-ai. Jump to latest
@stsoftware/neat-ai@0.121.0Built and signed on GitHub ActionsBuilt and signed on GitHub Actions
Built and signed on GitHub Actions
NEAT Neural Network. This project is a unique implementation of a neural network based on the NEAT (NeuroEvolution of Augmenting Topologies) algorithm, written in DenoJS using TypeScript.
import { assert } from "jsr:@std/assert@^1.0.8"; import { Creature } from "../src/Creature.ts"; ((globalThis as unknown) as { DEBUG: boolean }).DEBUG = true; Deno.test("hidden", () => { const json = JSON.parse(Deno.readTextFileSync("./test/data/inFocus.json")); const network = Creature.fromJSON(json); let positiveCount = 0; let negativeCount = 0; const startPos = network.input; const endPos = network.neurons.length - network.output; for (let pos = startPos; pos < endPos; pos++) { const n = network.neurons[pos]; if (network.inFocus(n.index ? n.index : 0, [1])) { positiveCount++; } else { negativeCount++; } } assert(positiveCount > 0, "No positives"); assert(negativeCount > 0, "No negatives"); }); Deno.test("input", () => { const json = JSON.parse(Deno.readTextFileSync("./test/data/inFocus.json")); const network = Creature.fromJSON(json); let positiveCount = 0; let negativeCount = 0; const startPos = 0; const endPos = network.input; for (let pos = startPos; pos < endPos; pos++) { const n = network.neurons[pos]; if (network.inFocus(n.index ? n.index : 0, [1])) { positiveCount++; } else { negativeCount++; } } assert(positiveCount > 0, "No positives"); assert(negativeCount > 0, "No negatives"); });