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
I've been working a lot on refactoring the NeuralNetwork code so I wanted to have a place to ask questions as they come up.
First up:
classifyMultiple and predictMultiple are a bit odd because they are actually identical to the classify and predict functions. They call the same classifyInternal/predictInternal function with the same _input argument.
We determine whether it's single or multiple by looking at the input. This could be potentially buggy. For example if you pass an array of inputs which has length 1 to the classifyMultiple method then you get back the same results as you would from a single classification. Not an array of results (array of arrays) with length 1. That's because we're determining whether to return a nested array by looking at the length with no knowledge of which method was used.
We have a few options here:
Leave things as-is.
Have one classify method which can handle single or multiple classification (This is how the TFJS model.predict() works, but I don't like this because it is confusing to explain in the docs).
Ensure that classify always returns a single classification and classifyMultiple always returns an array. We would validate the inputs and log warnings or throw errors if the user provides the wrong type of input.
Remove batched multiple classification entirely, and have one classify method which can only accept a single input.
The text was updated successfully, but these errors were encountered:
I've been working a lot on refactoring the NeuralNetwork code so I wanted to have a place to ask questions as they come up.
First up:
classifyMultiple
andpredictMultiple
are a bit odd because they are actually identical to theclassify
andpredict
functions. They call the sameclassifyInternal
/predictInternal
function with the same_input
argument.We determine whether it's single or multiple by looking at the input. This could be potentially buggy. For example if you pass an array of inputs which has length 1 to the
classifyMultiple
method then you get back the same results as you would from a single classification. Not an array of results (array of arrays) with length 1. That's because we're determining whether to return a nested array by looking at the length with no knowledge of which method was used.We have a few options here:
classify
method which can handle single or multiple classification (This is how the TFJS model.predict() works, but I don't like this because it is confusing to explain in the docs).classify
always returns a single classification andclassifyMultiple
always returns an array. We would validate the inputs and log warnings or throw errors if the user provides the wrong type of input.classify
method which can only accept a single input.The text was updated successfully, but these errors were encountered: