carlfeynman commited on
Commit
8edb87f
1 Parent(s): 68abbc3

notebook cleaned

Browse files
Files changed (1) hide show
  1. mnist_classifier.ipynb +4 -291
mnist_classifier.ipynb CHANGED
@@ -315,7 +315,7 @@
315
  },
316
  {
317
  "cell_type": "code",
318
- "execution_count": 1,
319
  "metadata": {
320
  "tags": [
321
  "exclude"
@@ -326,304 +326,17 @@
326
  "name": "stdout",
327
  "output_type": "stream",
328
  "text": [
329
- "[NbConvertApp] WARNING | pattern 'mnist.ipynb' matched no files\n",
330
- "This application is used to convert notebook files (*.ipynb)\n",
331
- " to various other formats.\n",
332
- "\n",
333
- " WARNING: THE COMMANDLINE INTERFACE MAY CHANGE IN FUTURE RELEASES.\n",
334
- "\n",
335
- "Options\n",
336
- "=======\n",
337
- "The options below are convenience aliases to configurable class-options,\n",
338
- "as listed in the \"Equivalent to\" description-line of the aliases.\n",
339
- "To see all configurable class-options for some <cmd>, use:\n",
340
- " <cmd> --help-all\n",
341
- "\n",
342
- "--debug\n",
343
- " set log level to logging.DEBUG (maximize logging output)\n",
344
- " Equivalent to: [--Application.log_level=10]\n",
345
- "--show-config\n",
346
- " Show the application's configuration (human-readable format)\n",
347
- " Equivalent to: [--Application.show_config=True]\n",
348
- "--show-config-json\n",
349
- " Show the application's configuration (json format)\n",
350
- " Equivalent to: [--Application.show_config_json=True]\n",
351
- "--generate-config\n",
352
- " generate default config file\n",
353
- " Equivalent to: [--JupyterApp.generate_config=True]\n",
354
- "-y\n",
355
- " Answer yes to any questions instead of prompting.\n",
356
- " Equivalent to: [--JupyterApp.answer_yes=True]\n",
357
- "--execute\n",
358
- " Execute the notebook prior to export.\n",
359
- " Equivalent to: [--ExecutePreprocessor.enabled=True]\n",
360
- "--allow-errors\n",
361
- " Continue notebook execution even if one of the cells throws an error and include the error message in the cell output (the default behaviour is to abort conversion). This flag is only relevant if '--execute' was specified, too.\n",
362
- " Equivalent to: [--ExecutePreprocessor.allow_errors=True]\n",
363
- "--stdin\n",
364
- " read a single notebook file from stdin. Write the resulting notebook with default basename 'notebook.*'\n",
365
- " Equivalent to: [--NbConvertApp.from_stdin=True]\n",
366
- "--stdout\n",
367
- " Write notebook output to stdout instead of files.\n",
368
- " Equivalent to: [--NbConvertApp.writer_class=StdoutWriter]\n",
369
- "--inplace\n",
370
- " Run nbconvert in place, overwriting the existing notebook (only\n",
371
- " relevant when converting to notebook format)\n",
372
- " Equivalent to: [--NbConvertApp.use_output_suffix=False --NbConvertApp.export_format=notebook --FilesWriter.build_directory=]\n",
373
- "--clear-output\n",
374
- " Clear output of current file and save in place,\n",
375
- " overwriting the existing notebook.\n",
376
- " Equivalent to: [--NbConvertApp.use_output_suffix=False --NbConvertApp.export_format=notebook --FilesWriter.build_directory= --ClearOutputPreprocessor.enabled=True]\n",
377
- "--no-prompt\n",
378
- " Exclude input and output prompts from converted document.\n",
379
- " Equivalent to: [--TemplateExporter.exclude_input_prompt=True --TemplateExporter.exclude_output_prompt=True]\n",
380
- "--no-input\n",
381
- " Exclude input cells and output prompts from converted document.\n",
382
- " This mode is ideal for generating code-free reports.\n",
383
- " Equivalent to: [--TemplateExporter.exclude_output_prompt=True --TemplateExporter.exclude_input=True --TemplateExporter.exclude_input_prompt=True]\n",
384
- "--allow-chromium-download\n",
385
- " Whether to allow downloading chromium if no suitable version is found on the system.\n",
386
- " Equivalent to: [--WebPDFExporter.allow_chromium_download=True]\n",
387
- "--disable-chromium-sandbox\n",
388
- " Disable chromium security sandbox when converting to PDF..\n",
389
- " Equivalent to: [--WebPDFExporter.disable_sandbox=True]\n",
390
- "--show-input\n",
391
- " Shows code input. This flag is only useful for dejavu users.\n",
392
- " Equivalent to: [--TemplateExporter.exclude_input=False]\n",
393
- "--embed-images\n",
394
- " Embed the images as base64 dataurls in the output. This flag is only useful for the HTML/WebPDF/Slides exports.\n",
395
- " Equivalent to: [--HTMLExporter.embed_images=True]\n",
396
- "--sanitize-html\n",
397
- " Whether the HTML in Markdown cells and cell outputs should be sanitized..\n",
398
- " Equivalent to: [--HTMLExporter.sanitize_html=True]\n",
399
- "--log-level=<Enum>\n",
400
- " Set the log level by value or name.\n",
401
- " Choices: any of [0, 10, 20, 30, 40, 50, 'DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL']\n",
402
- " Default: 30\n",
403
- " Equivalent to: [--Application.log_level]\n",
404
- "--config=<Unicode>\n",
405
- " Full path of a config file.\n",
406
- " Default: ''\n",
407
- " Equivalent to: [--JupyterApp.config_file]\n",
408
- "--to=<Unicode>\n",
409
- " The export format to be used, either one of the built-in formats\n",
410
- " ['asciidoc', 'custom', 'html', 'latex', 'markdown', 'notebook', 'pdf', 'python', 'qtpdf', 'qtpng', 'rst', 'script', 'slides', 'webpdf']\n",
411
- " or a dotted object name that represents the import path for an\n",
412
- " ``Exporter`` class\n",
413
- " Default: ''\n",
414
- " Equivalent to: [--NbConvertApp.export_format]\n",
415
- "--template=<Unicode>\n",
416
- " Name of the template to use\n",
417
- " Default: ''\n",
418
- " Equivalent to: [--TemplateExporter.template_name]\n",
419
- "--template-file=<Unicode>\n",
420
- " Name of the template file to use\n",
421
- " Default: None\n",
422
- " Equivalent to: [--TemplateExporter.template_file]\n",
423
- "--theme=<Unicode>\n",
424
- " Template specific theme(e.g. the name of a JupyterLab CSS theme distributed\n",
425
- " as prebuilt extension for the lab template)\n",
426
- " Default: 'light'\n",
427
- " Equivalent to: [--HTMLExporter.theme]\n",
428
- "--sanitize_html=<Bool>\n",
429
- " Whether the HTML in Markdown cells and cell outputs should be sanitized.This\n",
430
- " should be set to True by nbviewer or similar tools.\n",
431
- " Default: False\n",
432
- " Equivalent to: [--HTMLExporter.sanitize_html]\n",
433
- "--writer=<DottedObjectName>\n",
434
- " Writer class used to write the\n",
435
- " results of the conversion\n",
436
- " Default: 'FilesWriter'\n",
437
- " Equivalent to: [--NbConvertApp.writer_class]\n",
438
- "--post=<DottedOrNone>\n",
439
- " PostProcessor class used to write the\n",
440
- " results of the conversion\n",
441
- " Default: ''\n",
442
- " Equivalent to: [--NbConvertApp.postprocessor_class]\n",
443
- "--output=<Unicode>\n",
444
- " Overwrite base name use for output files.\n",
445
- " Supports pattern replacements '{notebook_name}'.\n",
446
- " Default: '{notebook_name}'\n",
447
- " Equivalent to: [--NbConvertApp.output_base]\n",
448
- "--output-dir=<Unicode>\n",
449
- " Directory to write output(s) to. Defaults\n",
450
- " to output to the directory of each notebook. To recover\n",
451
- " previous default behaviour (outputting to the current\n",
452
- " working directory) use . as the flag value.\n",
453
- " Default: ''\n",
454
- " Equivalent to: [--FilesWriter.build_directory]\n",
455
- "--reveal-prefix=<Unicode>\n",
456
- " The URL prefix for reveal.js (version 3.x).\n",
457
- " This defaults to the reveal CDN, but can be any url pointing to a copy\n",
458
- " of reveal.js.\n",
459
- " For speaker notes to work, this must be a relative path to a local\n",
460
- " copy of reveal.js: e.g., \"reveal.js\".\n",
461
- " If a relative path is given, it must be a subdirectory of the\n",
462
- " current directory (from which the server is run).\n",
463
- " See the usage documentation\n",
464
- " (https://nbconvert.readthedocs.io/en/latest/usage.html#reveal-js-html-slideshow)\n",
465
- " for more details.\n",
466
- " Default: ''\n",
467
- " Equivalent to: [--SlidesExporter.reveal_url_prefix]\n",
468
- "--nbformat=<Enum>\n",
469
- " The nbformat version to write.\n",
470
- " Use this to downgrade notebooks.\n",
471
- " Choices: any of [1, 2, 3, 4]\n",
472
- " Default: 4\n",
473
- " Equivalent to: [--NotebookExporter.nbformat_version]\n",
474
- "\n",
475
- "Examples\n",
476
- "--------\n",
477
- "\n",
478
- " The simplest way to use nbconvert is\n",
479
- "\n",
480
- " > jupyter nbconvert mynotebook.ipynb --to html\n",
481
- "\n",
482
- " Options include ['asciidoc', 'custom', 'html', 'latex', 'markdown', 'notebook', 'pdf', 'python', 'qtpdf', 'qtpng', 'rst', 'script', 'slides', 'webpdf'].\n",
483
- "\n",
484
- " > jupyter nbconvert --to latex mynotebook.ipynb\n",
485
- "\n",
486
- " Both HTML and LaTeX support multiple output templates. LaTeX includes\n",
487
- " 'base', 'article' and 'report'. HTML includes 'basic', 'lab' and\n",
488
- " 'classic'. You can specify the flavor of the format used.\n",
489
- "\n",
490
- " > jupyter nbconvert --to html --template lab mynotebook.ipynb\n",
491
- "\n",
492
- " You can also pipe the output to stdout, rather than a file\n",
493
- "\n",
494
- " > jupyter nbconvert mynotebook.ipynb --stdout\n",
495
- "\n",
496
- " PDF is generated via latex\n",
497
- "\n",
498
- " > jupyter nbconvert mynotebook.ipynb --to pdf\n",
499
- "\n",
500
- " You can get (and serve) a Reveal.js-powered slideshow\n",
501
- "\n",
502
- " > jupyter nbconvert myslides.ipynb --to slides --post serve\n",
503
- "\n",
504
- " Multiple notebooks can be given at the command line in a couple of\n",
505
- " different ways:\n",
506
- "\n",
507
- " > jupyter nbconvert notebook*.ipynb\n",
508
- " > jupyter nbconvert notebook1.ipynb notebook2.ipynb\n",
509
- "\n",
510
- " or you can specify the notebooks list in a config file, containing::\n",
511
- "\n",
512
- " c.NbConvertApp.notebooks = [\"my_notebook.ipynb\"]\n",
513
- "\n",
514
- " > jupyter nbconvert --config mycfg.py\n",
515
- "\n",
516
- "To see all available configurables, use `--help-all`.\n",
517
- "\n"
518
  ]
519
  }
520
  ],
521
  "source": [
522
  "# !jupyter nbconvert --to script mnist.ipynb\n",
523
- "!jupyter nbconvert --to script --TagRemovePreprocessor.remove_cell_tags=\"exclude\" --TemplateExporter.exclude_input_prompt=True mnist.ipynb\n",
524
  "\n"
525
  ]
526
  },
527
- {
528
- "cell_type": "code",
529
- "execution_count": null,
530
- "metadata": {
531
- "tags": [
532
- "exclude"
533
- ]
534
- },
535
- "outputs": [],
536
- "source": [
537
- "# from IPython.display import HTML, display, Image\n",
538
- "# %%html\n",
539
- "# <style>\n",
540
- "# #whiteboard {\n",
541
- "# border: 3px solid black;\n",
542
- "# border-radius: 6px; \n",
543
- "# background-color: #FFFFFF;\n",
544
- "# }\n",
545
- "# #capture-button {\n",
546
- "# background-color: #3F52D9; \n",
547
- "# color: white;\n",
548
- "# border: none;\n",
549
- "# padding: 10px 20px;\n",
550
- "# cursor: pointer;\n",
551
- "# font-size: 16px;\n",
552
- "# border-radius: 3px;\n",
553
- "# margin-top: 10px;\n",
554
- "# width: 190px;\n",
555
- "# margin-right: 20px;\n",
556
- "# }\n",
557
- "# #clear-button {\n",
558
- "# background-color: #FF0000,; \n",
559
- "# color: black;\n",
560
- "# border: none;\n",
561
- "# padding: 10px 20px;\n",
562
- "# cursor: pointer;\n",
563
- "# font-size: 16px;\n",
564
- "# border-radius: 3px;\n",
565
- "# margin-top: 10px;\n",
566
- "# width: 190px;\n",
567
- "# }\n",
568
- "# #container {\n",
569
- "# display: flex;\n",
570
- "# flex-direction: column; /* Arrange children vertically */\n",
571
- "# align-items: center; /* Center horizontally */\n",
572
- "# justify-content: center;\n",
573
- "# }\n",
574
- "# #btn-container {\n",
575
- "# display: flex;\n",
576
- "# flex-direction: row; /* Arrange children vertically */\n",
577
- "# align-items: center; /* Center horizontally */\n",
578
- "# }\n",
579
- "\n",
580
- "# </style>\n",
581
- "# <div id='container'>\n",
582
- "# <canvas id=\"whiteboard\" width=\"400\" height=\"200\" fill_rect='white'></canvas>\n",
583
- "# <div id='btn-container'>\n",
584
- "# <button id=\"capture-button\">Predict</button>\n",
585
- "# <button id=\"clear-button\">Clear</button>\n",
586
- "# </div>\n",
587
- "\n",
588
- "# </div>\n",
589
- "# <script>\n",
590
- "# var canvas = document.getElementById('whiteboard');\n",
591
- "# var context = canvas.getContext('2d');\n",
592
- "# var drawing = false;\n",
593
- "# canvas.addEventListener('mousedown', function (e) {\n",
594
- "# drawing = true;\n",
595
- "# context.beginPath();\n",
596
- "# context.moveTo(e.clientX - canvas.getBoundingClientRect().left, e.clientY - canvas.getBoundingClientRect().top);\n",
597
- "# });\n",
598
- "# canvas.addEventListener('mousemove', function (e) {\n",
599
- "# if (drawing) {\n",
600
- "# context.lineTo(e.clientX - canvas.getBoundingClientRect().left, e.clientY - canvas.getBoundingClientRect().top);\n",
601
- "# context.stroke();\n",
602
- "# }\n",
603
- "# });\n",
604
- "# canvas.addEventListener('mouseup', function () {\n",
605
- "# drawing = false;\n",
606
- "# });\n",
607
- "# canvas.addEventListener('mouseout', function () {\n",
608
- "# drawing = false;\n",
609
- "# });\n",
610
- " \n",
611
- "# var clearButton = document.getElementById('clear-button');\n",
612
- "# clearButton.addEventListener('click', function () {\n",
613
- "# context.clearRect(0, 0, canvas.width, canvas.height);\n",
614
- "# });\n",
615
- "\n",
616
- "# var captureButton = document.getElementById('capture-button');\n",
617
- "# captureButton.addEventListener('click', function () {\n",
618
- "# // Convert the canvas content to a data URL (image)\n",
619
- "# var imageData = canvas.toDataURL(\"image/png\");\n",
620
- "\n",
621
- "# // Send the image data to the Jupyter kernel variable\n",
622
- "# IPython.notebook.kernel.execute('image_data = \"' + imageData + '\"');\n",
623
- "# });\n",
624
- "# </script>\n"
625
- ]
626
- },
627
  {
628
  "cell_type": "code",
629
  "execution_count": null,
 
315
  },
316
  {
317
  "cell_type": "code",
318
+ "execution_count": 3,
319
  "metadata": {
320
  "tags": [
321
  "exclude"
 
326
  "name": "stdout",
327
  "output_type": "stream",
328
  "text": [
329
+ "[NbConvertApp] Converting notebook mnist_classifier.ipynb to script\n",
330
+ "[NbConvertApp] Writing 4263 bytes to mnist_classifier.py\n"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
331
  ]
332
  }
333
  ],
334
  "source": [
335
  "# !jupyter nbconvert --to script mnist.ipynb\n",
336
+ "!jupyter nbconvert --to script --TagRemovePreprocessor.remove_cell_tags=\"exclude\" --TemplateExporter.exclude_input_prompt=True mnist_classifier.ipynb\n",
337
  "\n"
338
  ]
339
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
340
  {
341
  "cell_type": "code",
342
  "execution_count": null,