import { ActivationFn } from "../methods/activation" import { Connection } from "./connection" import * as neataptic from "neataptic" export const allNodeTypes = ["input", "hidden", "output"] as const export type NodeType = typeof allNodeTypes[number] export interface Node { bias: number squash: ActivationFn type: NodeType activation: number state: number old: number activate: (input: number|undefined) => number propagate: (rate: number, momentum: number, update: boolean, target: number) => number connect: (node: Node, weight: number) => Connection[] disconnect: (node: Node, twosided: boolean) => void gate: (connections: Connection[]) => void ungate: (connections: Connection[]) => void isProjectingTo: (node: Node) => boolean isProjectedBy: (node: Node) => boolean toJSON: () => object clear: () => void } export type NodeVal = { bias?: number squash?: ActivationFn type?: NodeType activation?: number state?: number old?: number } export function create(type: NodeType = "hidden"): Node { return new neataptic.Node(type) } export const classConstructor: (type: NodeType) => void = neataptic.Node