This is a draft cheat sheet. It is a work in progress and is not finished yet.
placeholders
tf.placeholder(dtype, shape=None, name=None) |
Variables
tf.Variable(initial_value=None, trainable=True, collections=None, name=None, dtype=None, ...) |
Show Variable
with tf.Session() as sess:
print sess.run(x)
|
|
Phase 1: Assemble graph
Step 1: Read in data |
Step 2: Create placeholders for inputs and labels |
tf.placeholder(dtype, shape=None, name=None) |
Step 3: Create weight and bias |
tf.Variable(initial_value=None, trainable=True, collections=None, name=None, dtype=None, ...) |
Step 4: Build model to predict Y |
Y_predicted = X * w + b |
Step 5: Specify loss function |
tf.square(Y - Y_predicted, name="loss") |
Step 6: Create optimizer |
tf.train.GradientDescentOptimizer(learning_rate=0.001).minimize(loss) |
Phase 2: Train model
Initialize variables |
Run optimizer op (with data fed into placeholders for inputs and labels) |
|
|
|