Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| from pylab import * | |
| from scipy.ndimage import measurements | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| import time | |
| import sys | |
| import signal | |
| def signal_handler(signal, frame): | |
| sys.exit(0) |
Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.
In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.
Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j
The following recipes are sampled from a trained neural net. You can find the repo to train your own neural net here: https://github.com/karpathy/char-rnn Thanks to Andrej Karpathy for the great code! It's really easy to setup.
The recipes I used for training the char-rnn are from a recipe collection called ffts.com And here is the actual zipped data (uncompressed ~35 MB) I used for training. The ZIP is also archived @ archive.org in case the original links becomes invalid in the future.
In this gist I'm going to list all the concept I need to learn for starting with tensorflow. This list is being made while reading official documentation.
tf.Session()tf.constant()tf.placeholder()sess.run( , feed_dict = { } )| import tensorflow as tf | |
| import numpy as np | |
| from tensorflow.examples.tutorials.mnist import input_data | |
| mnist = input_data.read_data_sets("/tmp/data/", one_hot=True) | |
| x = tf.placeholder("float", [None, 784]) #mnist data image of shape 28*28*784 | |
| y = tf.placeholder("float", [None, 10]) #0-9 digits recognition | |
| #Create model |
| import cv2 | |
| import numpy as np | |
| import tensorflow as tf | |
| import tensorflow.examples.tutorials.mnist.input_data as input_data | |
| def init_weights(shape): | |
| return tf.Variable(tf.random_normal(shape, stddev=0.01)) | |
| def model(X, w_h, w_o): |