Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
xieyuheng committed Jun 4, 2024
1 parent 255d657 commit e8dbb58
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 59 deletions.
16 changes: 8 additions & 8 deletions src/system-a/models/iris/irisModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,18 @@ export function irisTrainParameters(): Array<Tensor> {
// })

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,
})
Expand Down
102 changes: 51 additions & 51 deletions src/system-a/neurons/relu.test.ts
Original file line number Diff line number Diff line change
@@ -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,
// )
// })

0 comments on commit e8dbb58

Please sign in to comment.