-
Notifications
You must be signed in to change notification settings - Fork 40
Sequential NeuralNetwork #252
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
base: main
Are you sure you want to change the base?
Conversation
src/TimeSeries/index.js
Outdated
|
||
async init() { | ||
// workaround for Error | ||
setBackend("webgl"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regular NeuralNetwork leaves this to the sketch to set, so I'd suggest we do the same. (Or, change NN in the same manner.)
Too long for me to recall, but there probably was some discussion whether or not to handle this transparently for the user, or not, that's worth unearthing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, I'll leave this comment unresolved in this case, so it doesn't get forgotten
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some additional comments along the lines of @gohai's review! Also, I see this PR still includes ml5.timeSeries()
, my memory is shaky of course, but I recall a discussion around this implementation being a part of ml5.neuralNetwork()
with a new "time series" task? Is that correct?
My memory is also shaky, @shiffman - but I like the idea. Since the options are being passed to the factory method, we could keep the inheritance model that Mathew built, and have |
Yes! I do remember having that discussion, but I don't clearly remember if we had a decision on which method to do. I definitely think its worth trying out and I have created a new branch to test it here. However, there are some changes this method necessitates: I have tried implementing DIY time series and DIY neural network classes and the factory functions in the neural network factory function so it is all under one neuralNetwork call. However since the DIY time series class depends on an import of the DIY neural network class, it is not possible to call the DIY time series class inside of the neural network factory function as it needs to import the DIY ts class in the neural network file. This causes a circular dependency as imports of the other files are present. Thus, in the initial commit on the branch I provided, removed the neuralNetwork factory function from the neural network file and moved it all the way to the time series file to prevent this conflict. So far, all of the examples have worked with this method. I have yet to try another method where there is a separate file for the neural network factory function, so there is no circular dependencies, however I am not sure where in the file system to put it in and a good naming convention for it. Let me know if you need any more clarification for this! |
examples/timeSeries-load-model-hand-gestures/model/model_meta.json
Outdated
Show resolved
Hide resolved
Hi @gohai it looks pretty good! lets keep that and I'll remove the rdp-visualizer. |
examples/neuralNetwork-sequence-hand-gesture-load-model/sketch.js
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,28 @@ | |||
<!-- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adds a TimeSeries Feature so sequences of data can be used in ML5
This version extends from the Neural Network class with some overrides to allow sequences of data. It also includes some helper functions to simplify loading timeseries data.
Key Features:
addData
in the format of Array of Objects [{x: ,y: },{x: ,y: }] or Array of Arrays [[,],[,]]addDefaultLayers
which usestsLayers.js
file to define the architectures, based ontask
anddataMode
(still needs to be discussed).padCoordinates(sequence, targetLength)
uses RDP algorithm to simplify coordinate data to a specified target lengthslidingWindow(data, featureKeys, targetKeys, batchLength = null)
andsampleWindow(data)
uses sliding Window algorithm to create batches from sequence data and take a single sample for prediction