-
Notifications
You must be signed in to change notification settings - Fork 907
[nn-refactor] Refactor and reimplementation of NeuralNetwork #749
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
Conversation
shiffman
left a comment
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.
This looks wonderful, thank you @joeyklee! I just scanned it over and I think the refactoring is all in the right direction. I commented on some minor nitpicky things in the corresponding ml5-examples pull request. I am going to make a new pose classifier example tomorrow so can test this out with it then!
|
A few issues popping up:
getMin(_array) {
// return Math.min(..._array)
return _array.reduce((a, b) => {
return Math.min(a, b);
});
}
|
|
@shiffman I will merge this in now and plan to do subsequent assessments of the updates and refactoring. There's def. some optimizations that can be made, but I think it is structurally more stable than before as well as has the beginnings of a balanced "constrained flexibility" to do enough but not too much/everything. I'm excited to see what happens! |
* [nn-refactor] Refactor and reimplementation of NeuralNetwork (#749) * adds temp DiyNeuralNetwork - refactoring NeuralNetwork class * adds updates to refactor * refactoring nn-refactor * adds features for compile and add layers * rm console log * adds train interface * adds basic predict * adds blank functions in data class * update nn class * adds nn compile handling * updates function name * adds data loading functions // todo - clean up * add recursive findEntries function and data loading functions * adds formatRawData function * adds .addData() function * adds saveData function * adds handling for onehot and counting input and output units " " * adds code comments * adds concat to this.meta * changed name to createMetaDataFromData" * adds convertRawToTensors * adds functions for calculating stats * adds normalization and conversion to tensor handling * adds .summarizeData * adds data handling to index * updates summarizeData function to explicitly set meta * updates and adds functions * updates predict function * adds classify() with meta * adds metadata handling and data functions * adds loadData with options in init * adds major updates to initiation and defaults * adds boolean flags to check status to configure nn * adds addData function to index * adds support for auto labeling inputs and outputs for blank nn * code cleanup and function name change * flattens array in cnvertRawToTensors * flattens inputs * flatten array always * adds isOneHotEncodedOrNormalized * updates predict and classify functions and output format * updates param handling in predict and classify * code cleanup * adds save function * code cleanup * adds first pass at loading data * fixes missing isNormalized flag in meta * moves loading functions to respective class * moves files to NeuralNetwork * moves files to NeuralNetwork and rm diyNN * rms console.log * check if metadata and warmedup are true before normalization * adds unnormalize function to nn predict * return unNormalized value * adds loadData() and changes to loadDataFromUrl * adds saveData to index * adds modelUrl to constructor options in index * cleans up predict and classify * fix reference to unNormalizeValue * code cleanup * adds looping to format data for prediction and predictMultiple and classifyMultiple * adds layer handling for options * adds tfvis to index and ml5 root * adds debug flag in options * adds vis and fixes input formatting" " * adds model summary * adds comments and reorders code * refactoring functions with 3 datatypes in mind: number, string, array * adds data handling updates * adds handling tensors * adds process up to training * fixes breaking training * adds full working poc * fix addData check * adds updates to api and notes to fix with functions * adds createMetadata in index * adds image handling in classify functino * adds method to not exceed call stack of min and max * fixes loadData issue * adds first header name for min and max * code cleanup * removes unused functions * fixes setDataRaw * code clean up, organization, and adds method binding to constructor * adds methods to constructor, adds comments, and cleans up * adds methods to constructor for nndata * adds methods to constructor, code cleanup, and organization * docs: add RaisinTen as a contributor (#751) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] * [neural network] adds first tests for neural network and placeholders (#755) * initial commit for nn test * sets karma testing random to false * adds tests for neuralnetwork class * adds placeholders for tests to do * docs: add LudwigStumpp as a contributor (#758) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] * fix(Docsify Configuration (docs/index.html)): Use Docsify's auto2top property to reset scroll positi (#761) * docs(feature-extractor.md): Switch the links for regression and classifications p5 editor examples i (#762) * docs: add bomanimc as a contributor (#763) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] Co-authored-by: Joey Lee <[email protected]> * fix: typo Co-authored-by: Joey Lee <[email protected]> Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> Co-authored-by: Bomani Oseni McClendon <[email protected]>
* [nn-refactor] Refactor and reimplementation of NeuralNetwork (#749) * adds temp DiyNeuralNetwork - refactoring NeuralNetwork class * adds updates to refactor * refactoring nn-refactor * adds features for compile and add layers * rm console log * adds train interface * adds basic predict * adds blank functions in data class * update nn class * adds nn compile handling * updates function name * adds data loading functions // todo - clean up * add recursive findEntries function and data loading functions * adds formatRawData function * adds .addData() function * adds saveData function * adds handling for onehot and counting input and output units " " * adds code comments * adds concat to this.meta * changed name to createMetaDataFromData" * adds convertRawToTensors * adds functions for calculating stats * adds normalization and conversion to tensor handling * adds .summarizeData * adds data handling to index * updates summarizeData function to explicitly set meta * updates and adds functions * updates predict function * adds classify() with meta * adds metadata handling and data functions * adds loadData with options in init * adds major updates to initiation and defaults * adds boolean flags to check status to configure nn * adds addData function to index * adds support for auto labeling inputs and outputs for blank nn * code cleanup and function name change * flattens array in cnvertRawToTensors * flattens inputs * flatten array always * adds isOneHotEncodedOrNormalized * updates predict and classify functions and output format * updates param handling in predict and classify * code cleanup * adds save function * code cleanup * adds first pass at loading data * fixes missing isNormalized flag in meta * moves loading functions to respective class * moves files to NeuralNetwork * moves files to NeuralNetwork and rm diyNN * rms console.log * check if metadata and warmedup are true before normalization * adds unnormalize function to nn predict * return unNormalized value * adds loadData() and changes to loadDataFromUrl * adds saveData to index * adds modelUrl to constructor options in index * cleans up predict and classify * fix reference to unNormalizeValue * code cleanup * adds looping to format data for prediction and predictMultiple and classifyMultiple * adds layer handling for options * adds tfvis to index and ml5 root * adds debug flag in options * adds vis and fixes input formatting" " * adds model summary * adds comments and reorders code * refactoring functions with 3 datatypes in mind: number, string, array * adds data handling updates * adds handling tensors * adds process up to training * fixes breaking training * adds full working poc * fix addData check * adds updates to api and notes to fix with functions * adds createMetadata in index * adds image handling in classify functino * adds method to not exceed call stack of min and max * fixes loadData issue * adds first header name for min and max * code cleanup * removes unused functions * fixes setDataRaw * code clean up, organization, and adds method binding to constructor * adds methods to constructor, adds comments, and cleans up * adds methods to constructor for nndata * adds methods to constructor, code cleanup, and organization * docs: add RaisinTen as a contributor (#751) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] * [neural network] adds first tests for neural network and placeholders (#755) * initial commit for nn test * sets karma testing random to false * adds tests for neuralnetwork class * adds placeholders for tests to do * docs: add LudwigStumpp as a contributor (#758) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] * fix(Docsify Configuration (docs/index.html)): Use Docsify's auto2top property to reset scroll positi (#761) * docs(feature-extractor.md): Switch the links for regression and classifications p5 editor examples i (#762) * docs: add bomanimc as a contributor (#763) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] Co-authored-by: Joey Lee <[email protected]> * fix: typo Co-authored-by: Joey Lee <[email protected]> Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> Co-authored-by: Bomani Oseni McClendon <[email protected]>
* [nn-refactor] Refactor and reimplementation of NeuralNetwork (#749) * adds temp DiyNeuralNetwork - refactoring NeuralNetwork class * adds updates to refactor * refactoring nn-refactor * adds features for compile and add layers * rm console log * adds train interface * adds basic predict * adds blank functions in data class * update nn class * adds nn compile handling * updates function name * adds data loading functions // todo - clean up * add recursive findEntries function and data loading functions * adds formatRawData function * adds .addData() function * adds saveData function * adds handling for onehot and counting input and output units " " * adds code comments * adds concat to this.meta * changed name to createMetaDataFromData" * adds convertRawToTensors * adds functions for calculating stats * adds normalization and conversion to tensor handling * adds .summarizeData * adds data handling to index * updates summarizeData function to explicitly set meta * updates and adds functions * updates predict function * adds classify() with meta * adds metadata handling and data functions * adds loadData with options in init * adds major updates to initiation and defaults * adds boolean flags to check status to configure nn * adds addData function to index * adds support for auto labeling inputs and outputs for blank nn * code cleanup and function name change * flattens array in cnvertRawToTensors * flattens inputs * flatten array always * adds isOneHotEncodedOrNormalized * updates predict and classify functions and output format * updates param handling in predict and classify * code cleanup * adds save function * code cleanup * adds first pass at loading data * fixes missing isNormalized flag in meta * moves loading functions to respective class * moves files to NeuralNetwork * moves files to NeuralNetwork and rm diyNN * rms console.log * check if metadata and warmedup are true before normalization * adds unnormalize function to nn predict * return unNormalized value * adds loadData() and changes to loadDataFromUrl * adds saveData to index * adds modelUrl to constructor options in index * cleans up predict and classify * fix reference to unNormalizeValue * code cleanup * adds looping to format data for prediction and predictMultiple and classifyMultiple * adds layer handling for options * adds tfvis to index and ml5 root * adds debug flag in options * adds vis and fixes input formatting" " * adds model summary * adds comments and reorders code * refactoring functions with 3 datatypes in mind: number, string, array * adds data handling updates * adds handling tensors * adds process up to training * fixes breaking training * adds full working poc * fix addData check * adds updates to api and notes to fix with functions * adds createMetadata in index * adds image handling in classify functino * adds method to not exceed call stack of min and max * fixes loadData issue * adds first header name for min and max * code cleanup * removes unused functions * fixes setDataRaw * code clean up, organization, and adds method binding to constructor * adds methods to constructor, adds comments, and cleans up * adds methods to constructor for nndata * adds methods to constructor, code cleanup, and organization * docs: add RaisinTen as a contributor (#751) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] * [neural network] adds first tests for neural network and placeholders (#755) * initial commit for nn test * sets karma testing random to false * adds tests for neuralnetwork class * adds placeholders for tests to do * docs: add LudwigStumpp as a contributor (#758) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] * fix(Docsify Configuration (docs/index.html)): Use Docsify's auto2top property to reset scroll positi (#761) * docs(feature-extractor.md): Switch the links for regression and classifications p5 editor examples i (#762) * docs: add bomanimc as a contributor (#763) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] Co-authored-by: Joey Lee <[email protected]> * fix: typo Co-authored-by: Joey Lee <[email protected]> Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> Co-authored-by: Bomani Oseni McClendon <[email protected]>
Dear ml5 community,
I'm making a Pull Request(PR). Please see the details below.
A good PR π
β Step 1: Which branch are you submitting to? π²
β Step 2: Describe your Pull Request π
Updates:
A great PR ππ
β Step 3: Share a Relevant Example π¦