Skip to content

Commit

Permalink
fix: bias was randmozed when not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
Keshav-writes-code committed Sep 27, 2024
1 parent 1f60b28 commit 9a678cb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/NN_comps/NN_classes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ export class Neuron {
constructor(prevLayer_neurons: number, randomized: boolean) {
const randRange = 10;
this.value = 0;
this.bias = decimalRounder(Math.random() * randRange * 2 - randRange);
this.bias = 0
this.weights = new Array(prevLayer_neurons).fill(0);
if (randomized) {
this.bias = decimalRounder(Math.random() * randRange * 2 - randRange);
this.weights = this.weights.map(() =>
decimalRounder(Math.random() * randRange * 2 - randRange)
);
Expand Down

0 comments on commit 9a678cb

Please sign in to comment.