liquidcarrot / carrot

🥕 Evolutionary Neural Networks in JavaScript
https://liquidcarrot.io/carrot/
MIT License
293 stars 34 forks source link

Network.activate consistently returns string type output #204

Open christianechevarria opened 4 years ago

christianechevarria commented 4 years ago

Description

There seems to be a type coercion bug somewhere in the code that produces the activation values as they are consistently of string type, which could be because some initial construction value is technically a string which coerces all operations. The networks seem to be producing the right values, but this is potentially problematic due to the ambiguity of the "plus" sign in string operations which can produce numbers that seem correct and then are used unassumingly.

To Reproduce

Create a fresh network using the standard constructor, call .activate immediately after, then pass it an array of numbers of equal length to the inputs, when you test the returned array contents individually using typeof you will get string

Tasks

raimannma commented 4 years ago

Fixed in the typescript version