-
Notifications
You must be signed in to change notification settings - Fork 901
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
🧹 NeuralNetwork cleanup pt. 3 -- tasks #1410
Open
lindapaiste
wants to merge
14
commits into
ml5js:main
Choose a base branch
from
lindapaiste:cleanup/nn-tasks
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Conflicts: # package-lock.json # package.json
…upport # Conflicts: # package-lock.json
* don't return values which are not used. * renamed some `get` methods to `set`.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Introduces a level of abstraction for the "task" of the neural network:
getTask.ts
NNTask
which specifies what information a task needs to provide:noTraining
is set.name
(not currently not used, possible 🪓)classification
,regression
, andimageClassification
.imageClassification
uses some of the same functions asclassification
.getSampleData
is only possible in a limited set of circumstances (see issue NN optionnoTraining
is undocumented and buggy #1409), so I'm throwing a lot of specific errors when those circumstances aren't met.getTask
to convert astring
task name into aNNTask
object.NeuralNetwork/index.ts
this.task
with the task object based onoptions.task
. This defaults toregression
which seems to match what was in the default layers before.addDefaultLayers()
andcompile()
which was moved into the task objects. Now we call a function onthis.task
:const layers = this.task.createLayers(inputUnits, hiddenUnits, outputUnits);
const options = this.task.getCompileOptions(this.options.learningRate);
NeuralNetwork/NeuralNetwork.ts
optimizer.call(this, learningRate)
to set thethisArg
on the optimizer doesn't actually make a difference? (Please correct me if I am wrong). I removedsetOptimizerFunction()
, which, despite the name, just creates an optimizer and doesn't set anything. The instantiation of the optimizer is handled in thegetCompileOptions()
function of the task, which gets thelearningRate
as an argument.