From 4ff081a190ebd65797c211794d168587c0e740d8 Mon Sep 17 00:00:00 2001 From: Nigel Leck Date: Sun, 17 Mar 2024 15:10:46 +1100 Subject: [PATCH] added from to UUID in CRISPR (#315) Co-authored-by: Nigel (MacBook) --- src/Creature.ts | 30 ++-- src/architecture/CreatureUtils.ts | 2 +- src/architecture/ElitismUtils.ts | 2 +- src/architecture/FineTune.ts | 2 +- src/architecture/Neat.ts | 6 +- src/architecture/Neuron.ts | 2 +- src/architecture/Synapse.ts | 5 + src/architecture/SynapseInterfaces.ts | 3 + src/architecture/Training.ts | 6 +- src/compact/CompactUnused.ts | 2 +- src/reconstruct/CRISPR.ts | 202 +++++++++++++++++--------- test/ActivationNames.ts | 6 +- test/{ => CRISPR}/CRISPR.ts | 14 +- test/CRISPR/From.ts | 70 +++++++++ test/Clipped.ts | 2 +- test/Compact/Cascade.ts | 11 +- test/Compact/Compact.ts | 4 +- test/Compact/CompactConstant.ts | 4 +- test/Compact/CompactKeepOrder.ts | 4 +- test/Compact/FixIF.ts | 11 +- test/Compact/UnusedClipped.ts | 11 +- test/Constants/AddNeuron.ts | 4 +- test/Constants/Constant.ts | 2 +- test/Correct.ts | 2 +- test/Costs.ts | 2 +- test/Creature.ts | 4 +- test/CreatureStore.ts | 4 +- test/CreatureUUID.ts | 2 +- test/ELU.ts | 2 +- test/Elitism.ts | 2 +- test/Evolve.ts | 2 +- test/ExperimentStore.ts | 2 +- test/FineTune.ts | 2 +- test/FineTuneUUID.ts | 2 +- test/Fix.ts | 2 +- test/Hypot.ts | 2 +- test/IfElse.ts | 2 +- test/InConnections.ts | 2 +- test/InFocus.ts | 2 +- test/LeakyReLU.ts | 2 +- test/Maximum.ts | 2 +- test/Mean.ts | 2 +- test/Minimum.ts | 2 +- test/Mish.ts | 2 +- test/NeuronUUID.ts | 2 +- test/Offspring/Bread.ts | 2 +- test/Offspring/KeepOrder.ts | 2 +- test/Offspring/KeepSynapses.ts | 4 +- test/Offspring/SortNeurons.ts | 2 +- test/Projection.ts | 2 +- test/Propagate/AccumulateBias.ts | 5 +- test/Propagate/AccumulateWeight.ts | 2 +- test/Propagate/Complex.ts | 4 +- test/Propagate/Constants.ts | 4 +- test/Propagate/Generation.ts | 2 +- test/Propagate/IF.ts | 4 +- test/Propagate/Identity.ts | 13 +- test/Propagate/Inverse.ts | 4 +- test/Propagate/LimitBias.ts | 2 +- test/Propagate/LimitWeight.ts | 8 +- test/Propagate/Maximum.ts | 4 +- test/Propagate/MaximumSimple.ts | 4 +- test/Propagate/Mean.ts | 4 +- test/Propagate/Minimum.ts | 4 +- test/Propagate/MultiLevel.ts | 4 +- test/Propagate/NoChangeWhenCorrect.ts | 11 +- test/Propagate/PI.ts | 4 +- test/Propagate/SingleNeuron.ts | 6 +- test/Propagate/ToValue.ts | 2 +- test/Propagate/Trace.ts | 2 +- test/Ratios.ts | 2 +- test/Score.ts | 2 +- test/Softplus.ts | 2 +- test/Swish.ts | 2 +- test/TagCreature.ts | 2 +- test/TagNeuron.ts | 2 +- test/TraceAggregate.ts | 2 +- test/TraceNeuron.ts | 4 +- test/TraceStore.ts | 4 +- test/Train.ts | 4 +- test/Worker.ts | 2 +- test/addNeuron.ts | 4 +- test/data/CRISPR/DNA-from-to.json | 8 + test/ifPropagation.ts | 4 +- test/makeActivation.ts | 2 +- test/toJSON.ts | 2 +- test/unSquash.ts | 21 ++- 87 files changed, 392 insertions(+), 235 deletions(-) rename test/{ => CRISPR}/CRISPR.ts (96%) create mode 100644 test/CRISPR/From.ts create mode 100644 test/data/CRISPR/DNA-from-to.json diff --git a/src/Creature.ts b/src/Creature.ts index 1a7693c9..cca54fe0 100644 --- a/src/Creature.ts +++ b/src/Creature.ts @@ -1,6 +1,6 @@ -import { yellow } from "https://deno.land/std@0.219.1/fmt/colors.ts"; -import { format } from "https://deno.land/std@0.219.1/fmt/duration.ts"; -import { emptyDirSync } from "https://deno.land/std@0.219.1/fs/empty_dir.ts"; +import { yellow } from "https://deno.land/std@0.220.1/fmt/colors.ts"; +import { format } from "https://deno.land/std@0.220.1/fmt/duration.ts"; +import { emptyDirSync } from "https://deno.land/std@0.220.1/fs/empty_dir.ts"; import { addTag, getTag, @@ -287,7 +287,7 @@ export class Creature implements CreatureInternal { pos < compactCreature.neurons.length - compactCreature.output; pos++ ) { - const fromList = compactCreature.efferentConnections(pos).filter( + const fromList = compactCreature.outwardConnections(pos).filter( (c: SynapseInternal) => { return c.from !== c.to; }, @@ -303,7 +303,7 @@ export class Creature implements CreatureInternal { }, ); if (toList.length == 1) { - const fromList = compactCreature.efferentConnections(pos).filter( + const fromList = compactCreature.outwardConnections(pos).filter( (c: SynapseInternal) => { return c.from !== c.to; }, @@ -552,7 +552,7 @@ export class Creature implements CreatureInternal { `Node ${node.ID()} '${node.type}' has squash: ${node.squash}`, ); } - const fromList = this.efferentConnections(indx); + const fromList = this.outwardConnections(indx); if (fromList.length == 0) { if (this.DEBUG) { this.DEBUG = false; @@ -581,7 +581,7 @@ export class Creature implements CreatureInternal { "NO_INWARD_CONNECTIONS", ); } - const fromList = this.efferentConnections(indx); + const fromList = this.outwardConnections(indx); if (fromList.length == 0) { if (this.DEBUG) { this.DEBUG = false; @@ -756,7 +756,7 @@ export class Creature implements CreatureInternal { * @param fromIndx the connections from this neuron by index * @returns the list of connections from the neuron. */ - efferentConnections(fromIndx: number): Synapse[] { + outwardConnections(fromIndx: number): Synapse[] { let results = this.cacheFrom.get(fromIndx); if (results === undefined) { results = []; @@ -1527,7 +1527,7 @@ export class Creature implements CreatureInternal { /** Each neuron must have at least one from/to connection */ if ( ( - this.efferentConnections(conn.from).length > 1 || + this.outwardConnections(conn.from).length > 1 || this.neurons[conn.from].type === "input" ) && this.inwardConnections(conn.to).length > 1 ) { @@ -1705,7 +1705,7 @@ export class Creature implements CreatureInternal { if (this.inFocus(from, focusList)) { if ( ( - this.efferentConnections(from).length > 1 || + this.outwardConnections(from).length > 1 || this.neurons[from].type === "input" ) && this.inwardConnections(to).length > 1 ) { @@ -1907,7 +1907,7 @@ export class Creature implements CreatureInternal { ) { if (this.neurons[pos].type == "output") continue; if ( - this.efferentConnections(pos).filter((c) => { + this.outwardConnections(pos).filter((c) => { return c.from !== c.to; }).length == 0 ) { @@ -1966,7 +1966,7 @@ export class Creature implements CreatureInternal { } for (let i = this.synapses.length; i--;) { - const exportJSON = (this.synapses[i] as Synapse).exportJSON( + const exportJSON = this.synapses[i].exportJSON( uuidMap, ); @@ -2037,7 +2037,7 @@ export class Creature implements CreatureInternal { } for (let i = this.synapses.length; i--;) { - const internalJSON = (this.synapses[i] as Synapse).internalJSON(); + const internalJSON = this.synapses[i].internalJSON(); json.synapses[i] = internalJSON; } @@ -2124,6 +2124,10 @@ export class Creature implements CreatureInternal { synapse.type, ); + if (synapse.tags) { + connection.tags = synapse.tags.slice(); + } + if ((synapse as SynapseTrace).trace) { const cs = this.state.connection(connection.from, connection.to); const trace = (synapse as SynapseTrace).trace; diff --git a/src/architecture/CreatureUtils.ts b/src/architecture/CreatureUtils.ts index 9c63e98b..21fee3db 100644 --- a/src/architecture/CreatureUtils.ts +++ b/src/architecture/CreatureUtils.ts @@ -1,4 +1,4 @@ -import { generate as generateV5 } from "https://deno.land/std@0.219.1/uuid/v5.ts"; +import { generate as generateV5 } from "https://deno.land/std@0.220.1/uuid/v5.ts"; import { Creature } from "../Creature.ts"; export class CreatureUtil { diff --git a/src/architecture/ElitismUtils.ts b/src/architecture/ElitismUtils.ts index 545abe8c..316dd79c 100644 --- a/src/architecture/ElitismUtils.ts +++ b/src/architecture/ElitismUtils.ts @@ -5,7 +5,7 @@ import { red, white, yellow, -} from "https://deno.land/std@0.219.1/fmt/colors.ts"; +} from "https://deno.land/std@0.220.1/fmt/colors.ts"; import { getTag } from "https://deno.land/x/tags@v1.0.2/mod.ts"; import { Creature } from "../Creature.ts"; diff --git a/src/architecture/FineTune.ts b/src/architecture/FineTune.ts index ebf0766a..035c8eda 100644 --- a/src/architecture/FineTune.ts +++ b/src/architecture/FineTune.ts @@ -1,4 +1,4 @@ -import { blue, bold, cyan } from "https://deno.land/std@0.219.1/fmt/colors.ts"; +import { blue, bold, cyan } from "https://deno.land/std@0.220.1/fmt/colors.ts"; import { addTag, getTag } from "https://deno.land/x/tags@v1.0.2/mod.ts"; import { Creature } from "../Creature.ts"; import { CreatureUtil } from "./CreatureUtils.ts"; diff --git a/src/architecture/Neat.ts b/src/architecture/Neat.ts index 4fede5fa..351cd116 100644 --- a/src/architecture/Neat.ts +++ b/src/architecture/Neat.ts @@ -1,6 +1,6 @@ -import { blue } from "https://deno.land/std@0.219.1/fmt/colors.ts"; -import { format } from "https://deno.land/std@0.219.1/fmt/duration.ts"; -import { ensureDirSync } from "https://deno.land/std@0.219.1/fs/ensure_dir.ts"; +import { blue } from "https://deno.land/std@0.220.1/fmt/colors.ts"; +import { format } from "https://deno.land/std@0.220.1/fmt/duration.ts"; +import { ensureDirSync } from "https://deno.land/std@0.220.1/fs/ensure_dir.ts"; import { addTag, getTag, diff --git a/src/architecture/Neuron.ts b/src/architecture/Neuron.ts index c0092555..a950eeaf 100644 --- a/src/architecture/Neuron.ts +++ b/src/architecture/Neuron.ts @@ -124,7 +124,7 @@ export class Neuron implements TagsInterface, NeuronInternal { } if (this.type == "hidden") { - const fromList = this.creature.efferentConnections(this.index); + const fromList = this.creature.outwardConnections(this.index); if (fromList.length == 0) { const targetIndx = Math.min( 1, diff --git a/src/architecture/Synapse.ts b/src/architecture/Synapse.ts index 4e55eb07..176c8923 100644 --- a/src/architecture/Synapse.ts +++ b/src/architecture/Synapse.ts @@ -1,3 +1,4 @@ +import { TagInterface } from "https://deno.land/x/tags@v1.0.2/mod.ts"; import { SynapseExport, SynapseInternal } from "./SynapseInterfaces.ts"; export class Synapse implements SynapseInternal { @@ -6,6 +7,8 @@ export class Synapse implements SynapseInternal { public type?: "positive" | "negative" | "condition"; public weight: number; + public tags?: TagInterface[]; + public static randomWeight() { return Math.random() * 0.2 - 0.1; } @@ -33,6 +36,7 @@ export class Synapse implements SynapseInternal { fromUUID: fromUUID, toUUID: toUUID, type: this.type, + tags: this.tags ? this.tags.slice() : undefined, }; return json; @@ -44,6 +48,7 @@ export class Synapse implements SynapseInternal { from: this.from, to: this.to, type: this.type, + tags: this.tags ? this.tags.slice() : undefined, }; return json; diff --git a/src/architecture/SynapseInterfaces.ts b/src/architecture/SynapseInterfaces.ts index c036c455..54b9187a 100644 --- a/src/architecture/SynapseInterfaces.ts +++ b/src/architecture/SynapseInterfaces.ts @@ -1,8 +1,11 @@ +import { TagInterface } from "https://deno.land/x/tags@v1.0.2/mod.ts"; import { SynapseState } from "./CreatureState.ts"; interface SynapseCommon { weight: number; type?: "positive" | "negative" | "condition"; + + tags?: TagInterface[]; } export interface SynapseInternal extends SynapseCommon { diff --git a/src/architecture/Training.ts b/src/architecture/Training.ts index 51e7d591..004114aa 100644 --- a/src/architecture/Training.ts +++ b/src/architecture/Training.ts @@ -1,6 +1,6 @@ -import { blue, yellow } from "https://deno.land/std@0.219.1/fmt/colors.ts"; -import { format } from "https://deno.land/std@0.219.1/fmt/duration.ts"; -import { ensureDirSync } from "https://deno.land/std@0.219.1/fs/ensure_dir.ts"; +import { blue, yellow } from "https://deno.land/std@0.220.1/fmt/colors.ts"; +import { format } from "https://deno.land/std@0.220.1/fmt/duration.ts"; +import { ensureDirSync } from "https://deno.land/std@0.220.1/fs/ensure_dir.ts"; import { Costs } from "../Costs.ts"; import { Creature } from "../Creature.ts"; import { TrainOptions } from "../config/TrainOptions.ts"; diff --git a/src/compact/CompactUnused.ts b/src/compact/CompactUnused.ts index 7c210f64..8f34c282 100644 --- a/src/compact/CompactUnused.ts +++ b/src/compact/CompactUnused.ts @@ -63,7 +63,7 @@ function removeNeuron(uuid: string, creature: Creature, activation: number) { const neuron = creature.neurons.find((n) => n.uuid === uuid); if (neuron?.index) { let useConstant = false; - const fromList = creature.efferentConnections(neuron.index); + const fromList = creature.outwardConnections(neuron.index); for (const synapse of fromList) { const squash = creature.neurons[synapse.to].findSquash(); diff --git a/src/reconstruct/CRISPR.ts b/src/reconstruct/CRISPR.ts index 8e75fad3..b1009f20 100644 --- a/src/reconstruct/CRISPR.ts +++ b/src/reconstruct/CRISPR.ts @@ -8,9 +8,9 @@ import { Creature } from "../Creature.ts"; export interface CrisprInterface extends TagsInterface { id: string; - mode: "append"; + // mode: "append"; - nodes: { + neurons?: { uuid?: string; index: number; type: "output"; @@ -18,11 +18,13 @@ export interface CrisprInterface extends TagsInterface { bias: number; }[]; - connections: { + synapses: { from?: number; fromRelative?: number; + fromUUID?: string; to?: number; toRelative?: number; + toUUID?: string; weight: number; type?: "positive" | "negative" | "condition"; }[]; @@ -40,14 +42,29 @@ export class CRISPR { } apply(dna: CrisprInterface): Creature { - const tmpNetwork = Creature.fromJSON( - this.creature.internalJSON(), + /* Legacy */ + if ((dna as unknown as { nodes: { squash: string }[] }).nodes) { + (dna as unknown as { neurons: { squash: string }[] }).neurons = + (dna as unknown as { nodes: { squash: string }[] }).nodes; + } + + if ((dna as unknown as { connections: { weight: number }[] }).connections) { + (dna as unknown as { synapses: { weight: number }[] }).synapses = + (dna as unknown as { connections: { weight: number }[] }).connections; + } + + /* End Version 1 */ + + const tmpCreature = Creature.fromJSON( + this.creature.exportJSON(), ); - const UUIDs = new Set(); + const UUIDs = new Map(); let alreadyProcessed = false; - tmpNetwork.neurons.forEach((node) => { - UUIDs.add(node.uuid ? node.uuid : ""); + tmpCreature.neurons.forEach((node) => { + if (!node.uuid) throw new Error("missing uuid"); + + UUIDs.set(node.uuid, node.index); const id = getTag(node, "CRISPR"); if (id === dna.id) { @@ -55,79 +72,124 @@ export class CRISPR { } }); - if (alreadyProcessed) return tmpNetwork; + if (!alreadyProcessed) { + tmpCreature.synapses.forEach((synapse) => { + const id = getTag(synapse, "CRISPR"); - let firstDnaOutputIndex = -1; - dna.nodes.forEach((node) => { - if (node.type == "output") { - if (firstDnaOutputIndex == -1) { - firstDnaOutputIndex = node.index; + if (id === dna.id) { + alreadyProcessed = true; } - } - }); - let firstNetworkOutputIndex = -1; - tmpNetwork.neurons.forEach((node, indx) => { - if (node.type == "output") { - if (firstNetworkOutputIndex == -1) { - firstNetworkOutputIndex = indx; + }); + } + if (alreadyProcessed) return tmpCreature; + + if (dna.neurons) { + let firstDnaOutputIndex: number = -1; + dna.neurons.forEach((neuron) => { + if (neuron.type == "output") { + if (firstDnaOutputIndex == -1 && neuron.index !== undefined) { + firstDnaOutputIndex = neuron.index; + } } - ((node as unknown) as { type: string }).type = "hidden"; - if (node.uuid?.startsWith("output-")) { - node.uuid = crypto.randomUUID(); + }); + + let firstNetworkOutputIndex: number = -1; + tmpCreature.neurons.forEach((neuron, indx) => { + if (neuron.type == "output") { + if (firstNetworkOutputIndex == -1) { + firstNetworkOutputIndex = indx; + } + ((neuron as unknown) as { type: string }).type = "hidden"; + if (neuron.uuid?.startsWith("output-")) { + neuron.uuid = crypto.randomUUID(); + } } + }); + + const adjustIndx = firstNetworkOutputIndex - firstDnaOutputIndex + + dna.neurons.length; + + let outputIndx: number = 0; + dna.neurons.forEach((dnaNeuron) => { + let uuid: string; + if (dnaNeuron.type == "output") { + uuid = `output-${outputIndx}`; + outputIndx++; + } else { + uuid = dnaNeuron.uuid + ? UUIDs.has(dnaNeuron.uuid) ? crypto.randomUUID() : dnaNeuron.uuid + : crypto.randomUUID(); + + if (uuid.startsWith("output-")) { + uuid = crypto.randomUUID(); + } + } + const indx = dnaNeuron.index + adjustIndx; + + const networkNode = new Neuron( + uuid, + dnaNeuron.type, + dnaNeuron.bias, + tmpCreature, + dnaNeuron.squash, + ); + networkNode.index = indx; + + addTag(networkNode, "CRISPR", dna.id); + tmpCreature.neurons.push(networkNode); + if (dnaNeuron.type == "output") { + if (firstDnaOutputIndex == -1) { + firstDnaOutputIndex = indx; + } + } + }); + + dna.synapses.forEach((c) => { + const from = c.from !== undefined + ? c.from + : ((c.fromRelative ? c.fromRelative : 0) + adjustIndx); + if (from == undefined) throw new Error("invalid connection " + c); + const to = c.to !== undefined + ? c.to + : ((c.toRelative ? c.toRelative : 0) + adjustIndx); + if (to == undefined) throw new Error("invalid connection " + c); + + tmpCreature.connect(from, to, c.weight, c.type); + }); + } + + dna.synapses.forEach((c) => { + let toIndx: number = -1; + if (c.toUUID) { + const indx = UUIDs.get(c.toUUID); + if (indx === undefined) { + throw new Error("missing toUUID " + c.toUUID); + } + toIndx = indx; } - }); - const adjustIndx = firstNetworkOutputIndex - firstDnaOutputIndex + - dna.nodes.length; - - let outputIndx = 0; - dna.nodes.forEach((dnaNode) => { - let uuid: string; - if (dnaNode.type == "output") { - uuid = `output-${outputIndx}`; - outputIndx++; - } else { - uuid = dnaNode.uuid - ? UUIDs.has(dnaNode.uuid) ? crypto.randomUUID() : dnaNode.uuid - : crypto.randomUUID(); - - if (uuid.startsWith("output-")) { - uuid = crypto.randomUUID(); + let fromIndx: number = -1; + if (c.fromUUID) { + const indx = UUIDs.get(c.fromUUID); + if (indx === undefined) { + throw new Error("missing fromUUID " + c.fromUUID); } + fromIndx = indx; } - const indx = dnaNode.index + adjustIndx; - - const networkNode = new Neuron( - uuid, - dnaNode.type, - dnaNode.bias, - tmpNetwork, - dnaNode.squash, - ); - networkNode.index = indx; - - addTag(networkNode, "CRISPR", dna.id); - tmpNetwork.neurons.push(networkNode); - if (dnaNode.type == "output") { - if (firstDnaOutputIndex == -1) { - firstDnaOutputIndex = indx; + + if (fromIndx !== -1 && toIndx !== -1) { + if (!tmpCreature.getSynapse(fromIndx, toIndx)) { + const synapse = tmpCreature.connect( + fromIndx, + toIndx, + c.weight, + c.type, + ); + addTag(synapse, "CRISPR", dna.id); } } }); - dna.connections.forEach((c) => { - const from = c.from !== undefined - ? c.from - : ((c.fromRelative ? c.fromRelative : 0) + adjustIndx); - if (from == undefined) throw new Error("invalid connection " + c); - const to = c.to !== undefined - ? c.to - : ((c.toRelative ? c.toRelative : 0) + adjustIndx); - if (to == undefined) throw new Error("invalid connection " + c); - - tmpNetwork.connect(from, to, c.weight, c.type); - }); - return tmpNetwork; + return tmpCreature; } } diff --git a/test/ActivationNames.ts b/test/ActivationNames.ts index fb40a15a..1617c5b1 100644 --- a/test/ActivationNames.ts +++ b/test/ActivationNames.ts @@ -1,6 +1,8 @@ +import { + assert, + assertNotEquals, +} from "https://deno.land/std@0.220.1/assert/mod.ts"; import { Activations } from "../src/methods/activations/Activations.ts"; -import { assertNotEquals } from "https://deno.land/std@0.219.1/assert/assert_not_equals.ts"; -import { assert } from "https://deno.land/std@0.219.1/assert/assert.ts"; Deno.test("ActivationNames", () => { Activations.NAMES.forEach((name) => { diff --git a/test/CRISPR.ts b/test/CRISPR/CRISPR.ts similarity index 96% rename from test/CRISPR.ts rename to test/CRISPR/CRISPR.ts index 6c2db519..d9ef61e0 100644 --- a/test/CRISPR.ts +++ b/test/CRISPR/CRISPR.ts @@ -1,15 +1,13 @@ import { assert, assertEquals, -} from "https://deno.land/std@0.219.1/assert/mod.ts"; - -import { CRISPR } from "../src/reconstruct/CRISPR.ts"; -import { Creature } from "../src/Creature.ts"; +} from "https://deno.land/std@0.220.1/assert/mod.ts"; import { getTag } from "https://deno.land/x/tags@v1.0.2/mod.ts"; -import { Neuron } from "../src/architecture/Neuron.ts"; -import { Mutation } from "../src/methods/mutation.ts"; - -import { CreatureInternal } from "../src/architecture/CreatureInterfaces.ts"; +import { Creature } from "../../src/Creature.ts"; +import { CreatureInternal } from "../../src/architecture/CreatureInterfaces.ts"; +import { Neuron } from "../../src/architecture/Neuron.ts"; +import { Mutation } from "../../src/methods/mutation.ts"; +import { CRISPR } from "../../src/reconstruct/CRISPR.ts"; ((globalThis as unknown) as { DEBUG: boolean }).DEBUG = true; diff --git a/test/CRISPR/From.ts b/test/CRISPR/From.ts new file mode 100644 index 00000000..face5963 --- /dev/null +++ b/test/CRISPR/From.ts @@ -0,0 +1,70 @@ +import { + assert, + assertAlmostEquals, +} from "https://deno.land/std@0.220.1/assert/mod.ts"; +import { getTag } from "https://deno.land/x/tags@v1.0.2/src/TagsInterface.ts"; +import { Creature } from "../../src/Creature.ts"; +import { CRISPR } from "../../src/reconstruct/CRISPR.ts"; + +((globalThis as unknown) as { DEBUG: boolean }).DEBUG = true; + +Deno.test("FromUUID", () => { + const creature = Creature.fromJSON( + JSON.parse(Deno.readTextFileSync("test/data/CRISPR/network.json")), + ); + creature.validate(); + const crispr = new CRISPR(creature); + const creatureB = crispr.apply( + JSON.parse(Deno.readTextFileSync("test/data/CRISPR/DNA-from-to.json")), + ); + creatureB.validate(); + + const exported = creatureB.exportJSON(); + Deno.writeTextFileSync( + "test/data/CRISPR/.actual-from-to.json", + JSON.stringify(exported, null, 2), + ); + let foundFromToA = false; + let foundFromToB = false; + exported.synapses.forEach((synapse) => { + if (synapse.fromUUID == "input-299" && synapse.toUUID == "output-0") { + foundFromToA = true; + assertAlmostEquals(synapse.weight, 0.123); + } + if (synapse.fromUUID == "input-123" && synapse.toUUID == "output-0") { + foundFromToB = true; + assertAlmostEquals(synapse.weight, 0.456); + } + }); + + assert(foundFromToA, "should have found synapse A"); + assert(foundFromToB, "should have found synapse B"); + + const creatureC = Creature.fromJSON(exported); + + creatureC.validate(); + + let foundTag = false; + creatureC.synapses.forEach((synapse) => { + const tag = getTag(synapse, "CRISPR"); + if (tag == "from-to") { + foundTag = true; + } + }); + + assert(foundTag, "Should have found the ID tag"); + + const creatureD = Creature.fromJSON(creatureC.internalJSON()); + + creatureD.validate(); + + let foundTagD = false; + creatureD.synapses.forEach((synapse) => { + const tag = getTag(synapse, "CRISPR"); + if (tag == "from-to") { + foundTagD = true; + } + }); + + assert(foundTagD, "Should have found the ID tag"); +}); diff --git a/test/Clipped.ts b/test/Clipped.ts index 607a0898..8ad23f89 100644 --- a/test/Clipped.ts +++ b/test/Clipped.ts @@ -1,4 +1,4 @@ -import { assert } from "https://deno.land/std@0.219.1/assert/mod.ts"; +import { assert } from "https://deno.land/std@0.220.1/assert/mod.ts"; import { Creature } from "../src/Creature.ts"; import { CreatureInternal } from "../src/architecture/CreatureInterfaces.ts"; diff --git a/test/Compact/Cascade.ts b/test/Compact/Cascade.ts index ae4f4bb5..5b5707e7 100644 --- a/test/Compact/Cascade.ts +++ b/test/Compact/Cascade.ts @@ -1,8 +1,9 @@ -import { assertAlmostEquals } from "https://deno.land/std@0.219.1/assert/assert_almost_equals.ts"; -import { ensureDirSync } from "https://deno.land/std@0.219.1/fs/ensure_dir.ts"; -import { CreatureExport } from "../../mod.ts"; -import { Creature } from "../../src/Creature.ts"; -import { fail } from "https://deno.land/std@0.219.1/assert/fail.ts"; +import { + assertAlmostEquals, + fail, +} from "https://deno.land/std@0.220.1/assert/mod.ts"; +import { ensureDirSync } from "https://deno.land/std@0.220.1/fs/ensure_dir.ts"; +import { Creature, CreatureExport } from "../../mod.ts"; import { BackPropagationConfig } from "../../src/architecture/BackPropagation.ts"; import { compactUnused } from "../../src/compact/CompactUnused.ts"; diff --git a/test/Compact/Compact.ts b/test/Compact/Compact.ts index ff58540c..613ce3d1 100644 --- a/test/Compact/Compact.ts +++ b/test/Compact/Compact.ts @@ -2,8 +2,8 @@ import { assert, assertAlmostEquals, fail, -} from "https://deno.land/std@0.219.1/assert/mod.ts"; -import { ensureDirSync } from "https://deno.land/std@0.219.1/fs/ensure_dir.ts"; +} from "https://deno.land/std@0.220.1/assert/mod.ts"; +import { ensureDirSync } from "https://deno.land/std@0.220.1/fs/ensure_dir.ts"; import { Creature } from "../../src/Creature.ts"; import { CreatureInternal } from "../../src/architecture/CreatureInterfaces.ts"; diff --git a/test/Compact/CompactConstant.ts b/test/Compact/CompactConstant.ts index ecdac450..8fcc2474 100644 --- a/test/Compact/CompactConstant.ts +++ b/test/Compact/CompactConstant.ts @@ -1,8 +1,8 @@ import { assertAlmostEquals, fail, -} from "https://deno.land/std@0.219.1/assert/mod.ts"; -import { ensureDirSync } from "https://deno.land/std@0.219.1/fs/ensure_dir.ts"; +} from "https://deno.land/std@0.220.1/assert/mod.ts"; +import { ensureDirSync } from "https://deno.land/std@0.220.1/fs/ensure_dir.ts"; import { CreatureExport } from "../../mod.ts"; import { Creature } from "../../src/Creature.ts"; import { BackPropagationConfig } from "../../src/architecture/BackPropagation.ts"; diff --git a/test/Compact/CompactKeepOrder.ts b/test/Compact/CompactKeepOrder.ts index 1ca3541f..a8dd1c40 100644 --- a/test/Compact/CompactKeepOrder.ts +++ b/test/Compact/CompactKeepOrder.ts @@ -1,8 +1,8 @@ import { assertAlmostEquals, fail, -} from "https://deno.land/std@0.219.1/assert/mod.ts"; -import { ensureDirSync } from "https://deno.land/std@0.219.1/fs/ensure_dir.ts"; +} from "https://deno.land/std@0.220.1/assert/mod.ts"; +import { ensureDirSync } from "https://deno.land/std@0.220.1/fs/ensure_dir.ts"; import { CreatureExport } from "../../mod.ts"; import { Creature } from "../../src/Creature.ts"; import { BackPropagationConfig } from "../../src/architecture/BackPropagation.ts"; diff --git a/test/Compact/FixIF.ts b/test/Compact/FixIF.ts index 58607ef9..ef1337b1 100644 --- a/test/Compact/FixIF.ts +++ b/test/Compact/FixIF.ts @@ -1,8 +1,9 @@ -import { assertAlmostEquals } from "https://deno.land/std@0.219.1/assert/assert_almost_equals.ts"; -import { ensureDirSync } from "https://deno.land/std@0.219.1/fs/ensure_dir.ts"; -import { CreatureExport } from "../../mod.ts"; -import { Creature } from "../../src/Creature.ts"; -import { fail } from "https://deno.land/std@0.219.1/assert/fail.ts"; +import { + assertAlmostEquals, + fail, +} from "https://deno.land/std@0.220.1/assert/mod.ts"; +import { ensureDirSync } from "https://deno.land/std@0.220.1/fs/ensure_dir.ts"; +import { Creature, CreatureExport } from "../../mod.ts"; import { BackPropagationConfig } from "../../src/architecture/BackPropagation.ts"; import { compactUnused } from "../../src/compact/CompactUnused.ts"; diff --git a/test/Compact/UnusedClipped.ts b/test/Compact/UnusedClipped.ts index 22111733..0b2906ea 100644 --- a/test/Compact/UnusedClipped.ts +++ b/test/Compact/UnusedClipped.ts @@ -1,8 +1,9 @@ -import { assertAlmostEquals } from "https://deno.land/std@0.219.1/assert/assert_almost_equals.ts"; -import { ensureDirSync } from "https://deno.land/std@0.219.1/fs/ensure_dir.ts"; -import { CreatureExport } from "../../mod.ts"; -import { Creature } from "../../src/Creature.ts"; -import { fail } from "https://deno.land/std@0.219.1/assert/fail.ts"; +import { + assertAlmostEquals, + fail, +} from "https://deno.land/std@0.220.1/assert/mod.ts"; +import { ensureDirSync } from "https://deno.land/std@0.220.1/fs/ensure_dir.ts"; +import { Creature, CreatureExport } from "../../mod.ts"; import { BackPropagationConfig } from "../../src/architecture/BackPropagation.ts"; import { compactUnused } from "../../src/compact/CompactUnused.ts"; diff --git a/test/Constants/AddNeuron.ts b/test/Constants/AddNeuron.ts index 1351e7c4..e75282f8 100644 --- a/test/Constants/AddNeuron.ts +++ b/test/Constants/AddNeuron.ts @@ -1,7 +1,7 @@ -import { ensureDirSync } from "https://deno.land/std@0.219.1/fs/ensure_dir.ts"; +import { ensureDirSync } from "https://deno.land/std@0.220.1/fs/ensure_dir.ts"; import { CreatureExport } from "../../mod.ts"; import { Creature } from "../../src/Creature.ts"; -import { assertEquals } from "https://deno.land/std@0.219.1/assert/mod.ts"; +import { assertEquals } from "https://deno.land/std@0.220.1/assert/mod.ts"; function makeCreature() { const json: CreatureExport = { diff --git a/test/Constants/Constant.ts b/test/Constants/Constant.ts index 8e848c2c..ddc2f0dd 100644 --- a/test/Constants/Constant.ts +++ b/test/Constants/Constant.ts @@ -1,7 +1,7 @@ import { assert, assertAlmostEquals, -} from "https://deno.land/std@0.219.1/assert/mod.ts"; +} from "https://deno.land/std@0.220.1/assert/mod.ts"; import { Creature } from "../../src/Creature.ts"; import { CreatureInternal } from "../../src/architecture/CreatureInterfaces.ts"; diff --git a/test/Correct.ts b/test/Correct.ts index e23492e5..bb17c017 100644 --- a/test/Correct.ts +++ b/test/Correct.ts @@ -1,4 +1,4 @@ -import { assertAlmostEquals } from "https://deno.land/std@0.219.1/assert/mod.ts"; +import { assertAlmostEquals } from "https://deno.land/std@0.220.1/assert/mod.ts"; import { Creature } from "../src/Creature.ts"; import { CreatureInternal } from "../src/architecture/CreatureInterfaces.ts"; diff --git a/test/Costs.ts b/test/Costs.ts index df1ee531..1d29bb8a 100644 --- a/test/Costs.ts +++ b/test/Costs.ts @@ -1,4 +1,4 @@ -import { assertAlmostEquals } from "https://deno.land/std@0.219.1/assert/mod.ts"; +import { assertAlmostEquals } from "https://deno.land/std@0.220.1/assert/mod.ts"; import { Costs } from "../src/Costs.ts"; import { MSELimit } from "../src/costs/MSELimit.ts"; import { TwelveSteps } from "../src/costs/TwelveSteps.ts"; diff --git a/test/Creature.ts b/test/Creature.ts index a8e95459..d14aee32 100644 --- a/test/Creature.ts +++ b/test/Creature.ts @@ -3,8 +3,8 @@ import { assertAlmostEquals, assertEquals, assertNotEquals, -} from "https://deno.land/std@0.219.1/assert/mod.ts"; -import { ensureDirSync } from "https://deno.land/std@0.219.1/fs/ensure_dir.ts"; +} from "https://deno.land/std@0.220.1/assert/mod.ts"; +import { ensureDirSync } from "https://deno.land/std@0.220.1/fs/ensure_dir.ts"; import { addTag, getTag } from "https://deno.land/x/tags@v1.0.2/mod.ts"; import { Creature } from "../src/Creature.ts"; import { DataRecordInterface } from "../src/architecture/DataSet.ts"; diff --git a/test/CreatureStore.ts b/test/CreatureStore.ts index 6c1bfda1..7eca1d38 100644 --- a/test/CreatureStore.ts +++ b/test/CreatureStore.ts @@ -1,5 +1,5 @@ -import { assert } from "https://deno.land/std@0.219.1/assert/mod.ts"; -import { emptyDirSync } from "https://deno.land/std@0.219.1/fs/empty_dir.ts"; +import { assert } from "https://deno.land/std@0.220.1/assert/mod.ts"; +import { emptyDirSync } from "https://deno.land/std@0.220.1/fs/empty_dir.ts"; import { NeatOptions } from "../src/config/NeatOptions.ts"; import { Creature } from "../src/Creature.ts"; diff --git a/test/CreatureUUID.ts b/test/CreatureUUID.ts index 43d3b926..68dc087c 100644 --- a/test/CreatureUUID.ts +++ b/test/CreatureUUID.ts @@ -2,7 +2,7 @@ import { assert, assertEquals, assertNotEquals, -} from "https://deno.land/std@0.219.1/assert/mod.ts"; +} from "https://deno.land/std@0.220.1/assert/mod.ts"; import { Creature } from "../src/Creature.ts"; import { CreatureInternal } from "../src/architecture/CreatureInterfaces.ts"; import { CreatureUtil } from "../src/architecture/CreatureUtils.ts"; diff --git a/test/ELU.ts b/test/ELU.ts index 74691a71..fae630d0 100644 --- a/test/ELU.ts +++ b/test/ELU.ts @@ -1,4 +1,4 @@ -import { assert } from "https://deno.land/std@0.219.1/assert/mod.ts"; +import { assert } from "https://deno.land/std@0.220.1/assert/mod.ts"; import { Creature } from "../src/Creature.ts"; import { CreatureInternal } from "../src/architecture/CreatureInterfaces.ts"; diff --git a/test/Elitism.ts b/test/Elitism.ts index dd40ca19..892dc51b 100644 --- a/test/Elitism.ts +++ b/test/Elitism.ts @@ -1,4 +1,4 @@ -import { assert } from "https://deno.land/std@0.219.1/assert/mod.ts"; +import { assert } from "https://deno.land/std@0.220.1/assert/mod.ts"; import { Creature } from "../src/Creature.ts"; import { CreatureInternal } from "../src/architecture/CreatureInterfaces.ts"; import { makeElitists } from "../src/architecture/ElitismUtils.ts"; diff --git a/test/Evolve.ts b/test/Evolve.ts index b902b4cb..b50d785a 100644 --- a/test/Evolve.ts +++ b/test/Evolve.ts @@ -1,5 +1,5 @@ import { Creature } from "../src/Creature.ts"; -import { assert } from "https://deno.land/std@0.219.1/assert/mod.ts"; +import { assert } from "https://deno.land/std@0.220.1/assert/mod.ts"; import { Mutation } from "../src/methods/mutation.ts"; ((globalThis as unknown) as { DEBUG: boolean }).DEBUG = true; diff --git a/test/ExperimentStore.ts b/test/ExperimentStore.ts index 41dc2e56..39f0820f 100644 --- a/test/ExperimentStore.ts +++ b/test/ExperimentStore.ts @@ -1,4 +1,4 @@ -import { assert } from "https://deno.land/std@0.219.1/assert/mod.ts"; +import { assert } from "https://deno.land/std@0.220.1/assert/mod.ts"; import { addTag } from "https://deno.land/x/tags@v1.0.2/mod.ts"; import { Creature } from "../src/Creature.ts"; import { CreatureUtil } from "../src/architecture/CreatureUtils.ts"; diff --git a/test/FineTune.ts b/test/FineTune.ts index 65fb19a7..3983c89e 100644 --- a/test/FineTune.ts +++ b/test/FineTune.ts @@ -1,4 +1,4 @@ -import { assert } from "https://deno.land/std@0.219.1/assert/mod.ts"; +import { assert } from "https://deno.land/std@0.220.1/assert/mod.ts"; import { addTag } from "https://deno.land/x/tags@v1.0.2/mod.ts"; import { Creature } from "../src/Creature.ts"; import { fineTuneImprovement } from "../src/architecture/FineTune.ts"; diff --git a/test/FineTuneUUID.ts b/test/FineTuneUUID.ts index 69493882..dddd6196 100644 --- a/test/FineTuneUUID.ts +++ b/test/FineTuneUUID.ts @@ -2,7 +2,7 @@ import { assertAlmostEquals, assertEquals, fail, -} from "https://deno.land/std@0.219.1/assert/mod.ts"; +} from "https://deno.land/std@0.220.1/assert/mod.ts"; import { Creature } from "../src/Creature.ts"; import { fineTuneImprovement } from "../src/architecture/FineTune.ts"; diff --git a/test/Fix.ts b/test/Fix.ts index 0da567d4..b6f03aa1 100644 --- a/test/Fix.ts +++ b/test/Fix.ts @@ -1,4 +1,4 @@ -import { assertEquals } from "https://deno.land/std@0.219.1/assert/mod.ts"; +import { assertEquals } from "https://deno.land/std@0.220.1/assert/mod.ts"; import { Creature } from "../src/Creature.ts"; import { CreatureInternal } from "../src/architecture/CreatureInterfaces.ts"; diff --git a/test/Hypot.ts b/test/Hypot.ts index 6a2645f7..14fb570c 100644 --- a/test/Hypot.ts +++ b/test/Hypot.ts @@ -1,4 +1,4 @@ -import { assert } from "https://deno.land/std@0.219.1/assert/mod.ts"; +import { assert } from "https://deno.land/std@0.220.1/assert/mod.ts"; import { Creature } from "../src/Creature.ts"; import { CreatureInternal } from "../src/architecture/CreatureInterfaces.ts"; diff --git a/test/IfElse.ts b/test/IfElse.ts index bf33f915..2482404a 100644 --- a/test/IfElse.ts +++ b/test/IfElse.ts @@ -1,7 +1,7 @@ import { assert, assertAlmostEquals, -} from "https://deno.land/std@0.219.1/assert/mod.ts"; +} from "https://deno.land/std@0.220.1/assert/mod.ts"; import { Creature } from "../src/Creature.ts"; import { CreatureInternal } from "../src/architecture/CreatureInterfaces.ts"; diff --git a/test/InConnections.ts b/test/InConnections.ts index 9f0f7925..49be1400 100644 --- a/test/InConnections.ts +++ b/test/InConnections.ts @@ -1,4 +1,4 @@ -import { assert } from "https://deno.land/std@0.219.1/assert/mod.ts"; +import { assert } from "https://deno.land/std@0.220.1/assert/mod.ts"; import { Creature } from "../src/Creature.ts"; import { CreatureInternal } from "../src/architecture/CreatureInterfaces.ts"; diff --git a/test/InFocus.ts b/test/InFocus.ts index 959ba3b1..fb786eaa 100644 --- a/test/InFocus.ts +++ b/test/InFocus.ts @@ -1,4 +1,4 @@ -import { assert } from "https://deno.land/std@0.219.1/assert/mod.ts"; +import { assert } from "https://deno.land/std@0.220.1/assert/mod.ts"; import { Creature } from "../src/Creature.ts"; ((globalThis as unknown) as { DEBUG: boolean }).DEBUG = true; diff --git a/test/LeakyReLU.ts b/test/LeakyReLU.ts index ab608e31..4f7a932d 100644 --- a/test/LeakyReLU.ts +++ b/test/LeakyReLU.ts @@ -1,4 +1,4 @@ -import { assert } from "https://deno.land/std@0.219.1/assert/mod.ts"; +import { assert } from "https://deno.land/std@0.220.1/assert/mod.ts"; import { Creature } from "../src/Creature.ts"; import { CreatureInternal } from "../src/architecture/CreatureInterfaces.ts"; diff --git a/test/Maximum.ts b/test/Maximum.ts index ca1c78be..0b64782c 100644 --- a/test/Maximum.ts +++ b/test/Maximum.ts @@ -1,4 +1,4 @@ -import { assert } from "https://deno.land/std@0.219.1/assert/mod.ts"; +import { assert } from "https://deno.land/std@0.220.1/assert/mod.ts"; import { Creature } from "../src/Creature.ts"; import { CreatureInternal } from "../src/architecture/CreatureInterfaces.ts"; diff --git a/test/Mean.ts b/test/Mean.ts index 3ef7e0bd..d210ad50 100644 --- a/test/Mean.ts +++ b/test/Mean.ts @@ -1,4 +1,4 @@ -import { assert } from "https://deno.land/std@0.219.1/assert/mod.ts"; +import { assert } from "https://deno.land/std@0.220.1/assert/mod.ts"; import { Creature } from "../src/Creature.ts"; import { CreatureInternal } from "../src/architecture/CreatureInterfaces.ts"; diff --git a/test/Minimum.ts b/test/Minimum.ts index 5bb1f428..368965ff 100644 --- a/test/Minimum.ts +++ b/test/Minimum.ts @@ -1,4 +1,4 @@ -import { assert } from "https://deno.land/std@0.219.1/assert/mod.ts"; +import { assert } from "https://deno.land/std@0.220.1/assert/mod.ts"; import { Creature } from "../src/Creature.ts"; import { CreatureInternal } from "../src/architecture/CreatureInterfaces.ts"; diff --git a/test/Mish.ts b/test/Mish.ts index c034e957..c0926679 100644 --- a/test/Mish.ts +++ b/test/Mish.ts @@ -1,4 +1,4 @@ -import { assert } from "https://deno.land/std@0.219.1/assert/mod.ts"; +import { assert } from "https://deno.land/std@0.220.1/assert/mod.ts"; import { Creature } from "../src/Creature.ts"; import { CreatureInternal } from "../src/architecture/CreatureInterfaces.ts"; diff --git a/test/NeuronUUID.ts b/test/NeuronUUID.ts index f5e6da1b..9a01a3fd 100644 --- a/test/NeuronUUID.ts +++ b/test/NeuronUUID.ts @@ -2,7 +2,7 @@ import { CreatureInternal } from "../src/architecture/CreatureInterfaces.ts"; import { assert, assertEquals, -} from "https://deno.land/std@0.219.1/assert/mod.ts"; +} from "https://deno.land/std@0.220.1/assert/mod.ts"; import { Creature } from "../src/Creature.ts"; ((globalThis as unknown) as { DEBUG: boolean }).DEBUG = true; diff --git a/test/Offspring/Bread.ts b/test/Offspring/Bread.ts index 1dd60198..5b70028f 100644 --- a/test/Offspring/Bread.ts +++ b/test/Offspring/Bread.ts @@ -2,7 +2,7 @@ import { assert, assertEquals, assertFalse, -} from "https://deno.land/std@0.219.1/assert/mod.ts"; +} from "https://deno.land/std@0.220.1/assert/mod.ts"; import { Creature } from "../../src/Creature.ts"; import { CreatureInternal } from "../../src/architecture/CreatureInterfaces.ts"; import { Neat } from "../../src/architecture/Neat.ts"; diff --git a/test/Offspring/KeepOrder.ts b/test/Offspring/KeepOrder.ts index 23fa9301..37b37106 100644 --- a/test/Offspring/KeepOrder.ts +++ b/test/Offspring/KeepOrder.ts @@ -1,7 +1,7 @@ import { CreatureExport } from "../../mod.ts"; import { Creature } from "../../src/Creature.ts"; import { Offspring } from "../../src/architecture/Offspring.ts"; -import { ensureDirSync } from "https://deno.land/std@0.219.1/fs/mod.ts"; +import { ensureDirSync } from "https://deno.land/std@0.220.1/fs/mod.ts"; function makeMum() { const json: CreatureExport = { diff --git a/test/Offspring/KeepSynapses.ts b/test/Offspring/KeepSynapses.ts index 64a7d265..8cd093a5 100644 --- a/test/Offspring/KeepSynapses.ts +++ b/test/Offspring/KeepSynapses.ts @@ -1,8 +1,8 @@ -import { fail } from "https://deno.land/std@0.219.1/assert/mod.ts"; +import { fail } from "https://deno.land/std@0.220.1/assert/mod.ts"; import { CreatureExport } from "../../mod.ts"; import { Creature } from "../../src/Creature.ts"; import { Offspring } from "../../src/architecture/Offspring.ts"; -import { ensureDirSync } from "https://deno.land/std@0.219.1/fs/mod.ts"; +import { ensureDirSync } from "https://deno.land/std@0.220.1/fs/mod.ts"; function makeMum() { const json: CreatureExport = { diff --git a/test/Offspring/SortNeurons.ts b/test/Offspring/SortNeurons.ts index ff836a23..3fb13fe5 100644 --- a/test/Offspring/SortNeurons.ts +++ b/test/Offspring/SortNeurons.ts @@ -1,7 +1,7 @@ +import { assertEquals } from "https://deno.land/std@0.220.1/assert/mod.ts"; import { Creature, CreatureExport } from "../../mod.ts"; import { Offspring } from "../../src/architecture/Offspring.ts"; import { SynapseExport } from "../../src/architecture/SynapseInterfaces.ts"; -import { assertEquals } from "https://deno.land/std@0.219.1/assert/assert_equals.ts"; function makeMum() { const json: CreatureExport = { diff --git a/test/Projection.ts b/test/Projection.ts index 0abe1595..9aa074d9 100644 --- a/test/Projection.ts +++ b/test/Projection.ts @@ -1,4 +1,4 @@ -import { assert } from "https://deno.land/std@0.219.1/assert/mod.ts"; +import { assert } from "https://deno.land/std@0.220.1/assert/mod.ts"; import { Creature } from "../src/Creature.ts"; import { CreatureInternal } from "../src/architecture/CreatureInterfaces.ts"; diff --git a/test/Propagate/AccumulateBias.ts b/test/Propagate/AccumulateBias.ts index cb685d33..74d8677c 100644 --- a/test/Propagate/AccumulateBias.ts +++ b/test/Propagate/AccumulateBias.ts @@ -1,11 +1,10 @@ -import { assertAlmostEquals } from "https://deno.land/std@0.219.1/assert/assert_almost_equals.ts"; -import { CreatureExport } from "../../mod.ts"; +import { assertAlmostEquals } from "https://deno.land/std@0.220.1/assert/mod.ts"; +import { Creature, CreatureExport } from "../../mod.ts"; import { adjustedBias, BackPropagationConfig, } from "../../src/architecture/BackPropagation.ts"; import { NeuronState } from "../../src/architecture/CreatureState.ts"; -import { Creature } from "../../src/Creature.ts"; Deno.test("AccumulateBias-Standard", () => { const ns = new NeuronState(); diff --git a/test/Propagate/AccumulateWeight.ts b/test/Propagate/AccumulateWeight.ts index 735bffb0..523ab92c 100644 --- a/test/Propagate/AccumulateWeight.ts +++ b/test/Propagate/AccumulateWeight.ts @@ -1,4 +1,4 @@ -import { assertAlmostEquals } from "https://deno.land/std@0.219.1/assert/assert_almost_equals.ts"; +import { assertAlmostEquals } from "https://deno.land/std@0.220.1/assert/mod.ts"; import { accumulateWeight } from "../../src/architecture/BackPropagation.ts"; import { SynapseState } from "../../src/architecture/CreatureState.ts"; import { BackPropagationConfig } from "../../src/architecture/BackPropagation.ts"; diff --git a/test/Propagate/Complex.ts b/test/Propagate/Complex.ts index 51477213..9c93c2a6 100644 --- a/test/Propagate/Complex.ts +++ b/test/Propagate/Complex.ts @@ -1,10 +1,10 @@ -import { assertAlmostEquals } from "https://deno.land/std@0.219.1/assert/mod.ts"; +import { assertAlmostEquals } from "https://deno.land/std@0.220.1/assert/mod.ts"; import { Creature } from "../../src/Creature.ts"; import { BackPropagationConfig } from "../../src/architecture/BackPropagation.ts"; import { ensureDirSync, existsSync, -} from "https://deno.land/std@0.219.1/fs/mod.ts"; +} from "https://deno.land/std@0.220.1/fs/mod.ts"; ((globalThis as unknown) as { DEBUG: boolean }).DEBUG = true; diff --git a/test/Propagate/Constants.ts b/test/Propagate/Constants.ts index 0b86c177..4b7a3707 100644 --- a/test/Propagate/Constants.ts +++ b/test/Propagate/Constants.ts @@ -1,7 +1,7 @@ import { assertAlmostEquals, -} from "https://deno.land/std@0.219.1/assert/mod.ts"; -import { ensureDirSync } from "https://deno.land/std@0.219.1/fs/ensure_dir.ts"; +} from "https://deno.land/std@0.220.1/assert/mod.ts"; +import { ensureDirSync } from "https://deno.land/std@0.220.1/fs/ensure_dir.ts"; import { Creature } from "../../src/Creature.ts"; import { BackPropagationConfig } from "../../src/architecture/BackPropagation.ts"; import { CreatureExport } from "../../src/architecture/CreatureInterfaces.ts"; diff --git a/test/Propagate/Generation.ts b/test/Propagate/Generation.ts index f90efca9..0cc8c142 100644 --- a/test/Propagate/Generation.ts +++ b/test/Propagate/Generation.ts @@ -1,6 +1,6 @@ import { assertAlmostEquals, -} from "https://deno.land/std@0.219.1/assert/mod.ts"; +} from "https://deno.land/std@0.220.1/assert/mod.ts"; import { adjustedBias, adjustedWeight, diff --git a/test/Propagate/IF.ts b/test/Propagate/IF.ts index b5cc2da0..61bf0803 100644 --- a/test/Propagate/IF.ts +++ b/test/Propagate/IF.ts @@ -1,8 +1,8 @@ import { assert, assertAlmostEquals, -} from "https://deno.land/std@0.219.1/assert/mod.ts"; -import { ensureDirSync } from "https://deno.land/std@0.219.1/fs/ensure_dir.ts"; +} from "https://deno.land/std@0.220.1/assert/mod.ts"; +import { ensureDirSync } from "https://deno.land/std@0.220.1/fs/ensure_dir.ts"; import { Costs } from "../../src/Costs.ts"; import { Creature } from "../../src/Creature.ts"; import { CreatureExport } from "../../src/architecture/CreatureInterfaces.ts"; diff --git a/test/Propagate/Identity.ts b/test/Propagate/Identity.ts index 27861671..62da83ac 100644 --- a/test/Propagate/Identity.ts +++ b/test/Propagate/Identity.ts @@ -1,11 +1,12 @@ -import { fail } from "https://deno.land/std@0.219.1/assert/fail.ts"; -import { ensureDirSync } from "https://deno.land/std@0.219.1/fs/ensure_dir.ts"; -import { CreatureExport } from "../../mod.ts"; -import { Creature } from "../../src/Creature.ts"; +import { ensureDirSync } from "https://deno.land/std@0.220.1/fs/ensure_dir.ts"; +import { Creature, CreatureExport } from "../../mod.ts"; import { BackPropagationConfig } from "../../src/architecture/BackPropagation.ts"; -import { assert } from "https://deno.land/std@0.219.1/assert/assert.ts"; +import { + assert, + assertAlmostEquals, + fail, +} from "https://deno.land/std@0.220.1/assert/mod.ts"; import { Costs } from "../../src/Costs.ts"; -import { assertAlmostEquals } from "https://deno.land/std@0.219.1/assert/assert_almost_equals.ts"; const NODE_ID = "identity-6"; function makeCreature() { diff --git a/test/Propagate/Inverse.ts b/test/Propagate/Inverse.ts index d048b21a..7c72528c 100644 --- a/test/Propagate/Inverse.ts +++ b/test/Propagate/Inverse.ts @@ -1,8 +1,8 @@ import { assert, assertAlmostEquals, -} from "https://deno.land/std@0.219.1/assert/mod.ts"; -import { ensureDirSync } from "https://deno.land/std@0.219.1/fs/ensure_dir.ts"; +} from "https://deno.land/std@0.220.1/assert/mod.ts"; +import { ensureDirSync } from "https://deno.land/std@0.220.1/fs/ensure_dir.ts"; import { Creature } from "../../src/Creature.ts"; import { CreatureInternal } from "../../src/architecture/CreatureInterfaces.ts"; import { COMPLEMENT } from "../../src/methods/activations/types/COMPLEMENT.ts"; diff --git a/test/Propagate/LimitBias.ts b/test/Propagate/LimitBias.ts index bda22dbd..4a50d5c5 100644 --- a/test/Propagate/LimitBias.ts +++ b/test/Propagate/LimitBias.ts @@ -1,4 +1,4 @@ -import { assertAlmostEquals } from "https://deno.land/std@0.219.1/assert/assert_almost_equals.ts"; +import { assertAlmostEquals } from "https://deno.land/std@0.220.1/assert/mod.ts"; import { limitBias } from "../../src/architecture/BackPropagation.ts"; import { BackPropagationConfig } from "../../src/architecture/BackPropagation.ts"; diff --git a/test/Propagate/LimitWeight.ts b/test/Propagate/LimitWeight.ts index 8441fda4..2ba51d58 100644 --- a/test/Propagate/LimitWeight.ts +++ b/test/Propagate/LimitWeight.ts @@ -1,6 +1,8 @@ -import { assertAlmostEquals } from "https://deno.land/std@0.219.1/assert/assert_almost_equals.ts"; -import { limitWeight } from "../../src/architecture/BackPropagation.ts"; -import { BackPropagationConfig } from "../../src/architecture/BackPropagation.ts"; +import { assertAlmostEquals } from "https://deno.land/std@0.220.1/assert/mod.ts"; +import { + BackPropagationConfig, + limitWeight, +} from "../../src/architecture/BackPropagation.ts"; Deno.test("maximumWeightAdjustmentScale", () => { const config = new BackPropagationConfig({ diff --git a/test/Propagate/Maximum.ts b/test/Propagate/Maximum.ts index e6d42807..e4c9595b 100644 --- a/test/Propagate/Maximum.ts +++ b/test/Propagate/Maximum.ts @@ -1,8 +1,8 @@ import { assert, assertAlmostEquals, -} from "https://deno.land/std@0.219.1/assert/mod.ts"; -import { ensureDirSync } from "https://deno.land/std@0.219.1/fs/ensure_dir.ts"; +} from "https://deno.land/std@0.220.1/assert/mod.ts"; +import { ensureDirSync } from "https://deno.land/std@0.220.1/fs/ensure_dir.ts"; import { Costs } from "../../src/Costs.ts"; import { Creature } from "../../src/Creature.ts"; import { BackPropagationConfig } from "../../src/architecture/BackPropagation.ts"; diff --git a/test/Propagate/MaximumSimple.ts b/test/Propagate/MaximumSimple.ts index 30972a9b..5223bc21 100644 --- a/test/Propagate/MaximumSimple.ts +++ b/test/Propagate/MaximumSimple.ts @@ -1,5 +1,5 @@ -import { assert } from "https://deno.land/std@0.219.1/assert/mod.ts"; -import { ensureDirSync } from "https://deno.land/std@0.219.1/fs/ensure_dir.ts"; +import { assert } from "https://deno.land/std@0.220.1/assert/mod.ts"; +import { ensureDirSync } from "https://deno.land/std@0.220.1/fs/ensure_dir.ts"; import { Costs } from "../../src/Costs.ts"; import { Creature } from "../../src/Creature.ts"; import { BackPropagationConfig } from "../../src/architecture/BackPropagation.ts"; diff --git a/test/Propagate/Mean.ts b/test/Propagate/Mean.ts index 7b43abd2..086c74b3 100644 --- a/test/Propagate/Mean.ts +++ b/test/Propagate/Mean.ts @@ -1,8 +1,8 @@ -import { fail } from "https://deno.land/std@0.219.1/assert/mod.ts"; +import { fail } from "https://deno.land/std@0.220.1/assert/mod.ts"; import { ensureDirSync, existsSync, -} from "https://deno.land/std@0.219.1/fs/mod.ts"; +} from "https://deno.land/std@0.220.1/fs/mod.ts"; import { CreatureExport } from "../../mod.ts"; import { Creature } from "../../src/Creature.ts"; import { BackPropagationConfig } from "../../src/architecture/BackPropagation.ts"; diff --git a/test/Propagate/Minimum.ts b/test/Propagate/Minimum.ts index 8e92e7b2..8ff7e51c 100644 --- a/test/Propagate/Minimum.ts +++ b/test/Propagate/Minimum.ts @@ -1,8 +1,8 @@ import { assert, assertAlmostEquals, -} from "https://deno.land/std@0.219.1/assert/mod.ts"; -import { ensureDirSync } from "https://deno.land/std@0.219.1/fs/ensure_dir.ts"; +} from "https://deno.land/std@0.220.1/assert/mod.ts"; +import { ensureDirSync } from "https://deno.land/std@0.220.1/fs/ensure_dir.ts"; import { Costs } from "../../src/Costs.ts"; import { Creature } from "../../src/Creature.ts"; import { BackPropagationConfig } from "../../src/architecture/BackPropagation.ts"; diff --git a/test/Propagate/MultiLevel.ts b/test/Propagate/MultiLevel.ts index a0c088f0..4e486c8d 100644 --- a/test/Propagate/MultiLevel.ts +++ b/test/Propagate/MultiLevel.ts @@ -1,8 +1,8 @@ import { assert, assertAlmostEquals, -} from "https://deno.land/std@0.219.1/assert/mod.ts"; -import { ensureDirSync } from "https://deno.land/std@0.219.1/fs/ensure_dir.ts"; +} from "https://deno.land/std@0.220.1/assert/mod.ts"; +import { ensureDirSync } from "https://deno.land/std@0.220.1/fs/ensure_dir.ts"; import { Creature } from "../../src/Creature.ts"; import { CreatureInternal } from "../../src/architecture/CreatureInterfaces.ts"; import { train } from "../../src/architecture/Training.ts"; diff --git a/test/Propagate/NoChangeWhenCorrect.ts b/test/Propagate/NoChangeWhenCorrect.ts index 14c20f86..a89ffce0 100644 --- a/test/Propagate/NoChangeWhenCorrect.ts +++ b/test/Propagate/NoChangeWhenCorrect.ts @@ -1,8 +1,9 @@ -import { assertAlmostEquals } from "https://deno.land/std@0.219.1/assert/assert_almost_equals.ts"; -import { ensureDirSync } from "https://deno.land/std@0.219.1/fs/ensure_dir.ts"; -import { CreatureExport } from "../../mod.ts"; -import { Creature } from "../../src/Creature.ts"; -import { fail } from "https://deno.land/std@0.219.1/assert/fail.ts"; +import { + assertAlmostEquals, + fail, +} from "https://deno.land/std@0.220.1/assert/mod.ts"; +import { ensureDirSync } from "https://deno.land/std@0.220.1/fs/ensure_dir.ts"; +import { Creature, CreatureExport } from "../../mod.ts"; import { BackPropagationConfig } from "../../src/architecture/BackPropagation.ts"; function makeCreature() { diff --git a/test/Propagate/PI.ts b/test/Propagate/PI.ts index 6f2107ba..21c5d358 100644 --- a/test/Propagate/PI.ts +++ b/test/Propagate/PI.ts @@ -1,7 +1,7 @@ import { assertAlmostEquals, -} from "https://deno.land/std@0.219.1/assert/mod.ts"; -import { ensureDirSync } from "https://deno.land/std@0.219.1/fs/ensure_dir.ts"; +} from "https://deno.land/std@0.220.1/assert/mod.ts"; +import { ensureDirSync } from "https://deno.land/std@0.220.1/fs/ensure_dir.ts"; import { Creature } from "../../src/Creature.ts"; import { BackPropagationConfig } from "../../src/architecture/BackPropagation.ts"; import { CreatureExport } from "../../src/architecture/CreatureInterfaces.ts"; diff --git a/test/Propagate/SingleNeuron.ts b/test/Propagate/SingleNeuron.ts index a73ce656..a5bcc649 100644 --- a/test/Propagate/SingleNeuron.ts +++ b/test/Propagate/SingleNeuron.ts @@ -1,9 +1,9 @@ -import { fail } from "https://deno.land/std@0.219.1/assert/fail.ts"; import { assert, assertAlmostEquals, -} from "https://deno.land/std@0.219.1/assert/mod.ts"; -import { ensureDirSync } from "https://deno.land/std@0.219.1/fs/ensure_dir.ts"; + fail, +} from "https://deno.land/std@0.220.1/assert/mod.ts"; +import { ensureDirSync } from "https://deno.land/std@0.220.1/fs/ensure_dir.ts"; import { CreatureExport } from "../../mod.ts"; import { Creature } from "../../src/Creature.ts"; import { BackPropagationConfig } from "../../src/architecture/BackPropagation.ts"; diff --git a/test/Propagate/ToValue.ts b/test/Propagate/ToValue.ts index 58377bd3..9bc801e9 100644 --- a/test/Propagate/ToValue.ts +++ b/test/Propagate/ToValue.ts @@ -1,4 +1,4 @@ -import { assertAlmostEquals } from "https://deno.land/std@0.219.1/assert/assert_almost_equals.ts"; +import { assertAlmostEquals } from "https://deno.land/std@0.220.1/assert/mod.ts"; import { Creature, CreatureExport } from "../../mod.ts"; import { toActivation, diff --git a/test/Propagate/Trace.ts b/test/Propagate/Trace.ts index 7ccd823b..8da0eb05 100644 --- a/test/Propagate/Trace.ts +++ b/test/Propagate/Trace.ts @@ -1,4 +1,4 @@ -import { yellow } from "https://deno.land/std@0.219.1/fmt/colors.ts"; +import { yellow } from "https://deno.land/std@0.220.1/fmt/colors.ts"; import { BackPropagationConfig } from "../../src/architecture/BackPropagation.ts"; import { Creature } from "../../src/Creature.ts"; import { CreatureExport } from "../../src/architecture/CreatureInterfaces.ts"; diff --git a/test/Ratios.ts b/test/Ratios.ts index 9567430c..9c0bea46 100644 --- a/test/Ratios.ts +++ b/test/Ratios.ts @@ -1,4 +1,4 @@ -import { assert } from "https://deno.land/std@0.219.1/assert/mod.ts"; +import { assert } from "https://deno.land/std@0.220.1/assert/mod.ts"; import { NeatOptions } from "../src/config/NeatOptions.ts"; import { Creature } from "../src/Creature.ts"; diff --git a/test/Score.ts b/test/Score.ts index 32d27dae..703a6aeb 100644 --- a/test/Score.ts +++ b/test/Score.ts @@ -1,7 +1,7 @@ import { assert, assertAlmostEquals, -} from "https://deno.land/std@0.219.1/assert/mod.ts"; +} from "https://deno.land/std@0.220.1/assert/mod.ts"; import { Creature } from "../src/Creature.ts"; import { calculate, valuePenalty } from "../src/architecture/Score.ts"; diff --git a/test/Softplus.ts b/test/Softplus.ts index 1046cb38..aee2f10e 100644 --- a/test/Softplus.ts +++ b/test/Softplus.ts @@ -1,4 +1,4 @@ -import { assert } from "https://deno.land/std@0.219.1/assert/mod.ts"; +import { assert } from "https://deno.land/std@0.220.1/assert/mod.ts"; import { Creature } from "../src/Creature.ts"; import { CreatureInternal } from "../src/architecture/CreatureInterfaces.ts"; diff --git a/test/Swish.ts b/test/Swish.ts index 01d1cd28..b5270fa4 100644 --- a/test/Swish.ts +++ b/test/Swish.ts @@ -1,4 +1,4 @@ -import { assert } from "https://deno.land/std@0.219.1/assert/mod.ts"; +import { assert } from "https://deno.land/std@0.220.1/assert/mod.ts"; import { Creature } from "../src/Creature.ts"; import { CreatureInternal } from "../src/architecture/CreatureInterfaces.ts"; diff --git a/test/TagCreature.ts b/test/TagCreature.ts index 358dc90b..fa007448 100644 --- a/test/TagCreature.ts +++ b/test/TagCreature.ts @@ -1,4 +1,4 @@ -import { assert } from "https://deno.land/std@0.219.1/assert/mod.ts"; +import { assert } from "https://deno.land/std@0.220.1/assert/mod.ts"; import { addTag, getTag } from "https://deno.land/x/tags@v1.0.2/mod.ts"; import { Creature } from "../src/Creature.ts"; diff --git a/test/TagNeuron.ts b/test/TagNeuron.ts index dd7ab714..6b5617c3 100644 --- a/test/TagNeuron.ts +++ b/test/TagNeuron.ts @@ -1,4 +1,4 @@ -import { assert } from "https://deno.land/std@0.219.1/assert/mod.ts"; +import { assert } from "https://deno.land/std@0.220.1/assert/mod.ts"; import { Creature } from "../src/Creature.ts"; import { CreatureInternal } from "../src/architecture/CreatureInterfaces.ts"; diff --git a/test/TraceAggregate.ts b/test/TraceAggregate.ts index 4dad4f81..99cef15e 100644 --- a/test/TraceAggregate.ts +++ b/test/TraceAggregate.ts @@ -1,7 +1,7 @@ import { assert, assertAlmostEquals, -} from "https://deno.land/std@0.219.1/assert/mod.ts"; +} from "https://deno.land/std@0.220.1/assert/mod.ts"; import { Creature } from "../src/Creature.ts"; import { CreatureInternal } from "../src/architecture/CreatureInterfaces.ts"; import { BackPropagationConfig } from "../src/architecture/BackPropagation.ts"; diff --git a/test/TraceNeuron.ts b/test/TraceNeuron.ts index 62973e8a..3dfdd58b 100644 --- a/test/TraceNeuron.ts +++ b/test/TraceNeuron.ts @@ -1,5 +1,5 @@ -import { assert } from "https://deno.land/std@0.219.1/assert/mod.ts"; -import { ensureDirSync } from "https://deno.land/std@0.219.1/fs/ensure_dir.ts"; +import { assert } from "https://deno.land/std@0.220.1/assert/mod.ts"; +import { ensureDirSync } from "https://deno.land/std@0.220.1/fs/ensure_dir.ts"; import { Creature } from "../src/Creature.ts"; import { CreatureInternal } from "../src/architecture/CreatureInterfaces.ts"; import { NeuronTrace } from "../src/architecture/NeuronInterfaces.ts"; diff --git a/test/TraceStore.ts b/test/TraceStore.ts index 4fb37730..8ef5363e 100644 --- a/test/TraceStore.ts +++ b/test/TraceStore.ts @@ -1,8 +1,8 @@ -import { assert } from "https://deno.land/std@0.219.1/assert/mod.ts"; +import { assert } from "https://deno.land/std@0.220.1/assert/mod.ts"; import { emptyDirSync, ensureDirSync, -} from "https://deno.land/std@0.219.1/fs/mod.ts"; +} from "https://deno.land/std@0.220.1/fs/mod.ts"; import { Creature } from "../src/Creature.ts"; import { CreatureInternal } from "../src/architecture/CreatureInterfaces.ts"; import { SynapseTrace } from "../src/architecture/SynapseInterfaces.ts"; diff --git a/test/Train.ts b/test/Train.ts index 972fe250..74887119 100644 --- a/test/Train.ts +++ b/test/Train.ts @@ -1,5 +1,5 @@ -import { assert, fail } from "https://deno.land/std@0.219.1/assert/mod.ts"; -import { ensureDirSync } from "https://deno.land/std@0.219.1/fs/ensure_dir.ts"; +import { assert, fail } from "https://deno.land/std@0.220.1/assert/mod.ts"; +import { ensureDirSync } from "https://deno.land/std@0.220.1/fs/ensure_dir.ts"; import { Creature } from "../src/Creature.ts"; import { train } from "../src/architecture/Training.ts"; diff --git a/test/Worker.ts b/test/Worker.ts index f755125a..17edc123 100644 --- a/test/Worker.ts +++ b/test/Worker.ts @@ -1,4 +1,4 @@ -import { assert } from "https://deno.land/std@0.219.1/assert/mod.ts"; +import { assert } from "https://deno.land/std@0.220.1/assert/mod.ts"; import { WorkerHandler } from "../src/multithreading/workers/WorkerHandler.ts"; ((globalThis as unknown) as { DEBUG: boolean }).DEBUG = true; diff --git a/test/addNeuron.ts b/test/addNeuron.ts index d58a8972..f4265067 100644 --- a/test/addNeuron.ts +++ b/test/addNeuron.ts @@ -1,4 +1,4 @@ -import { assert } from "https://deno.land/std@0.219.1/assert/mod.ts"; +import { assert } from "https://deno.land/std@0.220.1/assert/mod.ts"; import { getTag } from "https://deno.land/x/tags@v1.0.2/mod.ts"; import { Creature } from "../src/Creature.ts"; import { CreatureInternal } from "../src/architecture/CreatureInterfaces.ts"; @@ -126,7 +126,7 @@ Deno.test("addNode", () => { ); } - const from = network.efferentConnections(indx); + const from = network.outwardConnections(indx); if (node.type !== "output") { assert( diff --git a/test/data/CRISPR/DNA-from-to.json b/test/data/CRISPR/DNA-from-to.json new file mode 100644 index 00000000..0a6c5ed0 --- /dev/null +++ b/test/data/CRISPR/DNA-from-to.json @@ -0,0 +1,8 @@ +{ + "id": "from-to", + + "synapses": [ + { "fromUUID": "input-299", "toUUID": "output-0", "weight": 0.123 }, + { "fromUUID": "input-123", "toUUID": "output-0", "weight": 0.456 } + ] +} diff --git a/test/ifPropagation.ts b/test/ifPropagation.ts index 6e798ab8..5ee0aca0 100644 --- a/test/ifPropagation.ts +++ b/test/ifPropagation.ts @@ -1,9 +1,9 @@ -import { assert } from "https://deno.land/std@0.219.1/assert/mod.ts"; +import { assert } from "https://deno.land/std@0.220.1/assert/mod.ts"; import { Creature } from "../src/Creature.ts"; import { CreatureInternal } from "../src/architecture/CreatureInterfaces.ts"; import { SynapseTrace } from "../src/architecture/SynapseInterfaces.ts"; import { TrainOptions } from "../src/config/TrainOptions.ts"; -import { ensureDirSync } from "https://deno.land/std@0.219.1/fs/ensure_dir.ts"; +import { ensureDirSync } from "https://deno.land/std@0.220.1/fs/ensure_dir.ts"; import { train } from "../src/architecture/Training.ts"; ((globalThis as unknown) as { DEBUG: boolean }).DEBUG = true; diff --git a/test/makeActivation.ts b/test/makeActivation.ts index c7dda47e..115bac21 100644 --- a/test/makeActivation.ts +++ b/test/makeActivation.ts @@ -1,6 +1,6 @@ import { assertAlmostEquals, -} from "https://deno.land/std@0.219.1/assert/mod.ts"; +} from "https://deno.land/std@0.220.1/assert/mod.ts"; import { Creature } from "../src/Creature.ts"; import { CreatureState } from "../src/architecture/CreatureState.ts"; diff --git a/test/toJSON.ts b/test/toJSON.ts index fe3ae138..920c5f39 100644 --- a/test/toJSON.ts +++ b/test/toJSON.ts @@ -1,5 +1,5 @@ import { CreatureInternal } from "../src/architecture/CreatureInterfaces.ts"; -import { assert } from "https://deno.land/std@0.219.1/assert/mod.ts"; +import { assert } from "https://deno.land/std@0.220.1/assert/mod.ts"; import { Creature } from "../src/Creature.ts"; import { SynapseInternal } from "../src/architecture/SynapseInterfaces.ts"; diff --git a/test/unSquash.ts b/test/unSquash.ts index eba60189..bd54eb03 100644 --- a/test/unSquash.ts +++ b/test/unSquash.ts @@ -1,33 +1,32 @@ -import { assert } from "https://deno.land/std@0.219.1/assert/assert.ts"; -import { fail } from "https://deno.land/std@0.219.1/assert/mod.ts"; +import { assert, fail } from "https://deno.land/std@0.220.1/assert/mod.ts"; import { ActivationInterface } from "../src/methods/activations/ActivationInterface.ts"; import { Activations } from "../src/methods/activations/Activations.ts"; import { UnSquashInterface } from "../src/methods/activations/UnSquashInterface.ts"; -import { BIPOLAR_SIGMOID } from "../src/methods/activations/types/BIPOLAR_SIGMOID.ts"; -import { IDENTITY } from "../src/methods/activations/types/IDENTITY.ts"; -import { COMPLEMENT } from "../src/methods/activations/types/COMPLEMENT.ts"; -import { LOGISTIC } from "../src/methods/activations/types/LOGISTIC.ts"; -import { Mish } from "../src/methods/activations/types/Mish.ts"; -import { TANH } from "../src/methods/activations/types/TANH.ts"; -import { SELU } from "../src/methods/activations/types/SELU.ts"; import { ABSOLUTE } from "../src/methods/activations/types/ABSOLUTE.ts"; import { BENT_IDENTITY } from "../src/methods/activations/types/BENT_IDENTITY.ts"; import { BIPOLAR } from "../src/methods/activations/types/BIPOLAR.ts"; +import { BIPOLAR_SIGMOID } from "../src/methods/activations/types/BIPOLAR_SIGMOID.ts"; import { CLIPPED } from "../src/methods/activations/types/CLIPPED.ts"; +import { COMPLEMENT } from "../src/methods/activations/types/COMPLEMENT.ts"; import { Cosine } from "../src/methods/activations/types/Cosine.ts"; import { ELU } from "../src/methods/activations/types/ELU.ts"; import { Exponential } from "../src/methods/activations/types/Exponential.ts"; import { GAUSSIAN } from "../src/methods/activations/types/GAUSSIAN.ts"; import { HARD_TANH } from "../src/methods/activations/types/HARD_TANH.ts"; +import { IDENTITY } from "../src/methods/activations/types/IDENTITY.ts"; +import { LOGISTIC } from "../src/methods/activations/types/LOGISTIC.ts"; import { LeakyReLU } from "../src/methods/activations/types/LeakyReLU.ts"; import { LogSigmoid } from "../src/methods/activations/types/LogSigmoid.ts"; +import { Mish } from "../src/methods/activations/types/Mish.ts"; import { RELU } from "../src/methods/activations/types/RELU.ts"; +import { SELU } from "../src/methods/activations/types/SELU.ts"; import { SINUSOID } from "../src/methods/activations/types/SINUSOID.ts"; -import { Softplus } from "../src/methods/activations/types/Softplus.ts"; import { SOFTSIGN } from "../src/methods/activations/types/SOFTSIGN.ts"; -import { StdInverse } from "../src/methods/activations/types/StdInverse.ts"; import { STEP } from "../src/methods/activations/types/STEP.ts"; +import { Softplus } from "../src/methods/activations/types/Softplus.ts"; +import { StdInverse } from "../src/methods/activations/types/StdInverse.ts"; import { Swish } from "../src/methods/activations/types/Swish.ts"; +import { TANH } from "../src/methods/activations/types/TANH.ts"; function makeValues() { const values: number[] = [];