This release is 136 versions behind 0.168.1 — 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/assert"; import { type DataRecordInterface, makeDataDir, } from "../src/architecture/DataSet.ts"; import { trainDir } from "../src/architecture/Training.ts"; import type { TrainOptions } from "../src/config/TrainOptions.ts"; import type { Creature } from "../src/Creature.ts"; /** * Train the given set to this network */ export function train( creature: Creature, dataSet: DataRecordInterface[], options: TrainOptions, ) { assert(dataSet.length > 0, "No data set provided"); assert(dataSet[0].input.length > 0, "No input data in the data set"); assert(dataSet[0].output.length > 0, "No output data in the data set"); const dataSetDir = makeDataDir(dataSet, dataSet.length); try { const result = trainDir(creature, dataSetDir, options); return result; } finally { Deno.removeSync(dataSetDir, { recursive: true }); } }