From 83574f627586909b19bd96f9e69e3c9b1b0887bf Mon Sep 17 00:00:00 2001 From: voidvoxel <160202125+voidvoxel@users.noreply.github.com> Date: Mon, 17 Jun 2024 18:27:45 -0400 Subject: [PATCH] Please, linter gods, pleaaaase stop hating me --- src/neural-network.ts | 7 ++++++- src/utilities/to-svg.ts | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/neural-network.ts b/src/neural-network.ts index 66bfef8b..6ce1ce14 100644 --- a/src/neural-network.ts +++ b/src/neural-network.ts @@ -323,7 +323,12 @@ export class NeuralNetwork< constructor( options: Partial = {} ) { - this.options = { ...this.options, ...options }; + this.options.binaryThresh = options.binaryThresh ?? 0.5; + this.options.hiddenLayers = options.hiddenLayers ?? []; + this.options.inputSize = options.inputSize ?? 1; + this.options.loss = options.loss ?? loss; + this.options.outputSize = options.outputSize ?? options.inputSize ?? 1; + this.options.ramSize = options.ramSize ?? 1; this.updateTrainingOptions(options); const { inputSize, hiddenLayers, outputSize } = this.options; diff --git a/src/utilities/to-svg.ts b/src/utilities/to-svg.ts index 6e4bb835..20c010fc 100644 --- a/src/utilities/to-svg.ts +++ b/src/utilities/to-svg.ts @@ -467,7 +467,9 @@ export function toSVG< // Get network size array for NeuralNetwork or NeuralNetworkGPU let sizes: number[] = []; if (net instanceof NeuralNetwork || net instanceof NeuralNetworkGPU) { - sizes = getNeuralNetworkSizes(net); + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-expect-error + sizes = getNeuralNetworkSizes((net as unknown) as NeuralNetwork); } // get network size for Recurrent else if (net instanceof Recurrent) {