{"id":35015640,"url":"https://github.com/mdda/pycon.sg-2015_deep-learning","last_synced_at":"2025-12-27T05:19:29.081Z","repository":{"id":33480165,"uuid":"37125890","full_name":"mdda/pycon.sg-2015_deep-learning","owner":"mdda","description":"2015 PyCon (SG) Presentation :: 2016 version is 'deep-learning-workshop'","archived":false,"fork":false,"pushed_at":"2016-06-26T15:19:08.000Z","size":3568,"stargazers_count":46,"open_issues_count":0,"forks_count":11,"subscribers_count":3,"default_branch":"master","last_synced_at":"2023-10-20T21:43:57.431Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mdda.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-09T10:32:45.000Z","updated_at":"2023-10-20T21:43:57.431Z","dependencies_parsed_at":"2022-09-12T21:51:52.293Z","dependency_job_id":null,"html_url":"https://github.com/mdda/pycon.sg-2015_deep-learning","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/mdda/pycon.sg-2015_deep-learning","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdda%2Fpycon.sg-2015_deep-learning","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdda%2Fpycon.sg-2015_deep-learning/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdda%2Fpycon.sg-2015_deep-learning/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdda%2Fpycon.sg-2015_deep-learning/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mdda","download_url":"https://codeload.github.com/mdda/pycon.sg-2015_deep-learning/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdda%2Fpycon.sg-2015_deep-learning/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28072870,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-27T02:00:05.897Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-12-27T05:19:28.019Z","updated_at":"2025-12-27T05:19:29.069Z","avatar_url":"https://github.com/mdda.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Machine Learning : Going Deeper with Python and Theano\n\nThis repo contains the materials for my presentation to PyCon (SG), on 19 June **2015**.\n\nIf you are interested in the wonderful Virtual Machine goodness of my 2016 PyCon presentation,\nthe repo you should be looking at is [this one](https://github.com/mdda/deep-learning-workshop).\n\n## Installation of requirements\n\nEven if you like to ```virtualenv```, it may make sense to use system-wide\ninstallations of some of the basic Python numerical packages, since \nthey're likely to be ready-optimized (even if slightly older) than ones \ninstalled/compiled by ```pip``` (which will willingly install without \n```OpenBLAS```, for instance) : \n\n```\ndnf install scipy numpy python-pandas Cython \n```\n\n(and, since it's so handy):\n\n```\ndnf install pydot\n```\n\nNote that installing ``python-ipython-notebook`` system-wide doesn't seem to work well,\nbecause there is a version conflict involving ``tornado``. \n\nThen, as usual (but making use of these system-site-packages) :\n\n```\nvirtualenv --system-site-packages env\n. env/bin/activate\npip install --upgrade pip\npip install -r requirements.txt \n\n# Wait 10mins (107Mb of stuff in env/lib/python2.7/site-packages/)\n```\n\n## Running the Presentation \n\nStarting at the live-plotting example (which will also want ``bokeh-server`` running, see below) :\n\n```\n. env/bin/activate\nipython notebook ipynb/1-LivePlotting.ipynb\n\n# Then open a browser at : http://localhost:8888/\n# or, more specifically  : http://localhost:8888/ipynb/1-LivePlotting.ipynb\n```\n\nIf you have a browser already running, it may be best to use the ``--browser`` option to prevent the distracting launch of an additional browser window:\n```\nipython notebook --port=8888 --browser=none\n```\n\nTo run the live-plotting example, you'll also need to start the \n``bokeh-server`` in another process :\n\n```\n. env/bin/activate\nbokeh-server\n```\n\n### Running the Presentation (across a network)\n\n```\n. env/bin/activate\nipython notebook --ip=0.0.0.0 --port=8888 --browser=none \u0026\nbokeh-server --ip=0.0.0.0 --port=8889\n```\nThe iPython notebook call to ``bokeh.io.output_notebook()`` appears \nto find the correct port for the ``bokeh-server`` automagically.\n\nRemember to adjust the firewall to allow these two open ports...\n\n### GPU-aware iPython\n\n#### Laptop \n\nMaking use of an Nvidia card in a notebook (where ``COMMAND-LINE`` is \nthe ``python`` command that one would ordinarily run) is usually as follows ::\n\n```\nTHEANORC=theano.cuda-gpuarray.rc optirun {COMMAND-LINE}\n```\n\nHowever, because IPython spawns sub-processes to handle each kernel/notebook,\nthe ``optirun`` invocation isn't made for the child processes that should actually\nperform the work on the GPU.  \n\nSo far, the only route to making this work has been to replace the \n``env/bin/python2`` with a script that runs ``optirun python2-bin`` where \n``python2-bin`` is a copy of the previously existing ``python2``.  But doing this\nthe causes all python (in that ``virtualenv``) to switch the GPU on, which \nwasn't really the plan.\n\n\n\n### Notes : Git-friendly iPython Notebooks\n\nUsing the code from : http://pascalbugnion.net/blog/ipython-notebooks-and-git.html (and\nhttps://gist.github.com/pbugnion/ea2797393033b54674af ), \nyou can enable this kind of feature just on one repository, \nrather than installing it globally, as follows...\n\nWithin the repository, run : \n```\n# Set the permissions for execution :\nchmod 754 ./bin/ipynb_optional_output_filter.py\n\ngit config filter.dropoutput_ipynb.smudge cat\ngit config filter.dropoutput_ipynb.clean ./bin/ipynb_optional_output_filter.py\n```\nthis will add suitable entries to ``./.git/config``.\n\nor, alternatively, create the entries manually by ensuring that your ``.git/config`` includes the lines :\n```\n[filter \"dropoutput_ipynb\"]\n\tsmudge = cat\n\tclean = ./bin/ipynb_output_filter.py\n```\n(where ``REPO`` is the absolute path to the root of the checked out repository).\n\n\nNote also that there's a ``\u003cREPO\u003e/.gitattributes`` file here containing the following:\n```\n*.ipynb    filter=dropoutput_ipynb\n```\n\nThere are two different approaches to doing the cleansing in the ``REPO/bin`` directory : \n\n* ``ipynb_output_filter.py`` : which is probably more comprehensive, since it uses iPython itself\n  to parse and output the notebooks - but care must be taken to ensure that it is run within the current ``env``\n  \n* ``ipynb_optional_output_filter.py`` : This is my current chosen approach, which only uses\n  ``import json`` to parse the notebook files (and so can be executed as a plain script).  It \n  also includes the ``git:suppress_outputs=false`` option that might be useful...\n\nTo include disable the output-cleansing feature in a notebook in the latter case, \nsimply add to its metadata (Edit-Metadata) as a first-level entry (``true`` is the default): \n\n```\n  \"git\" : { \"suppress_outputs\" : false },\n```\n\n### Notes : Building the Presentation\n\nFor 'blocks-introduction-mnist.ipynb' I used the tutorial \nfrom the ``blocks`` documentation as a starter :\n\n* ```wget https://raw.githubusercontent.com/mila-udem/blocks/master/docs/tutorial.rst```\n* ```pandoc --mathjax --from=rst --to=markdown_mmd tutorial.rst \u003e tutorial.md```\n\nAlso useful :\n\n* [MathJax](http://nbviewer.ipython.org/github/olgabot/ipython/blob/master/examples/Notebook/Typesetting%20Math%20Using%20MathJax.ipynb)\n* [Bokeh](http://bokeh.pydata.org/en/latest/docs/quickstart.html)\n\n\n\n### Notes : Installing PyGPU\n\nOn the date of the PyCon, building the ``libgpuarray`` library from github FAILS : \n```\nNOW DONE - submitted a PR for : \n           https://github.com/Theano/libgpuarray/issues/55\n           \"\"\" gcc 5.1.1 : max_align_t also defined in stddef.h \"\"\"\n```\n\nThere is a full write-up on how to install an Nvidia GPU under Fedora 22 \nas a [blog posting](http://blog.mdda.net/oss/2015/07/07/nvidia-on-fedora-22/)\n\nAnd an additional write-up for the case that you're installing to a laptop\nwith 'dual graphics cards' \nin [this blog post](http://blog.mdda.net/oss/2015/06/20/nvidia-on-fedora-22-laptop/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdda%2Fpycon.sg-2015_deep-learning","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmdda%2Fpycon.sg-2015_deep-learning","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdda%2Fpycon.sg-2015_deep-learning/lists"}