-
Notifications
You must be signed in to change notification settings - Fork 941
Write a tutorial for deeplearn.js #15
Conversation
This tutorial takes the reader through making a model to predict the complements of colors within RGB space. We make a simple feed forward network with 3 fully-connected layers.
| @@ -0,0 +1,194 @@ | |||
| # Predicting Complementary Colors with deeplearn.js | |||
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.
Keep this file in demos/complementary-color-prediction/ - doesn't have to be in docs/tutorials. The website will pick it up and show it on the right side in https://pair-code.github.io/deeplearnjs/docs/tutorials/index.html automatically
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.
Done.
| @@ -0,0 +1,136 @@ | |||
| <!-- Copyright 2017 Google Inc. All Rights Reserved. | |||
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.
Can you run the demo using watch-demo and share the url with us? Thanks!
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.
Done.
| @@ -0,0 +1,355 @@ | |||
| /* Copyright 2017 Google Inc. All Rights Reserved. | |||
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.
Reminder to run npm run lint to check for lint errors. Thanks for your patience before we automate this with travis CI.
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 get this output
agent007@agent007:~/deeplearnjs$ npm run lint
deeplearn@0.1.0 lint /usr/home/agent007/deeplearnjs
tslint -p . --type-check -t verboseERROR: (no-any) /usr/home/agent007/deeplearnjs/demos/homepage/index.ts[30, 63]: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type, the empty type ('{}'), or suppress this occurrence.
ERROR: (triple-equals) /usr/home/agent007/deeplearnjs/demos/homepage/index.ts[21, 28]: != should be !==npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! deeplearn@0.1.0 lint:tslint -p . --type-check -t verbose
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the deeplearn@0.1.0 lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.npm ERR! A complete log of this run can be found in:
npm ERR! /usr/home/agent007/.npm/_logs/2017-08-09T08_43_14_372Z-debug.log
|
Reviewed 2 of 6 files at r2, 1 of 2 files at r3. npm-debug.log, line 1 at r4 (raw file):
revert this file demos/.DS_Store, line 0 at r4 (raw file): demos/complementary-color-prediction/complementary-color-prediction.html, line 11 at r4 (raw file):
reduce last line of license to 80 width demos/complementary-color-prediction/complementary-color-prediction.ts, line 1 at r1 (raw file): Previously, chihuahua (Chi Zeng) wrote…
Did you run demos/complementary-color-prediction/complementary_color_prediction.md, line 3 at r4 (raw file):
maybe elaborate a bit on this. Are you thinking about hyper-params or not optimized for speed (not using the library in the best way)? If hyper-params, you can say smth like demos/complementary-color-prediction/complementary_color_prediction.md, line 271 at r4 (raw file):
Remove TODO and update the link now? Since it will get checked in this PR. demos/complementary-color-prediction/complementary_color_prediction.md, line 274 at r4 (raw file):
s/offer/offers/ (might be wrong, feel free to ignore) Comments from Reviewable |
Also modified .gitignore to avoid re-adding them.
|
Review status: 2 of 5 files reviewed at latest revision, 7 unresolved discussions, some commit checks failed. demos/complementary-color-prediction/complementary-color-prediction.html, line 11 at r4 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Done. Moved closing comment tag to the next line. demos/complementary-color-prediction/complementary-color-prediction.ts, line 1 at r1 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Indeed, version 2.3.4 ... agent007@agent007:~/Desktop/deeplearnjs$ node_modules/.bin/tsc --version I did run demos/complementary-color-prediction/complementary_color_prediction.md, line 3 at r4 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Done. Right - I meant that this tutorial did not optimize for hyperparameters (number of layers, sizes of layers). If you have any feedback on using the library better - let me know! demos/complementary-color-prediction/complementary_color_prediction.md, line 271 at r4 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
I removed the TODO and verified that the markdown should look correct: The markdown preview currently does not show the image because the URL is relative to the PAIR-code organization, and the image has not yet been checked into the PAIR-code/deeplearnjs repo yet. demos/complementary-color-prediction/complementary_color_prediction.md, line 274 at r4 (raw file):
Also, to avoid bloating this tutorial, I sort of glossed over the logic for managing the UI. That also makes the tutorial focus on deeplearn.js. Let me know if you have thoughts on that. npm-debug.log, line 1 at r4 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Done. demos/.DS_Store, line at r4 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Done. Comments from Reviewable |
|
Reviewed 3 of 6 files at r2, 1 of 1 files at r4, 5 of 5 files at r5. demos/complementary-color-prediction/complementary_color_prediction.md, line 271 at r4 (raw file): Previously, chihuahua (Chi Zeng) wrote…
I think you can do relative paths in markdown links, .e.g demos/complementary-color-prediction/complementary_color_prediction.md, line 274 at r4 (raw file): Previously, chihuahua (Chi Zeng) wrote…
I think it's good. Short and sweet. We can get feedback from our users and improve later. Comments from Reviewable |
|
Review status: 3 of 5 files reviewed at latest revision, all discussions resolved, some commit checks failed. demos/complementary-color-prediction/complementary_color_prediction.md, line 271 at r4 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Indeed, relative links work! Done. Comments from Reviewable |
|
I modified relative links. Feel free to merge at any time. One problem I realized is that, sometimes, certain weight values are initialized to 0, and then those color channels just stay at 0. Like this: I so far lack a solution for this. Refreshing the page usually allows for normal training, but it's unfortunate that initialization of weights matters. |
|
Ha, that's very interesting about the weights going to 0. Wohoo, thanks for writing this awesome tutorial! |
* Write a tutorial for deeplearn.js This tutorial takes the reader through making a model to predict the complements of colors within RGB space. We make a simple feed forward network with 3 fully-connected layers. * . * Finish md * Update TOC * Update complementary_color_prediction.md * Remove npm-debug.log and .DS_Store Also modified .gitignore to avoid re-adding them. * Address comments * Change image URL * Move comment closing tag to next line * Make png link relative * Remove unused imports * Make links relative * Describe problem of channel stuck at 0 * . * .
[Mulmat] register flags for matmul



This tutorial takes the reader through making a model to predict the complements of colors within RGB space. We make a simple feed forward network with 3 fully-connected layers.
This change is