Package: gradientzoo
This is a Python library for Gradientzoo’s API - Version and share your trained
neural network models.  Loading a pre-trained neural network is easy with
Gradientzoo. Here’s how easy it is to load a model with Tensorflow (full
example below):importtensorflowastffromgradientzoo.tensorflowimportTensorflowGradientzoo# (build MNIST graph here)withtf.Session()assess:# Load latest weights from GradientzooTensorflowGradientzoo('ericflo/mnist').load(sess)# Graph is now ready to use!Saving models is similarly straightforward:importtensorflowastffromgradientzooimportTensorflowGradientzoo# (build MNIST graph here)withtf.Session()assess:forepochinxrange(6):# Train the model...# Save the updated weights out to GradientzooTensorflowGradientzoo('ericflo/mnist').save(sess)FeaturesSupports saving models inKeras, variables inTensorflow, and networks inLasagne, and regular old files using Python with your framework of choice.InstallationYou don’t need this source code unless you want to modify the
package. If you just want to use the Gradientzoo Python bindings, you
should run:pip install –upgrade gradientzoooreasy_install –upgrade gradientzooSeehttp://www.pip-installer.org/en/latest/index.htmlfor instructions
on installing pip. If you are on a system with easy_install but not
pip, you can use easy_install instead. If you’re not using virtualenv,
you may have to prefix those commands withsudo. You can learn more
about virtualenv athttp://www.virtualenv.org/To install from source, run:python setup.py installDocumentationPlease seehttp://python-gradientzoo.readthedocs.org/for the most up-to-date
documentation or visit a project page to see project-specific instructions,
e.g.https://www.gradientzoo.com/ericflo/mnistSetting up a Gradientzoo AccountSign up for Gradientzoo athttps://www.gradientzoo.com/registerContributeIssue Tracker:https://github.com/gradientzoo/python-gradientzoo/issuesSource Code:https://github.com/gradientzoo/python-gradientzooSupportIf you are having issues, please let us know atsupport@gradientzoo.comFull Tensorflow Exampleimporttensorflowastffromtensorflow.examples.tutorials.mnistimportinput_data,mnistfromgradientzoo.tensorflowimportTensorflowGradientzoolearning_rate=0.01batch_size=100# Build MNIST graphimages_placeholder=tf.placeholder(tf.float32,shape=(batch_size,mnist.IMAGE_PIXELS))labels_placeholder=tf.placeholder(tf.int32,shape=(batch_size))logits=mnist.inference(images_placeholder,128,32)loss=mnist.loss(logits,labels_placeholder)train_op=mnist.training(loss,learning_rate)eval_correct=mnist.evaluation(logits,labels_placeholder)# Start a Tensorflow sessionwithtf.Session()assess:# Load latest weights from GradientzooTensorflowGradientzoo('ericflo/mnist').load(sess)# Read in some datadata_sets=input_data.read_data_sets('data',False)# Test the trained network on the datasettrue_count=0forstepinxrange(data_sets.test.num_examples//batch_size):images_feed,labels_feed=data_sets.test.next_batch(batch_size,False)true_count+=sess.run(eval_correct,feed_dict={images_placeholder:images_feed,labels_placeholder:labels_feed,})precision=true_count/float(data_sets.test.num_examples)print('Num Examples:%dNum Correct:%dPrecision:%0.04f'%(data_sets.test.num_examples,true_count,precision))