RunKit + npm: @jeff-tian/perceptron

node v12.22.12
version: 2.0.0
endpointsharetweet
const nn = require("@jeff-tian/perceptron/lib/NeuralNetwork") const flat = (prev, next)=>[...prev, ...next] const getFlattedWeights = weights => weights.reduce(flat).reduce(flat) const getNthWeights = index => '(' + getFlattedWeights(network.weightsHistory[index].weights).join(', ') + ')' const network = nn.backPropFor2LevelSigmoidUnitForwardNetwork([ { x: [1, 0], t: 1, }, { x: [0, 1], t: 0, }, ], 0.3, 0.9) console.log("初始权值 = " + getNthWeights(0)) console.log("第一次迭代后的权值 = " + getNthWeights(1)) console.log("第二次迭代后的权值 = " + getNthWeights(2))
Created from: https://npm.runkit.com/%40jeff-tian%2Fperceptron
This is the solution for "Machine Learning"'s exercise 4.7: https://ml.jiwai.win/%E7%AC%AC%E5%9B%9B%E7%AB%A0%20%E4%BA%BA%E5%B7%A5%E7%A5%9E%E7%BB%8F%E7%BD%91%E7%BB%9C/4.7.html
Loading…

no comments

    sign in to comment