Change copy functions over to use (de)serialization feature#98
Change copy functions over to use (de)serialization feature#98enginefeeder101 wants to merge 3 commits intoCodingTrain:masterfrom
Conversation
The (de)serialzation functions already have all the code needed to make a deep copy of the NeuralNetwork. This commit also adds a test for the `Matrix.copy()` function. This also copies the learning rate and if CodingTrain#97 is merged the activation function is copied as well.
shiffman
left a comment
There was a problem hiding this comment.
Ah, of course, thank you for this! While I agree this has its advantages, I think I might like to hold off on merging until I make a video discussing serialize and deserialize? I'm conflicted on how to handle these improvements which are excellent but then result in the code not matching the video tutorials. Maybe after I get through my examples I can merge a lot of these and make a single video going over the improvements.
| expect(n).toEqual({ | ||
| rows: m.rows, | ||
| cols: m.cols, | ||
| data: m.data |
There was a problem hiding this comment.
will this work? Won't we have to check the values of the arrays themselves as opposed to the data reference?
There was a problem hiding this comment.
Actually expect(n).toEqual(m); works as well 😆
There was a problem hiding this comment.
Oh cool! So Jest does something like a "deep" comparison behind the scenes?
|
If you want to submit the unit tests separately I can merge that now. |
|
I pushed PR #99 including just the test so you can merge those. |
Copy tests are implemented in CodingTrain#99. Therefore removed from this branch to be able to merge this neatly.
|
I removed the added tests (see #99) from this branch to allow you to smoothly merge his PR. |

The (de)serialzation functions already have all the code needed to make a deep copy
of the NeuralNetwork. This commit also adds a test for the
Matrix.copy()function.This also copies the learning rate and if #97 is merged the activation function is
copied as well.