This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ~ 50-character subject line ~ | |
| ~ 72-character wrapped longer description. ~ | |
| # Description of why, not how. | |
| # Feel free to be detailed. | |
| # nano: use `ctrl+c` to get line/character position |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # this script installs GCC 4.9.4 | |
| # to use it navigate to your home directory and type: | |
| # sh install-gcc-4.9.4.sh | |
| # download and install gcc 4.9.4 | |
| wget https://ftp.gnu.org/gnu/gcc/gcc-4.9.4/gcc-4.9.4.tar.gz | |
| tar xzf gcc-4.9.4.tar.gz | |
| cd gcc-4.9.4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy | |
| print('numpy.__version__') | |
| print(numpy.__version__) | |
| import theano | |
| print('theano.__version__') | |
| print(theano.__version__) | |
| import tensorflow | |
| print('tensorflow.__version__') | |
| print(tensorflow.__version__) | |
| import keras |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| description "Jupyter Upstart script" | |
| start on filesystem or runlevel [2345] | |
| stop on shutdown | |
| script | |
| export HOME="/home/shay" cd $HOME/ | |
| echo $$ > /var/run/jupyter_start.pid | |
| #exec jupyter-notebook --config='$HOME/.jupyter/jupyter_notebook.config.py' | |
| #exec ipython notebook |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ''' | |
| trying keras to be random seeded | |
| Switch backends by changin ~/.keras/keras.json: | |
| Theano: https://drive.google.com/open?id=0B-FcStylmYuVU1E5S25QX2JXcGs | |
| TensorFlow: https://drive.google.com/open?id=0B-FcStylmYuVNnpfZERoeUo0QnM | |
| Keras Backend: | |
| *Theano (1 epoch, GPU): | |
| Test loss: 0.111780489241 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import time | |
| from timeit import default_timer as timer | |
| from datetime import timedelta | |
| t_start = timer() | |
| time.sleep(1) | |
| #print(timer()-t_start) | |
| print(timedelta(seconds=timer()-t_start)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # revisiting the XOR and donut problems to show how features | |
| # can be learned automatically using neural networks. | |
| # | |
| # the notes for this class can be found at: | |
| # https://www.udemy.com/data-science-deep-learning-in-python | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| # for binary classification! no softmax here |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #OBSOLETE: | |
| #http://stackoverflow.com/questions/32565829/simple-way-to-measure-cell-execution-time-in-ipython-notebook | |
| #%install_ext https://raw.github.com/cpcloud/ipython-autotime/master/autotime.py | |
| #use: pip install ipython-autotime | |
| %load_ext autotime |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os,random | |
| os.environ["KERAS_BACKEND"] = "theano" | |
| os.environ["THEANO_FLAGS"] = "device=gpu,lib.cnmem=0.6" | |
| #os.environ["THEANO_FLAGS"] = "device=cpu" | |
| !nvidia-smi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function [ret] = translate(value, leftMin, leftMax, rightMin, rightMax) | |
| % Figure out how 'wide' each range is | |
| leftSpan = leftMax - leftMin; | |
| rightSpan = rightMax - rightMin; | |
| % Convert the left range into a 0-1 range (float) | |
| valueScaled = (value - leftMin) / (leftSpan); | |
| % Convert the 0-1 range into a value in the right range. | |
| ret = rightMin + (valueScaled * rightSpan); |