What is TensorFlow? If you’ve been following the machine learning community, in particular that of deep learning, over the last year, you’ve probably heard of Tensorflow. Tensorflow is a library to structure and run numerical computations developed in-house by Google Brain (the people who developed Alpha-GO). One can imagine this library as an extension of NumPY to work on more scalable architectures, as well as with more detailed algorithms and methods that pertain specifically to machine learning. Tensorflow joins Theano and cuDNN as architectures for building and designing neural networks.
This article hopes to delve into Tensorflow through case studies of implementations of Neural Networks. As such, it requires advance knowledge of neural networks (the subject is too expansive to cover in a single article). For those new (and for those who need a refresher), here are some good reference materials
http://neuralnetworksanddeeplearning.com/ (Basic) http://www.deeplearningbook.org/ (More Advanced)
Installation
Tensorflow is available on PyPI, so we can simply pip install
pip install tensorflow
Or if you have a GPU
pip install tensorflow-gpu
More extensive installation details can be found on the Tensorflow Installation Website
First, let’s get the default imports out of the way: these imports will be used throughout the guide, and others will be added later when necessary
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
````
### Initial Investigations
#### Multiplication
Given two floats x and y, find xy
First we create the relevant variables x and y (initializing them as floats). Placeholders can be thought of as inputs; when doing computations, we'll plug in values for x and y. We symbolize the result that we are looking for as xy.
x = tf.placeholder(“float”) y = tf.placeholder(“float”) xy = tf.mul(x,y)
Now we've represented the computation graph in Tensorflow; all that remains is to create a session, and plug in values, retrieving the result of the computation
with tf.Session() as sess: print(“%f x %f = %f”%(2,3,sess.run(xy,feed_dict={x:2,y:3}))) 2.000000 x 3.000000 = 6.000000 ```
Linear Regression
Next later ….