Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discussion: NeuralNetwork #112

Open
lindapaiste opened this issue Mar 24, 2024 · 0 comments
Open

Discussion: NeuralNetwork #112

lindapaiste opened this issue Mar 24, 2024 · 0 comments

Comments

@lindapaiste
Copy link
Contributor

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:

  1. Leave things as-is.
  2. 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).
  3. 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.
  4. Remove batched multiple classification entirely, and have one classify method which can only accept a single input.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant