From e8dbb580f80af71217344f52a751086e3d9208ed Mon Sep 17 00:00:00 2001 From: Xie Yuheng Date: Tue, 4 Jun 2024 21:42:50 +0800 Subject: [PATCH] up --- src/system-a/models/iris/irisModel.ts | 16 ++-- src/system-a/neurons/relu.test.ts | 102 +++++++++++++------------- 2 files changed, 59 insertions(+), 59 deletions(-) diff --git a/src/system-a/models/iris/irisModel.ts b/src/system-a/models/iris/irisModel.ts index c7befae..f4e84c9 100644 --- a/src/system-a/models/iris/irisModel.ts +++ b/src/system-a/models/iris/irisModel.ts @@ -39,18 +39,18 @@ export function irisTrainParameters(): Array { // }) gradientDescentRms - const gradientDescentFn = gradientDescentRms({ - learningRate: 0.006, - decayRate: 0.9, - }) - - gradientDescentAdam - // const gradientDescentFn = gradientDescentAdam({ + // const gradientDescentFn = gradientDescentRms({ // learningRate: 0.006, // decayRate: 0.9, - // relayFactor: 0.85, // }) + gradientDescentAdam + const gradientDescentFn = gradientDescentAdam({ + learningRate: 0.006, + decayRate: 0.9, + relayFactor: 0.85, + }) + return gradientDescentFn(objective, initParameters, { revs: 2000, }) diff --git a/src/system-a/neurons/relu.test.ts b/src/system-a/neurons/relu.test.ts index 8f9b578..7a8de4d 100644 --- a/src/system-a/neurons/relu.test.ts +++ b/src/system-a/neurons/relu.test.ts @@ -1,55 +1,55 @@ -import assert from "node:assert" -import { test } from "node:test" -import { assertTensorAlmostEqual } from "../tensor/assertions.js" -import { rectify, relu } from "./relu.js" +// import assert from "node:assert" +// import { test } from "node:test" +// import { assertTensorAlmostEqual } from "../tensor/assertions.js" +// import { rectify, relu } from "./relu.js" -test("rectify", () => { - assert.deepStrictEqual( - rectify([ - [-1, -2, -3], - [1, 2, 3], - ]), - [ - [0, 0, 0], - [1, 2, 3], - ], - ) -}) +// test("rectify", () => { +// assert.deepStrictEqual( +// rectify([ +// [-1, -2, -3], +// [1, 2, 3], +// ]), +// [ +// [0, 0, 0], +// [1, 2, 3], +// ], +// ) +// }) -test("relu", () => { - assertTensorAlmostEqual( - relu([2, 1, 3])( - [ - [7.1, 4.3, -6.4], - [7.1, 4.3, -6.4], - ], - [0.6, 1], - ), - [0, 0.3], - 0.01, - ) +// test("relu", () => { +// assertTensorAlmostEqual( +// relu([2, 1, 3])( +// [ +// [7.1, 4.3, -6.4], +// [7.1, 4.3, -6.4], +// ], +// [0.6, 1], +// ), +// [0, 0.3], +// 0.01, +// ) - assertTensorAlmostEqual( - relu([2, 1, 3])( - [ - [7.1, 4.3, -6.4], - [7.1, 4.3, -6.4], - ], - [0.6, 0.6], - ), - [0, 0], - 0, - ) +// assertTensorAlmostEqual( +// relu([2, 1, 3])( +// [ +// [7.1, 4.3, -6.4], +// [7.1, 4.3, -6.4], +// ], +// [0.6, 0.6], +// ), +// [0, 0], +// 0, +// ) - assertTensorAlmostEqual( - relu([2, 1, 3])( - [ - [7.1, 4.3, -6.4], - [7.1, 4.3, -6.4], - ], - 0.6, - ), - [0, 0], - 0, - ) -}) +// assertTensorAlmostEqual( +// relu([2, 1, 3])( +// [ +// [7.1, 4.3, -6.4], +// [7.1, 4.3, -6.4], +// ], +// 0.6, +// ), +// [0, 0], +// 0, +// ) +// })