You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The NeuralNetwork supports a noTraining option which is used in some of the NeuroEvolution examples to initialize a "brain" with dummy weights. This option does not appear anywhere in our documentation.
The implementation is very buggy as it relies on a lot of assumptions. It assumes that outputs will be an array if task === 'classification' and uses outputs[i]. That is not a valid assumption because we also support using a number representing the number of classes. This will break:
It also assumes that the length of this output array will determine the output shape. Therefore it breaks if outputs is an array of property names, like outputs: ['labels']. I suspect that it is impossible to support a no-data approach in this situation because the shape of the output layer depends on the number of classes, and we wouldn't know the number of classes until there is data.
At the very least we should figure out when it does and doesn't work and put that in our documentation, like "if using noTraining for a classification task, outputs must be an array of class names."
If task !== 'classification' then the code uses new Array(outputs).fill(0) with I interpret as assuming that outputs is a number but I don't even know. Something like new Array([1,2,3]).fill(0) is valid and returns [0].
It would make more sense to look at typeof outputs or Array.isArray(outputs) rather than assuming the shape based on the task.
The text was updated successfully, but these errors were encountered:
The NeuralNetwork supports a
noTraining
option which is used in some of the NeuroEvolution examples to initialize a "brain" with dummy weights. This option does not appear anywhere in our documentation.ml5-library/src/NeuralNetwork/index.js
Lines 128 to 144 in 2c5cd1e
The implementation is very buggy as it relies on a lot of assumptions. It assumes that
outputs
will be anarray
iftask === 'classification'
and usesoutputs[i]
. That is not a valid assumption because we also support using anumber
representing the number of classes. This will break:It also assumes that the length of this output array will determine the output shape. Therefore it breaks if
outputs
is an array of property names, likeoutputs: ['labels']
. I suspect that it is impossible to support a no-data approach in this situation because the shape of the output layer depends on the number of classes, and we wouldn't know the number of classes until there is data.At the very least we should figure out when it does and doesn't work and put that in our documentation, like "if using
noTraining
for a classification task,outputs
must be an array of class names."If
task !== 'classification'
then the code usesnew Array(outputs).fill(0)
with I interpret as assuming thatoutputs
is anumber
but I don't even know. Something likenew Array([1,2,3]).fill(0)
is valid and returns[0]
.It would make more sense to look at
typeof outputs
orArray.isArray(outputs)
rather than assuming the shape based on the task.The text was updated successfully, but these errors were encountered: