@nlpjs/neural
Advanced tools
Comparing version 4.9.2 to 4.9.3
{ | ||
"name": "@nlpjs/neural", | ||
"version": "4.9.2", | ||
"version": "4.9.3", | ||
"description": "Neural Network", | ||
@@ -28,5 +28,5 @@ "author": { | ||
"dependencies": { | ||
"@nlpjs/core": "^4.9.2" | ||
"@nlpjs/core": "^4.9.3" | ||
}, | ||
"gitHead": "956809b1d31b96962f588bff97aef9b73794af4d" | ||
"gitHead": "defca61ee1127e88d73a0808c544028fa4f0e7f5" | ||
} |
@@ -81,15 +81,7 @@ /* | ||
runInputPerceptron(perceptron, input) { | ||
const { weights, bias } = perceptron; | ||
let sum = bias; | ||
for (let i = 0; i < input.keys.length; i += 1) { | ||
const key = input.keys[i]; | ||
if (weights[key]) { | ||
if (input.data[key] === 1) { | ||
sum += weights[key]; | ||
} else { | ||
sum += input.data[key] * weights[key]; | ||
} | ||
} | ||
} | ||
return sum < 0 ? 0 : this.settings.alpha * sum; | ||
const sum = input.keys.reduce( | ||
(prev, key) => prev + input.data[key] * perceptron.weights[key], | ||
perceptron.bias | ||
); | ||
return sum <= 0 ? 0 : this.settings.alpha * sum; | ||
} | ||
@@ -96,0 +88,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15987
398
Updated@nlpjs/core@^4.9.3