Skip to main content
Home
This release is 136 versions behind 0.168.1 — the latest version of @stsoftware/neat-ai. Jump to latest

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.

This package works with Deno
This package works with Deno
JSR Score
94%
Published
5 months ago (0.121.0)
Package root>test>TrainTestOnlyUtil.ts
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 }); } }