SlideShare ist ein Scribd-Unternehmen logo
1 von 83
TensorFlow In
Practice
Nathan Lintz
nathan@indico.io
Inputs
Parameters and
Operations
Outputs
Inputs
Parameters and
Operations
Outputs
Cost
Batter
Cake
Doneness
Doneness
Temperature
Mush
Perfect
Burnt
Batter
Cake
Doneness
Doneness
Temperature
Mush
Perfect
Burnt
𝑦 = 𝑚𝑥 + 𝑏 ?
Inputs
(x)
(placeholders)
Parameters and
Operations
(m, b)
Outputs
(y_predict)
Cost
y_target
(doneness)
Placeholders
Parameters + Operations
Cost
Optimization
Train
TensorFlow in 5 Easy Pieces
Inputs
(placeholders) import tensorflow as tf
temp = tf.placeholder(tf.float32, [10, 1])
cake_doneness = tf.placeholder(tf.float32, [10, 1])
import tensorflow as tf
temp = tf.placeholder(tf.float32, [10, 1])
cake_doneness = tf.placeholder(tf.float32, [10, 1])
temp_m = tf.get_variable(‘temp_m’, [1, 1])
temp_b = tf.get_variable(‘temp_b’, [1])
predicted_output = tf.nn.xw_plus_b(temp, temp_m ,
temp_b)
Parameters and
Operations
(m, b)
Outputs
(y)
import tensorflow as tf
temp = tf.placeholder(tf.float32, [10, 1])
cake_doneness = tf.placeholder(tf.float32, [10, 1]
temp_m = tf.get_variable(‘temp_m’, [1, 1])
temp_b = tf.get_variable(‘temp_b’, [1])
predicted_output = tf.nn.xw_plus_b(temp, temp_m , temp_b)
cost = tf.reduce_mean((cake_doneness –
predicted_output)**2)
Cost
import tensorflow as tf
temp = tf.placeholder(tf.float32, [10, 1])
cake_doneness = tf.placeholder(tf.float32, [10, 1])
temp_m = tf.get_variable(‘temp_m’, [1, 1])
temp_b = tf.get_variable(‘temp_b’, [1])
predicted_output = tf.nn.xw_plus_b(temp, temp_m , temp_b)
cost = tf.reduce_mean((cake_doneness –predicted_output)**2)
optimizer =
tf.train.GradientDescentOptimizer(learning_rate=0.01).
minimize(cost)
Optimizer
import tensorflow as tf
temp = tf.placeholder(tf.float32, [10, 1])
cake_doneness = tf.placeholder(tf.float32, [10, 1])
temp_m = tf.get_variable(‘temp_m’, [1, 1])
temp_b = tf.get_variable(‘temp_b’, [1])
predicted_output = tf.nn.xw_plus_b(temp, temp_m , temp_b)
cost = tf.reduce_mean((cake_doneness –predicted_output) 2)
optimizer =
tf.train.GradientDescentOptimizer(learning_rate=0.01).minimize(cost)
sess = tf.Session()
sess.run(tf.initialize_all_variables())
temp_train = np.linspace(0, 10, 10).reshape(-1, 1)
doneness_train = temp_observe * 5. + 1. +
np.random.randn(10, 1)
for _ in range(100): sess.run(optimizer, feed_dict={temp:
temp_train, cake_doneness: doneness_train})
predicted_doneness = sess.run(predicted_output,
feed_dict={temp: temp_train})
Train Code
Placeholders
Parameters + Operations
Cost
Optimization
Train
TensorFlow in 5 Easy Pieces
Batter
Cake
Doneness
Doneness
Temperature
Mush
Perfect
Burnt
𝑦 = 𝑚𝑥 + 𝑏
m = 4.99
b = 1.21
Batter
Cake
Doneness
Doneness
Temperature
Mush
Perfect
Burnt
No
Yes
Doneness Is Done?
Handwritten Digit
(28 x 28 pixels) -> 784 pixels Predicted Digit Value
X (pixels)
[784]
softmax(
mx + b)
m b
Y_true
[10]
Placeholders
Parameters + Operations
Cost
Optimization
Train
TensorFlow in 5 Easy Pieces
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import
input_data
mnist = input_data.read_data_sets('MNIST_data',
one_hot=True)
X = tf.placeholder(tf.float32, [128, 784])
Y_true = tf.placeholder(tf.float32, [128, 10])
Placeholders
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('MNIST_data', one_hot=True)
X = tf.placeholder(tf.float32, [128, 784])
Y_true = tf.placeholder(tf.float32, [128, 10])
m = tf.get_variable('m', [784, 10])
b = tf.get_variable('b', [10])
Y_pred = tf.nn.xw_plus_b(X, m, b)
Parameters
and
Operations
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('MNIST_data', one_hot=True)
X = tf.placeholder(tf.float32, [128, 784])
Y_true = tf.placeholder(tf.float32, [128, 10])
m = tf.get_variable('m', [784, 10])
b = tf.get_variable('b', [10])
Y_pred = tf.nn.xw_plus_b(X, m, b)
cost =
tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(
Y_pred, Y_true))
Cost
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('MNIST_data', one_hot=True)
X = tf.placeholder(tf.float32, [128, 784])
Y_true = tf.placeholder(tf.float32, [128, 10])
m = tf.get_variable('m', [784, 10])
b = tf.get_variable('b', [10])
Y_pred = tf.nn.xw_plus_b(X, m, b)
cost = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(Y_pred,
Y_true))
optimzer =
tf.train.GradientDescentOptimizer(learning_rate=0.5)
.minimize(cost)
Optimizer
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('MNIST_data', one_hot=True)
X = tf.placeholder(tf.float32, [128, 784])
Y_true = tf.placeholder(tf.float32, [128, 10])
m = tf.get_variable('m', [784, 10])
b = tf.get_variable('b', [10])
Y_pred = tf.nn.xw_plus_b(X, m, b)
cost = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(Y_pred,
Y_true))
optimzer =
tf.train.GradientDescentOptimizer(learning_rate=0.5) .minimize(cost)
sess = tf.Session()
sess.run(tf.initialize_all_variables())
for i in range(2000):
trX, trY = mnist.train.next_batch(128)
sess.run(optimzer, feed_dict={X: trX, Y_true: trY})
Train Code
92% Accuracy!
7
2
1
0
6
6
2
2
m b
nonlinear(
mx + b)
Relu
𝑌 =
𝑥 𝑖𝑓 𝑥 > 0
0 𝑒𝑙𝑠𝑒
X (pixels)
[784]
softmax(
m1h + b1)
m0 b0
Y_true
[10]
m1 b1
relu(
m0x + b0)
h
hidden layer classifier layer
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('MNIST_data', one_hot=True)
X = tf.placeholder(tf.float32, [128, 784])
Y_true = tf.placeholder(tf.float32, [128, 10])
Placeholders
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('MNIST_data', one_hot=True)
X = tf.placeholder(tf.float32, [128, 784])
Y_true = tf.placeholder(tf.float32, [128, 10])
m0 = tf.get_variable('m0', [784, 256])
b0 = tf.get_variable('b0', [256],
initializer=tf.constant_initializer(0.))
m1 = tf.get_variable('m1', [256, 10])
b1 = tf.get_variable('b1', [10],
initializer=tf.constant_initializer(0.))
h = tf.nn.relu(tf.nn.xw_plus_b(X, m0, b0))
Y_pred = tf.nn.xw_plus_b(h, m1, b1)
Parameters
and
Operations
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('MNIST_data', one_hot=True)
X = tf.placeholder(tf.float32, [128, 784])
Y_true = tf.placeholder(tf.float32, [128, 10])
m0 = tf.get_variable('m0', [784, 256])
b0 = tf.get_variable('b0', [256], initializer=tf.constant_initializer(0.))
m1 = tf.get_variable('m1', [256, 10])
b1 = tf.get_variable('b1', [10], initializer=tf.constant_initializer(0.))
h = tf.nn.relu(tf.nn.xw_plus_b(X, m0, b0))
Y_pred = tf.nn.xw_plus_b(h, m1, b1)
cost =
tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(
Y_pred, Y_true))
Cost
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('MNIST_data', one_hot=True)
X = tf.placeholder(tf.float32, [128, 784])
Y_true = tf.placeholder(tf.float32, [128, 10])
m0 = tf.get_variable('m0', [784, 256])
b0 = tf.get_variable('b0', [256], initializer=tf.constant_initializer(0.))
m1 = tf.get_variable('m1', [256, 10])
b1 = tf.get_variable('b1', [10], initializer=tf.constant_initializer(0.))
h = tf.nn.relu(tf.nn.xw_plus_b(X, m0, b0))
Y_pred = tf.nn.xw_plus_b(h, m1, b1)
cost = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(Y_pred,
Y_true))
optimzer =
tf.train.GradientDescentOptimizer(learning_rate=0.5)
.minimize(cost)
Optimizer
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('MNIST_data', one_hot=True)
X = tf.placeholder(tf.float32, [128, 784])
Y_true = tf.placeholder(tf.float32, [128, 10])
m0 = tf.get_variable('m0', [784, 256])
b0 = tf.get_variable('b0', [256], initializer=tf.constant_initializer(0.))
m1 = tf.get_variable('m1', [256, 10])
b1 = tf.get_variable('b1', [10], initializer=tf.constant_initializer(0.))
h = tf.nn.relu(tf.nn.xw_plus_b(X, m0, b0))
Y_pred = tf.nn.xw_plus_b(h, m1, b1)
cost = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(Y_pred,
Y_true))
optimzer =
tf.train.GradientDescentOptimizer(learning_rate=0.5) .minimize(cost)
sess = tf.Session()
sess.run(tf.initialize_all_variables())
for i in range(2000):
trX, trY = mnist.train.next_batch(128)
sess.run(optimzer, feed_dict={X: trX, Y_true: trY})
Train Code
97% Test Accuracy!
(97% train accuracy)
m0 m1 m2b0 b1 b2
X
(pixels)
[784]
relu(
m0x + b0)
relu(
m1x + b1)
softmax(
m2h1 + b2)
Y_true
[10]
h1 h2
hidden layer 1 classifier layerhidden layer 2
def model(X):
m0 = tf.get_variable('m0', [784, 256])
b0 = tf.get_variable('b0', [256],
initializer=tf.constant_initializer(0.))
m1 = tf.get_variable('m1', [256, 256])
b1 = tf.get_variable('b1', [256],
initializer=tf.constant_initializer(0.))
m2 = tf.get_variable('m2', [256, 10])
b2 = tf.get_variable('b2', [10],
initializer=tf.constant_initializer(0.))
h1 = tf.nn.relu(tf.nn.xw_plus_b(X, m0, b0))
h2 = tf.nn.relu(tf.nn.xw_plus_b(h1, m1, b1))
output = tf.nn.xw_plus_b(h2, m2, b2)
return output
Y_pred = model(X)
Parameters
and
Operations
(with 2 hidden
layers)
97% Test Accuracy!
(98% train accuracy)
Overfitting
Train cost
Test cost
Cost
Iterations
mx + bx y
x dropout(
mx + b)
y
def model(X, p_keep):
m0 = tf.get_variable('m0', [784, 256])
b0 = tf.get_variable('b0', [256],
initializer=tf.constant_initializer(0.))
m1 = tf.get_variable('m1', [256, 256])
b1 = tf.get_variable('b1', [256],
initializer=tf.constant_initializer(0.))
m2 = tf.get_variable('m2', [256, 10])
b2 = tf.get_variable('b2', [10],
initializer=tf.constant_initializer(0.))
h1 = tf.nn.relu(tf.nn.xw_plus_b(X, m0, b0))
h1 = tf.nn.dropout(h1, p_keep)
h2 = tf.nn.relu(tf.nn.xw_plus_b(h1, m1, b1))
h2 = tf.nn.dropout(h2, p_keep)
output = tf.nn.xw_plus_b(h2, m2, b2)
return output
Y_pred = model(X, 0.8)
Y_pred_test = model(X, 1.)
Parameters
and
Operations
(with 2 hidden
layers and
dropout)
m0 m1 m2b0 b1 b2
X
(pixels)
[784]
relu(
m0x + b0)
relu(
m1x + b1)
softmax(
m2h1 + b2)
Y_true
[10]
Dropout(h1) Dropout(h2)
hidden layer 1 classifier layerhidden layer 2
98% Test Accuracy!
(98% train accuracy)
TensorFlow Tips and Tricks
Scaling Predictions
X (pixels)
[784]
m b
softmax(
mx + b)
Y_true
[10]
X = tf.placeholder(tf.float32, [128, 784])
Y_true = tf.placeholder(tf.float32, [128, 10])
m = tf.get_variable('m', [784, 10])
b = tf.get_variable('b', [10])
Y_pred = tf.nn.xw_plus_b(X, m, b)
cost =
tf.reduce_mean(tf.nn.softmax_cross_entrop
y_with_logits(Y_pred, Y_true))
VS.
cost =
tf.reduce_mean(tf.nn.softmax_cross_entrop
y_with_logits(tf.nn.softmax(Y_pred)
, Y_true))
Parameter Sharing
def model(X, p_keep):
m0 = tf.get_variable('m0', [784, 256])
b0 = tf.get_variable('b0', [256], initializer=tf.constant_initializer(0.))
m1 = tf.get_variable('m1', [256, 256])
b1 = tf.get_variable('b1', [256], initializer=tf.constant_initializer(0.))
m2 = tf.get_variable('m2', [256, 10])
b2 = tf.get_variable('b2', [10], initializer=tf.constant_initializer(0.))
h1 = tf.nn.relu(tf.nn.xw_plus_b(X, m0, b0))
h1 = tf.nn.dropout(h1, p_keep)
h2 = tf.nn.relu(tf.nn.xw_plus_b(h1, m1, b1))
h2 = tf.nn.dropout(h2, p_keep)
output = tf.nn.xw_plus_b(h2, m2, b2)
return output
Y_pred = model(X, 0.8)
Y_pred_test = model(X, 1.)
m0 m1 m2b0 b1 b2
X
(pixels)
[784]
relu(
m0x + b0)
relu(
m1x + b1)
softmax(
m2h1 + b2)
Y_true
[10]
Dropout(h1) Dropout(h2)
m0_test m1_test m2_testb0_test b1_test b2_test
X
(pixels)
[784]
relu(
m0x + b0)
relu(
m1x + b1)
softmax(
m2h1 + b2)
Y_true
[10]
Dropout(h1) Dropout(h2)
Y_pred = model(X, 0.8)
Y_pred = model(X, 1.)
m0 m1 m2b0 b1 b2
X
(pixels)
[784]
relu(
m0x + b0)
relu(
m1x + b1)
softmax(
m2h1 + b2)
Y_true
[10]
Dropout(h1) Dropout(h2)
m0_test m1_test m2_testb0_test b1_test b2_test
X
(pixels)
[784]
relu(
m0x + b0)
relu(
m1x + b1)
softmax(
m2h1 + b2)
Y_true
[10]
Dropout(h1) Dropout(h2)
Y_pred = model(X, 0.8)
Y_pred = model(X, 1.)
m0 m1 m2b0 b1 b2
X
(pixels)
[784]
relu(
m0x + b0)
relu(
m1x + b1)
softmax(
m2h1 + b2)
Y_true
[10]
Dropout(h1) Dropout(h2)
m0 m1 m2b0 b1 b2
X
(pixels)
[784]
relu(
m0x + b0)
relu(
m1x + b1)
softmax(
m2h1 + b2)
Y_true
[10]
Dropout(h1) Dropout(h2)
Y_pred = model(X, 0.8)
Y_pred = model(X, 1.)
Parameter Sharing (correct)
def model(X, p_keep):
m0 = tf.get_variable('m0', [784, 256])
b0 = tf.get_variable('b0', [256], initializer=tf.constant_initializer(0.))
m1 = tf.get_variable('m1', [256, 256])
b1 = tf.get_variable('b1', [256], initializer=tf.constant_initializer(0.))
m2 = tf.get_variable('m2', [256, 10])
b2 = tf.get_variable('b2', [10], initializer=tf.constant_initializer(0.))
h1 = tf.nn.relu(tf.nn.xw_plus_b(X, m0, b0))
h1 = tf.nn.dropout(h1, p_keep)
h2 = tf.nn.relu(tf.nn.xw_plus_b(h1, m1, b1))
h2 = tf.nn.dropout(h2, p_keep)
output = tf.nn.xw_plus_b(h2, m2, b2)
return output
with tf.variable_scope(“model”) as scope:
Y_pred = model(X, 0.8)
scope.reuse_variables()
Y_pred_test = model(X, 1.)
Collections
def model(X):
m0 = tf.get_variable('m0', [784, 256])
b0 = tf.get_variable('b0', [256], initializer=tf.constant_initializer(0.))
m1 = tf.get_variable('m1', [256, 256])
b1 = tf.get_variable('b1', [256], initializer=tf.constant_initializer(0.))
m2 = tf.get_variable('m2', [256, 10])
b2 = tf.get_variable('b2', [10], initializer=tf.constant_initializer(0.))
h1 = tf.nn.relu(tf.nn.xw_plus_b(X, m0, b0))
h2 = tf.nn.relu(tf.nn.xw_plus_b(h1, m1, b1))
tf.add_to_collection(“activations”, h1)
tf.add_to_collection(“activations”, h2)
output = tf.nn.xw_plus_b(h2, m2, b2)
return output
Y_pred = model(X)
Collections
activations = tf.get_collection(‘activations’)
activations_values = session.run(activations)
parameters = tf.get_collection(‘trainable_parameters’)
parameter_values = session.run(parameters)
X = tf.placeholder(tf.float32, [128, 784])
Placeholders
X = tf.placeholder(tf.float32, [None, 784])
Placeholders
Placeholders
X = tf.placeholder(tf.float32, [None, 784])
model = …
cost = …
optimizer = …
for i in range(1000):
trX, trY = mnist.train.next_batch(128)
sess.run(optimzer, feed_dict={X: trX, Y_true: trY})
Placeholders
X = tf.placeholder(tf.float32, [None, 784])
model = …
cost = …
optimizer = …
for i in range(1000):
trX, trY = mnist.train.next_batch(128)
sess.run(optimzer, feed_dict={X: trX, Y_true: trY})
Placeholders
X = tf.placeholder(tf.float32, [None, 784])
model = …
cost = …
optimizer = …
for i in range(1000):
trX, trY = mnist.train.next_batch(512)
sess.run(optimzer, feed_dict={X: trX, Y_true: trY})
Advanced Tensorflow: Building RNNs
Note – Most of the code for the generation is “pseudo-code” meant mostly
to illustrate my point. If you wish to see the actual code, feel free to email
me and I’ll send you a copy.
RNNs
“The food at the restaurant,
was very good”
[1]
RNNs
[The, food, at, the, restaurant,
was, very, good]
[1]
RNNs
[The, food, at, the, restaurant,
was, very, good]
[1]
t = 7
t = 0 t = 1
RNNs
𝑌𝑡 = 𝑡𝑎𝑛ℎ(𝑚 𝑥 𝑋𝑡 + 𝑚ℎℎ 𝑡−1 + 𝑏)
mxXt +
mhht-1+
b
Xt ht
ht-1
RNNs
X = tf.placeholder(tf.float32, [28, 128, 28])
X_split = [tf.squeeze(x) for x in tf.split(0, 28, X)]
rnn = tf.nn.rnn_cell.BasicRNNCell(256, 28)
outputs, states = tf.nn.rnn(rnn, X_split, dtype=tf.float32)
Scan
elems = [1, 2, 3, 4, 5, 6]
def step(a, x):
return a + x
sum = scan(step, elems)
>>> sum = [1, 3, 6, 10, 15, 21]
RNNs with Scan
X = tf.placeholder(tf.float32, [28, 128, 28])
m_x = tf.get_variable(‘m_x’, [28, 256])
m_h = tf.get_variable(‘m_h’, [256, 256])
def step(h_tm1, x):
return tf.tanh(tf.nn.xw_plus_b(x, m_x, b_x) +
tf.nn.xw_plus_b(h_tm1, m_h, b_h))
states = tf.scan(step, X, initializer=tf.zeros(256))
𝑌𝑡 = 𝑡𝑎𝑛ℎ(𝑚 𝑥 𝑋𝑡 + 𝑚ℎℎ 𝑡−1 + 𝑏)
MNIST Generation
MNIST Generation
t = 28
t = 0
t = 28
t = 0
X = tf.placeholder(tf.float32, [27, 128, 28]) # first 27 rows of image
Y = tf.placeholder(tf.float32, [27, 128, 28]) # last 27 rows of image
m_output = tf.get_variable(tf.float32, [256, 28])
b_output = tf.get_variable(tf.float32, [28])
states = rnn(X)
output_img = tf.map_fn(lambda x: tf.nn.xw_plus_b(x, m_output,
b_output),
tf.pack(states))
cost =
tf.reduce_mean(tf.nn.sigmoid_cross_entropy_with_logits(output_
img, Y))
Language Model
def generate(num_steps):
states = [tf.zeros([batch_size, hidden_dim])]
for _ in range(num_steps):
next_output = tf.sigmoid(tf.nn.xw_plus_b(states[-1],
m_output,
b_output))
outputs.append(next_output)
state = gru.step_(states[-1], outputs[-1]))
states.append(state)
return tf.pack(outputs)
Language Model (Generate)
Language Model (Generations)
Seq2Seq
Language
Model
(RNN)
Encoder
(RNN)
Input
Digit
Output
Digit
Take Final
State
X = tf.placeholder(tf.float32, [27, 128, 28]) # first 27 rows of image
Y_in = tf.placeholder(tf.float32, [27, 128, 28]) # first 27 rows of target image
Y_out = tf.placeholder(tf.float32, [27, 128, 28]) # last 27 rows of target image
m_output = tf.get_variable(tf.float32, [256, 28])
b_output = tf.get_variable(tf.float32, [28])
with tf.variable_scope(“encoder”) as scope:
encoded_states = rnn(X)
final_state = tf.reverse(encoded_states, [True, False, False])[0, :, :]
with tf.variable_scope(“decoder”) as scope:
output_states = rnn(Y_in, initializer=final_state)
output_img = tf.map_fn(lambda x: tf.nn.xw_plus_b(x, m_output, b_output),
tf.pack(output_states))
cost = tf.reduce_mean(tf.nn.sigmoid_cross_entropy_with_logits(output_img,
Y_out))
Seq2Seq
Seq2Seq (Generations)
Q and A

Weitere ähnliche Inhalte

Was ist angesagt?

What is TensorFlow and why do we use it
What is TensorFlow and why do we use itWhat is TensorFlow and why do we use it
What is TensorFlow and why do we use itRobert John
 
Pythonbrasil - 2018 - Acelerando Soluções com GPU
Pythonbrasil - 2018 - Acelerando Soluções com GPUPythonbrasil - 2018 - Acelerando Soluções com GPU
Pythonbrasil - 2018 - Acelerando Soluções com GPUPaulo Sergio Lemes Queiroz
 
Introduction to Tensorflow
Introduction to TensorflowIntroduction to Tensorflow
Introduction to TensorflowTzar Umang
 
Tensor board
Tensor boardTensor board
Tensor boardSung Kim
 
Additive model and boosting tree
Additive model and boosting treeAdditive model and boosting tree
Additive model and boosting treeDong Guo
 
Pybelsberg — Constraint-based Programming in Python
Pybelsberg — Constraint-based Programming in PythonPybelsberg — Constraint-based Programming in Python
Pybelsberg — Constraint-based Programming in PythonChristoph Matthies
 
Introduction to TensorFlow 2
Introduction to TensorFlow 2Introduction to TensorFlow 2
Introduction to TensorFlow 2Oswald Campesato
 
Introduction to TensorFlow 2
Introduction to TensorFlow 2Introduction to TensorFlow 2
Introduction to TensorFlow 2Oswald Campesato
 
Introduction to TensorFlow 2 and Keras
Introduction to TensorFlow 2 and KerasIntroduction to TensorFlow 2 and Keras
Introduction to TensorFlow 2 and KerasOswald Campesato
 
Introduction to TensorFlow, by Machine Learning at Berkeley
Introduction to TensorFlow, by Machine Learning at BerkeleyIntroduction to TensorFlow, by Machine Learning at Berkeley
Introduction to TensorFlow, by Machine Learning at BerkeleyTed Xiao
 
Font classification with 5 deep learning models using tensor flow
Font classification with 5 deep learning models using tensor flowFont classification with 5 deep learning models using tensor flow
Font classification with 5 deep learning models using tensor flowDevatanu Banerjee
 
Intermediate Microeconomic Theory Midterm 2 "Cheat Sheet"
Intermediate Microeconomic Theory Midterm 2 "Cheat Sheet"Intermediate Microeconomic Theory Midterm 2 "Cheat Sheet"
Intermediate Microeconomic Theory Midterm 2 "Cheat Sheet"Laurel Ayuyao
 
Sergey Shelpuk & Olha Romaniuk - “Deep learning, Tensorflow, and Fashion: how...
Sergey Shelpuk & Olha Romaniuk - “Deep learning, Tensorflow, and Fashion: how...Sergey Shelpuk & Olha Romaniuk - “Deep learning, Tensorflow, and Fashion: how...
Sergey Shelpuk & Olha Romaniuk - “Deep learning, Tensorflow, and Fashion: how...Lviv Startup Club
 
Intro to Python (High School) Unit #3
Intro to Python (High School) Unit #3Intro to Python (High School) Unit #3
Intro to Python (High School) Unit #3Jay Coskey
 
Introduction to NumPy (PyData SV 2013)
Introduction to NumPy (PyData SV 2013)Introduction to NumPy (PyData SV 2013)
Introduction to NumPy (PyData SV 2013)PyData
 

Was ist angesagt? (20)

What is TensorFlow and why do we use it
What is TensorFlow and why do we use itWhat is TensorFlow and why do we use it
What is TensorFlow and why do we use it
 
About RNN
About RNNAbout RNN
About RNN
 
About RNN
About RNNAbout RNN
About RNN
 
Pythonbrasil - 2018 - Acelerando Soluções com GPU
Pythonbrasil - 2018 - Acelerando Soluções com GPUPythonbrasil - 2018 - Acelerando Soluções com GPU
Pythonbrasil - 2018 - Acelerando Soluções com GPU
 
Introduction to Tensorflow
Introduction to TensorflowIntroduction to Tensorflow
Introduction to Tensorflow
 
Tensor board
Tensor boardTensor board
Tensor board
 
Additive model and boosting tree
Additive model and boosting treeAdditive model and boosting tree
Additive model and boosting tree
 
Econometrics Notes
Econometrics NotesEconometrics Notes
Econometrics Notes
 
Python book
Python bookPython book
Python book
 
Pybelsberg — Constraint-based Programming in Python
Pybelsberg — Constraint-based Programming in PythonPybelsberg — Constraint-based Programming in Python
Pybelsberg — Constraint-based Programming in Python
 
Introduction to TensorFlow 2
Introduction to TensorFlow 2Introduction to TensorFlow 2
Introduction to TensorFlow 2
 
Introduction to TensorFlow 2
Introduction to TensorFlow 2Introduction to TensorFlow 2
Introduction to TensorFlow 2
 
Introduction to TensorFlow 2 and Keras
Introduction to TensorFlow 2 and KerasIntroduction to TensorFlow 2 and Keras
Introduction to TensorFlow 2 and Keras
 
Introduction to TensorFlow, by Machine Learning at Berkeley
Introduction to TensorFlow, by Machine Learning at BerkeleyIntroduction to TensorFlow, by Machine Learning at Berkeley
Introduction to TensorFlow, by Machine Learning at Berkeley
 
Font classification with 5 deep learning models using tensor flow
Font classification with 5 deep learning models using tensor flowFont classification with 5 deep learning models using tensor flow
Font classification with 5 deep learning models using tensor flow
 
Intermediate Microeconomic Theory Midterm 2 "Cheat Sheet"
Intermediate Microeconomic Theory Midterm 2 "Cheat Sheet"Intermediate Microeconomic Theory Midterm 2 "Cheat Sheet"
Intermediate Microeconomic Theory Midterm 2 "Cheat Sheet"
 
Sergey Shelpuk & Olha Romaniuk - “Deep learning, Tensorflow, and Fashion: how...
Sergey Shelpuk & Olha Romaniuk - “Deep learning, Tensorflow, and Fashion: how...Sergey Shelpuk & Olha Romaniuk - “Deep learning, Tensorflow, and Fashion: how...
Sergey Shelpuk & Olha Romaniuk - “Deep learning, Tensorflow, and Fashion: how...
 
Intro to Python (High School) Unit #3
Intro to Python (High School) Unit #3Intro to Python (High School) Unit #3
Intro to Python (High School) Unit #3
 
深層学習後半
深層学習後半深層学習後半
深層学習後半
 
Introduction to NumPy (PyData SV 2013)
Introduction to NumPy (PyData SV 2013)Introduction to NumPy (PyData SV 2013)
Introduction to NumPy (PyData SV 2013)
 

Andere mochten auch

Deep Advances in Generative Modeling
Deep Advances in Generative ModelingDeep Advances in Generative Modeling
Deep Advances in Generative Modelingindico data
 
Introduction to Deep Learning with TensorFlow
Introduction to Deep Learning with TensorFlowIntroduction to Deep Learning with TensorFlow
Introduction to Deep Learning with TensorFlowTerry Taewoong Um
 
How Machine Learning is Shaping Digital Marketing
How Machine Learning is Shaping Digital MarketingHow Machine Learning is Shaping Digital Marketing
How Machine Learning is Shaping Digital Marketingindico data
 
The Unreasonable Benefits of Deep Learning
The Unreasonable Benefits of Deep LearningThe Unreasonable Benefits of Deep Learning
The Unreasonable Benefits of Deep Learningindico data
 
Machine learning and TensorFlow
Machine learning and TensorFlowMachine learning and TensorFlow
Machine learning and TensorFlowJose Papo, MSc
 
Large Scale Deep Learning with TensorFlow
Large Scale Deep Learning with TensorFlow Large Scale Deep Learning with TensorFlow
Large Scale Deep Learning with TensorFlow Jen Aman
 
Machine learning for the sensored IoT
Machine learning for the sensored IoTMachine learning for the sensored IoT
Machine learning for the sensored IoTHank Roark
 
Complex realtime event analytics using BigQuery @Crunch Warmup
Complex realtime event analytics using BigQuery @Crunch WarmupComplex realtime event analytics using BigQuery @Crunch Warmup
Complex realtime event analytics using BigQuery @Crunch WarmupMárton Kodok
 
Time-Evolving Graph Processing On Commodity Clusters
Time-Evolving Graph Processing On Commodity ClustersTime-Evolving Graph Processing On Commodity Clusters
Time-Evolving Graph Processing On Commodity ClustersJen Aman
 
RISELab:Enabling Intelligent Real-Time Decisions
RISELab:Enabling Intelligent Real-Time DecisionsRISELab:Enabling Intelligent Real-Time Decisions
RISELab:Enabling Intelligent Real-Time DecisionsJen Aman
 
Machine Learning for Non-technical People
Machine Learning for Non-technical PeopleMachine Learning for Non-technical People
Machine Learning for Non-technical Peopleindico data
 
Introduction to TensorFlow
Introduction to TensorFlowIntroduction to TensorFlow
Introduction to TensorFlowMatthias Feys
 
Rajat Monga, Engineering Director, TensorFlow, Google at MLconf 2016
Rajat Monga, Engineering Director, TensorFlow, Google at MLconf 2016Rajat Monga, Engineering Director, TensorFlow, Google at MLconf 2016
Rajat Monga, Engineering Director, TensorFlow, Google at MLconf 2016MLconf
 
Neural Network + Tensorflow 入門講座
Neural Network + Tensorflow 入門講座Neural Network + Tensorflow 入門講座
Neural Network + Tensorflow 入門講座maruyama097
 
Exploring BigData with Google BigQuery
Exploring BigData with Google BigQueryExploring BigData with Google BigQuery
Exploring BigData with Google BigQueryDharmesh Vaya
 
11 Accomplishments Employers Want to See On Your Resume
11 Accomplishments Employers Want to See On Your Resume11 Accomplishments Employers Want to See On Your Resume
11 Accomplishments Employers Want to See On Your ResumeGovig and Associates
 
Intranetin jalkauttaminen - Sosiaalinen intranet 2014 -seminaari 8.5.2014
Intranetin jalkauttaminen - Sosiaalinen intranet 2014 -seminaari 8.5.2014Intranetin jalkauttaminen - Sosiaalinen intranet 2014 -seminaari 8.5.2014
Intranetin jalkauttaminen - Sosiaalinen intranet 2014 -seminaari 8.5.2014Hanna P. Korhonen
 

Andere mochten auch (20)

Deep Advances in Generative Modeling
Deep Advances in Generative ModelingDeep Advances in Generative Modeling
Deep Advances in Generative Modeling
 
Introduction to Deep Learning with TensorFlow
Introduction to Deep Learning with TensorFlowIntroduction to Deep Learning with TensorFlow
Introduction to Deep Learning with TensorFlow
 
How Machine Learning is Shaping Digital Marketing
How Machine Learning is Shaping Digital MarketingHow Machine Learning is Shaping Digital Marketing
How Machine Learning is Shaping Digital Marketing
 
The Unreasonable Benefits of Deep Learning
The Unreasonable Benefits of Deep LearningThe Unreasonable Benefits of Deep Learning
The Unreasonable Benefits of Deep Learning
 
Machine learning and TensorFlow
Machine learning and TensorFlowMachine learning and TensorFlow
Machine learning and TensorFlow
 
Large Scale Deep Learning with TensorFlow
Large Scale Deep Learning with TensorFlow Large Scale Deep Learning with TensorFlow
Large Scale Deep Learning with TensorFlow
 
Machine learning for the sensored IoT
Machine learning for the sensored IoTMachine learning for the sensored IoT
Machine learning for the sensored IoT
 
Practical Deep Learning
Practical Deep LearningPractical Deep Learning
Practical Deep Learning
 
W8PRML5.1-5.3
W8PRML5.1-5.3W8PRML5.1-5.3
W8PRML5.1-5.3
 
Google BigQuery
Google BigQueryGoogle BigQuery
Google BigQuery
 
Complex realtime event analytics using BigQuery @Crunch Warmup
Complex realtime event analytics using BigQuery @Crunch WarmupComplex realtime event analytics using BigQuery @Crunch Warmup
Complex realtime event analytics using BigQuery @Crunch Warmup
 
Time-Evolving Graph Processing On Commodity Clusters
Time-Evolving Graph Processing On Commodity ClustersTime-Evolving Graph Processing On Commodity Clusters
Time-Evolving Graph Processing On Commodity Clusters
 
RISELab:Enabling Intelligent Real-Time Decisions
RISELab:Enabling Intelligent Real-Time DecisionsRISELab:Enabling Intelligent Real-Time Decisions
RISELab:Enabling Intelligent Real-Time Decisions
 
Machine Learning for Non-technical People
Machine Learning for Non-technical PeopleMachine Learning for Non-technical People
Machine Learning for Non-technical People
 
Introduction to TensorFlow
Introduction to TensorFlowIntroduction to TensorFlow
Introduction to TensorFlow
 
Rajat Monga, Engineering Director, TensorFlow, Google at MLconf 2016
Rajat Monga, Engineering Director, TensorFlow, Google at MLconf 2016Rajat Monga, Engineering Director, TensorFlow, Google at MLconf 2016
Rajat Monga, Engineering Director, TensorFlow, Google at MLconf 2016
 
Neural Network + Tensorflow 入門講座
Neural Network + Tensorflow 入門講座Neural Network + Tensorflow 入門講座
Neural Network + Tensorflow 入門講座
 
Exploring BigData with Google BigQuery
Exploring BigData with Google BigQueryExploring BigData with Google BigQuery
Exploring BigData with Google BigQuery
 
11 Accomplishments Employers Want to See On Your Resume
11 Accomplishments Employers Want to See On Your Resume11 Accomplishments Employers Want to See On Your Resume
11 Accomplishments Employers Want to See On Your Resume
 
Intranetin jalkauttaminen - Sosiaalinen intranet 2014 -seminaari 8.5.2014
Intranetin jalkauttaminen - Sosiaalinen intranet 2014 -seminaari 8.5.2014Intranetin jalkauttaminen - Sosiaalinen intranet 2014 -seminaari 8.5.2014
Intranetin jalkauttaminen - Sosiaalinen intranet 2014 -seminaari 8.5.2014
 

Ähnlich wie TensorFlow in Practice

Need help filling out the missing sections of this code- the sections.docx
Need help filling out the missing sections of this code- the sections.docxNeed help filling out the missing sections of this code- the sections.docx
Need help filling out the missing sections of this code- the sections.docxlauracallander
 
Lucio Floretta - TensorFlow and Deep Learning without a PhD - Codemotion Mila...
Lucio Floretta - TensorFlow and Deep Learning without a PhD - Codemotion Mila...Lucio Floretta - TensorFlow and Deep Learning without a PhD - Codemotion Mila...
Lucio Floretta - TensorFlow and Deep Learning without a PhD - Codemotion Mila...Codemotion
 
Working with tf.data (TF 2)
Working with tf.data (TF 2)Working with tf.data (TF 2)
Working with tf.data (TF 2)Oswald Campesato
 
DF1 - Py - Ovcharenko - Theano Tutorial
DF1 - Py - Ovcharenko - Theano TutorialDF1 - Py - Ovcharenko - Theano Tutorial
DF1 - Py - Ovcharenko - Theano TutorialMoscowDataFest
 
TensorFlow for IITians
TensorFlow for IITiansTensorFlow for IITians
TensorFlow for IITiansAshish Bansal
 
Laziness, trampolines, monoids and other functional amenities: this is not yo...
Laziness, trampolines, monoids and other functional amenities: this is not yo...Laziness, trampolines, monoids and other functional amenities: this is not yo...
Laziness, trampolines, monoids and other functional amenities: this is not yo...Mario Fusco
 
TensorFlow Dev Summit 2018 Extended: TensorFlow Eager Execution
TensorFlow Dev Summit 2018 Extended: TensorFlow Eager ExecutionTensorFlow Dev Summit 2018 Extended: TensorFlow Eager Execution
TensorFlow Dev Summit 2018 Extended: TensorFlow Eager ExecutionTaegyun Jeon
 
Machine Learning - Introduction to Tensorflow
Machine Learning - Introduction to TensorflowMachine Learning - Introduction to Tensorflow
Machine Learning - Introduction to TensorflowAndrew Ferlitsch
 
NTU ML TENSORFLOW
NTU ML TENSORFLOWNTU ML TENSORFLOW
NTU ML TENSORFLOWMark Chang
 
Introduction to TensorFlow
Introduction to TensorFlowIntroduction to TensorFlow
Introduction to TensorFlowBabu Priyavrat
 
Theano vs TensorFlow | Edureka
Theano vs TensorFlow | EdurekaTheano vs TensorFlow | Edureka
Theano vs TensorFlow | EdurekaEdureka!
 
Assignment 6.2a.pdf
Assignment 6.2a.pdfAssignment 6.2a.pdf
Assignment 6.2a.pdfdash41
 
딥러닝 교육 자료 #2
딥러닝 교육 자료 #2딥러닝 교육 자료 #2
딥러닝 교육 자료 #2Ashal aka JOKER
 
Go: It's Not Just For Google
Go: It's Not Just For GoogleGo: It's Not Just For Google
Go: It's Not Just For GoogleEleanor McHugh
 
Bar plots.ipynb colaboratory
Bar plots.ipynb   colaboratoryBar plots.ipynb   colaboratory
Bar plots.ipynb colaboratoryGokuldhev mony
 
ggtimeseries-->ggplot2 extensions
ggtimeseries-->ggplot2 extensions ggtimeseries-->ggplot2 extensions
ggtimeseries-->ggplot2 extensions Dr. Volkan OBAN
 
Naive application of Machine Learning to Software Development
Naive application of Machine Learning to Software DevelopmentNaive application of Machine Learning to Software Development
Naive application of Machine Learning to Software DevelopmentAndriy Khavryuchenko
 
Deep learning with C++ - an introduction to tiny-dnn
Deep learning with C++  - an introduction to tiny-dnnDeep learning with C++  - an introduction to tiny-dnn
Deep learning with C++ - an introduction to tiny-dnnTaiga Nomi
 

Ähnlich wie TensorFlow in Practice (20)

Need help filling out the missing sections of this code- the sections.docx
Need help filling out the missing sections of this code- the sections.docxNeed help filling out the missing sections of this code- the sections.docx
Need help filling out the missing sections of this code- the sections.docx
 
Lucio Floretta - TensorFlow and Deep Learning without a PhD - Codemotion Mila...
Lucio Floretta - TensorFlow and Deep Learning without a PhD - Codemotion Mila...Lucio Floretta - TensorFlow and Deep Learning without a PhD - Codemotion Mila...
Lucio Floretta - TensorFlow and Deep Learning without a PhD - Codemotion Mila...
 
Working with tf.data (TF 2)
Working with tf.data (TF 2)Working with tf.data (TF 2)
Working with tf.data (TF 2)
 
DF1 - Py - Ovcharenko - Theano Tutorial
DF1 - Py - Ovcharenko - Theano TutorialDF1 - Py - Ovcharenko - Theano Tutorial
DF1 - Py - Ovcharenko - Theano Tutorial
 
TensorFlow for IITians
TensorFlow for IITiansTensorFlow for IITians
TensorFlow for IITians
 
Laziness, trampolines, monoids and other functional amenities: this is not yo...
Laziness, trampolines, monoids and other functional amenities: this is not yo...Laziness, trampolines, monoids and other functional amenities: this is not yo...
Laziness, trampolines, monoids and other functional amenities: this is not yo...
 
TensorFlow Dev Summit 2018 Extended: TensorFlow Eager Execution
TensorFlow Dev Summit 2018 Extended: TensorFlow Eager ExecutionTensorFlow Dev Summit 2018 Extended: TensorFlow Eager Execution
TensorFlow Dev Summit 2018 Extended: TensorFlow Eager Execution
 
Machine Learning - Introduction to Tensorflow
Machine Learning - Introduction to TensorflowMachine Learning - Introduction to Tensorflow
Machine Learning - Introduction to Tensorflow
 
NTU ML TENSORFLOW
NTU ML TENSORFLOWNTU ML TENSORFLOW
NTU ML TENSORFLOW
 
Introduction to TensorFlow
Introduction to TensorFlowIntroduction to TensorFlow
Introduction to TensorFlow
 
Theano vs TensorFlow | Edureka
Theano vs TensorFlow | EdurekaTheano vs TensorFlow | Edureka
Theano vs TensorFlow | Edureka
 
TensorFlow Tutorial.pdf
TensorFlow Tutorial.pdfTensorFlow Tutorial.pdf
TensorFlow Tutorial.pdf
 
Assignment 6.2a.pdf
Assignment 6.2a.pdfAssignment 6.2a.pdf
Assignment 6.2a.pdf
 
ECE-PYTHON.docx
ECE-PYTHON.docxECE-PYTHON.docx
ECE-PYTHON.docx
 
딥러닝 교육 자료 #2
딥러닝 교육 자료 #2딥러닝 교육 자료 #2
딥러닝 교육 자료 #2
 
Go: It's Not Just For Google
Go: It's Not Just For GoogleGo: It's Not Just For Google
Go: It's Not Just For Google
 
Bar plots.ipynb colaboratory
Bar plots.ipynb   colaboratoryBar plots.ipynb   colaboratory
Bar plots.ipynb colaboratory
 
ggtimeseries-->ggplot2 extensions
ggtimeseries-->ggplot2 extensions ggtimeseries-->ggplot2 extensions
ggtimeseries-->ggplot2 extensions
 
Naive application of Machine Learning to Software Development
Naive application of Machine Learning to Software DevelopmentNaive application of Machine Learning to Software Development
Naive application of Machine Learning to Software Development
 
Deep learning with C++ - an introduction to tiny-dnn
Deep learning with C++  - an introduction to tiny-dnnDeep learning with C++  - an introduction to tiny-dnn
Deep learning with C++ - an introduction to tiny-dnn
 

Mehr von indico data

Small Data for Big Problems: Practical Transfer Learning for NLP
Small Data for Big Problems: Practical Transfer Learning for NLPSmall Data for Big Problems: Practical Transfer Learning for NLP
Small Data for Big Problems: Practical Transfer Learning for NLPindico data
 
Getting to AI ROI: Finding Value in Your Unstructured Content
Getting to AI ROI: Finding Value in Your Unstructured ContentGetting to AI ROI: Finding Value in Your Unstructured Content
Getting to AI ROI: Finding Value in Your Unstructured Contentindico data
 
Everything You Wanted to Know About Optimization
Everything You Wanted to Know About OptimizationEverything You Wanted to Know About Optimization
Everything You Wanted to Know About Optimizationindico data
 
ODSC East: Effective Transfer Learning for NLP
ODSC East: Effective Transfer Learning for NLPODSC East: Effective Transfer Learning for NLP
ODSC East: Effective Transfer Learning for NLPindico data
 
Getting started with indico APIs [Python]
Getting started with indico APIs [Python]Getting started with indico APIs [Python]
Getting started with indico APIs [Python]indico data
 
Introduction to Deep Learning with Python
Introduction to Deep Learning with PythonIntroduction to Deep Learning with Python
Introduction to Deep Learning with Pythonindico data
 

Mehr von indico data (6)

Small Data for Big Problems: Practical Transfer Learning for NLP
Small Data for Big Problems: Practical Transfer Learning for NLPSmall Data for Big Problems: Practical Transfer Learning for NLP
Small Data for Big Problems: Practical Transfer Learning for NLP
 
Getting to AI ROI: Finding Value in Your Unstructured Content
Getting to AI ROI: Finding Value in Your Unstructured ContentGetting to AI ROI: Finding Value in Your Unstructured Content
Getting to AI ROI: Finding Value in Your Unstructured Content
 
Everything You Wanted to Know About Optimization
Everything You Wanted to Know About OptimizationEverything You Wanted to Know About Optimization
Everything You Wanted to Know About Optimization
 
ODSC East: Effective Transfer Learning for NLP
ODSC East: Effective Transfer Learning for NLPODSC East: Effective Transfer Learning for NLP
ODSC East: Effective Transfer Learning for NLP
 
Getting started with indico APIs [Python]
Getting started with indico APIs [Python]Getting started with indico APIs [Python]
Getting started with indico APIs [Python]
 
Introduction to Deep Learning with Python
Introduction to Deep Learning with PythonIntroduction to Deep Learning with Python
Introduction to Deep Learning with Python
 

Kürzlich hochgeladen

Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxolyaivanovalion
 
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779Delhi Call girls
 
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceBDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceDelhi Call girls
 
Data-Analysis for Chicago Crime Data 2023
Data-Analysis for Chicago Crime Data  2023Data-Analysis for Chicago Crime Data  2023
Data-Analysis for Chicago Crime Data 2023ymrp368
 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfMarinCaroMartnezBerg
 
Zuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptxZuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptxolyaivanovalion
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxolyaivanovalion
 
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...amitlee9823
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Researchmichael115558
 
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...amitlee9823
 
BigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxBigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxolyaivanovalion
 
Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxolyaivanovalion
 
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...SUHANI PANDEY
 
VidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxVidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxolyaivanovalion
 
Smarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxSmarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxolyaivanovalion
 
Halmar dropshipping via API with DroFx
Halmar  dropshipping  via API with DroFxHalmar  dropshipping  via API with DroFx
Halmar dropshipping via API with DroFxolyaivanovalion
 
Determinants of health, dimensions of health, positive health and spectrum of...
Determinants of health, dimensions of health, positive health and spectrum of...Determinants of health, dimensions of health, positive health and spectrum of...
Determinants of health, dimensions of health, positive health and spectrum of...shambhavirathore45
 
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...amitlee9823
 
Introduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxIntroduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxfirstjob4
 

Kürzlich hochgeladen (20)

Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptx
 
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
 
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceBDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
 
Data-Analysis for Chicago Crime Data 2023
Data-Analysis for Chicago Crime Data  2023Data-Analysis for Chicago Crime Data  2023
Data-Analysis for Chicago Crime Data 2023
 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdf
 
Zuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptxZuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptx
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptx
 
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Research
 
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
 
BigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxBigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptx
 
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptx
 
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
 
VidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxVidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptx
 
Smarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxSmarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptx
 
Halmar dropshipping via API with DroFx
Halmar  dropshipping  via API with DroFxHalmar  dropshipping  via API with DroFx
Halmar dropshipping via API with DroFx
 
Determinants of health, dimensions of health, positive health and spectrum of...
Determinants of health, dimensions of health, positive health and spectrum of...Determinants of health, dimensions of health, positive health and spectrum of...
Determinants of health, dimensions of health, positive health and spectrum of...
 
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
 
Introduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxIntroduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptx
 

TensorFlow in Practice

  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 8.
  • 9.
  • 15. Inputs (placeholders) import tensorflow as tf temp = tf.placeholder(tf.float32, [10, 1]) cake_doneness = tf.placeholder(tf.float32, [10, 1])
  • 16. import tensorflow as tf temp = tf.placeholder(tf.float32, [10, 1]) cake_doneness = tf.placeholder(tf.float32, [10, 1]) temp_m = tf.get_variable(‘temp_m’, [1, 1]) temp_b = tf.get_variable(‘temp_b’, [1]) predicted_output = tf.nn.xw_plus_b(temp, temp_m , temp_b) Parameters and Operations (m, b) Outputs (y)
  • 17. import tensorflow as tf temp = tf.placeholder(tf.float32, [10, 1]) cake_doneness = tf.placeholder(tf.float32, [10, 1] temp_m = tf.get_variable(‘temp_m’, [1, 1]) temp_b = tf.get_variable(‘temp_b’, [1]) predicted_output = tf.nn.xw_plus_b(temp, temp_m , temp_b) cost = tf.reduce_mean((cake_doneness – predicted_output)**2) Cost
  • 18. import tensorflow as tf temp = tf.placeholder(tf.float32, [10, 1]) cake_doneness = tf.placeholder(tf.float32, [10, 1]) temp_m = tf.get_variable(‘temp_m’, [1, 1]) temp_b = tf.get_variable(‘temp_b’, [1]) predicted_output = tf.nn.xw_plus_b(temp, temp_m , temp_b) cost = tf.reduce_mean((cake_doneness –predicted_output)**2) optimizer = tf.train.GradientDescentOptimizer(learning_rate=0.01). minimize(cost) Optimizer
  • 19. import tensorflow as tf temp = tf.placeholder(tf.float32, [10, 1]) cake_doneness = tf.placeholder(tf.float32, [10, 1]) temp_m = tf.get_variable(‘temp_m’, [1, 1]) temp_b = tf.get_variable(‘temp_b’, [1]) predicted_output = tf.nn.xw_plus_b(temp, temp_m , temp_b) cost = tf.reduce_mean((cake_doneness –predicted_output) 2) optimizer = tf.train.GradientDescentOptimizer(learning_rate=0.01).minimize(cost) sess = tf.Session() sess.run(tf.initialize_all_variables()) temp_train = np.linspace(0, 10, 10).reshape(-1, 1) doneness_train = temp_observe * 5. + 1. + np.random.randn(10, 1) for _ in range(100): sess.run(optimizer, feed_dict={temp: temp_train, cake_doneness: doneness_train}) predicted_doneness = sess.run(predicted_output, feed_dict={temp: temp_train}) Train Code
  • 24. Handwritten Digit (28 x 28 pixels) -> 784 pixels Predicted Digit Value
  • 25. X (pixels) [784] softmax( mx + b) m b Y_true [10]
  • 27. import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets('MNIST_data', one_hot=True) X = tf.placeholder(tf.float32, [128, 784]) Y_true = tf.placeholder(tf.float32, [128, 10]) Placeholders
  • 28. import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets('MNIST_data', one_hot=True) X = tf.placeholder(tf.float32, [128, 784]) Y_true = tf.placeholder(tf.float32, [128, 10]) m = tf.get_variable('m', [784, 10]) b = tf.get_variable('b', [10]) Y_pred = tf.nn.xw_plus_b(X, m, b) Parameters and Operations
  • 29. import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets('MNIST_data', one_hot=True) X = tf.placeholder(tf.float32, [128, 784]) Y_true = tf.placeholder(tf.float32, [128, 10]) m = tf.get_variable('m', [784, 10]) b = tf.get_variable('b', [10]) Y_pred = tf.nn.xw_plus_b(X, m, b) cost = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits( Y_pred, Y_true)) Cost
  • 30. import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets('MNIST_data', one_hot=True) X = tf.placeholder(tf.float32, [128, 784]) Y_true = tf.placeholder(tf.float32, [128, 10]) m = tf.get_variable('m', [784, 10]) b = tf.get_variable('b', [10]) Y_pred = tf.nn.xw_plus_b(X, m, b) cost = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(Y_pred, Y_true)) optimzer = tf.train.GradientDescentOptimizer(learning_rate=0.5) .minimize(cost) Optimizer
  • 31. import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets('MNIST_data', one_hot=True) X = tf.placeholder(tf.float32, [128, 784]) Y_true = tf.placeholder(tf.float32, [128, 10]) m = tf.get_variable('m', [784, 10]) b = tf.get_variable('b', [10]) Y_pred = tf.nn.xw_plus_b(X, m, b) cost = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(Y_pred, Y_true)) optimzer = tf.train.GradientDescentOptimizer(learning_rate=0.5) .minimize(cost) sess = tf.Session() sess.run(tf.initialize_all_variables()) for i in range(2000): trX, trY = mnist.train.next_batch(128) sess.run(optimzer, feed_dict={X: trX, Y_true: trY}) Train Code
  • 36. Relu 𝑌 = 𝑥 𝑖𝑓 𝑥 > 0 0 𝑒𝑙𝑠𝑒
  • 37. X (pixels) [784] softmax( m1h + b1) m0 b0 Y_true [10] m1 b1 relu( m0x + b0) h hidden layer classifier layer
  • 38. import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets('MNIST_data', one_hot=True) X = tf.placeholder(tf.float32, [128, 784]) Y_true = tf.placeholder(tf.float32, [128, 10]) Placeholders
  • 39. import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets('MNIST_data', one_hot=True) X = tf.placeholder(tf.float32, [128, 784]) Y_true = tf.placeholder(tf.float32, [128, 10]) m0 = tf.get_variable('m0', [784, 256]) b0 = tf.get_variable('b0', [256], initializer=tf.constant_initializer(0.)) m1 = tf.get_variable('m1', [256, 10]) b1 = tf.get_variable('b1', [10], initializer=tf.constant_initializer(0.)) h = tf.nn.relu(tf.nn.xw_plus_b(X, m0, b0)) Y_pred = tf.nn.xw_plus_b(h, m1, b1) Parameters and Operations
  • 40. import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets('MNIST_data', one_hot=True) X = tf.placeholder(tf.float32, [128, 784]) Y_true = tf.placeholder(tf.float32, [128, 10]) m0 = tf.get_variable('m0', [784, 256]) b0 = tf.get_variable('b0', [256], initializer=tf.constant_initializer(0.)) m1 = tf.get_variable('m1', [256, 10]) b1 = tf.get_variable('b1', [10], initializer=tf.constant_initializer(0.)) h = tf.nn.relu(tf.nn.xw_plus_b(X, m0, b0)) Y_pred = tf.nn.xw_plus_b(h, m1, b1) cost = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits( Y_pred, Y_true)) Cost
  • 41. import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets('MNIST_data', one_hot=True) X = tf.placeholder(tf.float32, [128, 784]) Y_true = tf.placeholder(tf.float32, [128, 10]) m0 = tf.get_variable('m0', [784, 256]) b0 = tf.get_variable('b0', [256], initializer=tf.constant_initializer(0.)) m1 = tf.get_variable('m1', [256, 10]) b1 = tf.get_variable('b1', [10], initializer=tf.constant_initializer(0.)) h = tf.nn.relu(tf.nn.xw_plus_b(X, m0, b0)) Y_pred = tf.nn.xw_plus_b(h, m1, b1) cost = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(Y_pred, Y_true)) optimzer = tf.train.GradientDescentOptimizer(learning_rate=0.5) .minimize(cost) Optimizer
  • 42. import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets('MNIST_data', one_hot=True) X = tf.placeholder(tf.float32, [128, 784]) Y_true = tf.placeholder(tf.float32, [128, 10]) m0 = tf.get_variable('m0', [784, 256]) b0 = tf.get_variable('b0', [256], initializer=tf.constant_initializer(0.)) m1 = tf.get_variable('m1', [256, 10]) b1 = tf.get_variable('b1', [10], initializer=tf.constant_initializer(0.)) h = tf.nn.relu(tf.nn.xw_plus_b(X, m0, b0)) Y_pred = tf.nn.xw_plus_b(h, m1, b1) cost = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(Y_pred, Y_true)) optimzer = tf.train.GradientDescentOptimizer(learning_rate=0.5) .minimize(cost) sess = tf.Session() sess.run(tf.initialize_all_variables()) for i in range(2000): trX, trY = mnist.train.next_batch(128) sess.run(optimzer, feed_dict={X: trX, Y_true: trY}) Train Code
  • 43. 97% Test Accuracy! (97% train accuracy)
  • 44. m0 m1 m2b0 b1 b2 X (pixels) [784] relu( m0x + b0) relu( m1x + b1) softmax( m2h1 + b2) Y_true [10] h1 h2 hidden layer 1 classifier layerhidden layer 2
  • 45. def model(X): m0 = tf.get_variable('m0', [784, 256]) b0 = tf.get_variable('b0', [256], initializer=tf.constant_initializer(0.)) m1 = tf.get_variable('m1', [256, 256]) b1 = tf.get_variable('b1', [256], initializer=tf.constant_initializer(0.)) m2 = tf.get_variable('m2', [256, 10]) b2 = tf.get_variable('b2', [10], initializer=tf.constant_initializer(0.)) h1 = tf.nn.relu(tf.nn.xw_plus_b(X, m0, b0)) h2 = tf.nn.relu(tf.nn.xw_plus_b(h1, m1, b1)) output = tf.nn.xw_plus_b(h2, m2, b2) return output Y_pred = model(X) Parameters and Operations (with 2 hidden layers)
  • 46. 97% Test Accuracy! (98% train accuracy)
  • 48. mx + bx y
  • 50. def model(X, p_keep): m0 = tf.get_variable('m0', [784, 256]) b0 = tf.get_variable('b0', [256], initializer=tf.constant_initializer(0.)) m1 = tf.get_variable('m1', [256, 256]) b1 = tf.get_variable('b1', [256], initializer=tf.constant_initializer(0.)) m2 = tf.get_variable('m2', [256, 10]) b2 = tf.get_variable('b2', [10], initializer=tf.constant_initializer(0.)) h1 = tf.nn.relu(tf.nn.xw_plus_b(X, m0, b0)) h1 = tf.nn.dropout(h1, p_keep) h2 = tf.nn.relu(tf.nn.xw_plus_b(h1, m1, b1)) h2 = tf.nn.dropout(h2, p_keep) output = tf.nn.xw_plus_b(h2, m2, b2) return output Y_pred = model(X, 0.8) Y_pred_test = model(X, 1.) Parameters and Operations (with 2 hidden layers and dropout)
  • 51. m0 m1 m2b0 b1 b2 X (pixels) [784] relu( m0x + b0) relu( m1x + b1) softmax( m2h1 + b2) Y_true [10] Dropout(h1) Dropout(h2) hidden layer 1 classifier layerhidden layer 2
  • 52. 98% Test Accuracy! (98% train accuracy)
  • 54. Scaling Predictions X (pixels) [784] m b softmax( mx + b) Y_true [10] X = tf.placeholder(tf.float32, [128, 784]) Y_true = tf.placeholder(tf.float32, [128, 10]) m = tf.get_variable('m', [784, 10]) b = tf.get_variable('b', [10]) Y_pred = tf.nn.xw_plus_b(X, m, b) cost = tf.reduce_mean(tf.nn.softmax_cross_entrop y_with_logits(Y_pred, Y_true)) VS. cost = tf.reduce_mean(tf.nn.softmax_cross_entrop y_with_logits(tf.nn.softmax(Y_pred) , Y_true))
  • 55. Parameter Sharing def model(X, p_keep): m0 = tf.get_variable('m0', [784, 256]) b0 = tf.get_variable('b0', [256], initializer=tf.constant_initializer(0.)) m1 = tf.get_variable('m1', [256, 256]) b1 = tf.get_variable('b1', [256], initializer=tf.constant_initializer(0.)) m2 = tf.get_variable('m2', [256, 10]) b2 = tf.get_variable('b2', [10], initializer=tf.constant_initializer(0.)) h1 = tf.nn.relu(tf.nn.xw_plus_b(X, m0, b0)) h1 = tf.nn.dropout(h1, p_keep) h2 = tf.nn.relu(tf.nn.xw_plus_b(h1, m1, b1)) h2 = tf.nn.dropout(h2, p_keep) output = tf.nn.xw_plus_b(h2, m2, b2) return output Y_pred = model(X, 0.8) Y_pred_test = model(X, 1.)
  • 56. m0 m1 m2b0 b1 b2 X (pixels) [784] relu( m0x + b0) relu( m1x + b1) softmax( m2h1 + b2) Y_true [10] Dropout(h1) Dropout(h2) m0_test m1_test m2_testb0_test b1_test b2_test X (pixels) [784] relu( m0x + b0) relu( m1x + b1) softmax( m2h1 + b2) Y_true [10] Dropout(h1) Dropout(h2) Y_pred = model(X, 0.8) Y_pred = model(X, 1.)
  • 57. m0 m1 m2b0 b1 b2 X (pixels) [784] relu( m0x + b0) relu( m1x + b1) softmax( m2h1 + b2) Y_true [10] Dropout(h1) Dropout(h2) m0_test m1_test m2_testb0_test b1_test b2_test X (pixels) [784] relu( m0x + b0) relu( m1x + b1) softmax( m2h1 + b2) Y_true [10] Dropout(h1) Dropout(h2) Y_pred = model(X, 0.8) Y_pred = model(X, 1.)
  • 58. m0 m1 m2b0 b1 b2 X (pixels) [784] relu( m0x + b0) relu( m1x + b1) softmax( m2h1 + b2) Y_true [10] Dropout(h1) Dropout(h2) m0 m1 m2b0 b1 b2 X (pixels) [784] relu( m0x + b0) relu( m1x + b1) softmax( m2h1 + b2) Y_true [10] Dropout(h1) Dropout(h2) Y_pred = model(X, 0.8) Y_pred = model(X, 1.)
  • 59. Parameter Sharing (correct) def model(X, p_keep): m0 = tf.get_variable('m0', [784, 256]) b0 = tf.get_variable('b0', [256], initializer=tf.constant_initializer(0.)) m1 = tf.get_variable('m1', [256, 256]) b1 = tf.get_variable('b1', [256], initializer=tf.constant_initializer(0.)) m2 = tf.get_variable('m2', [256, 10]) b2 = tf.get_variable('b2', [10], initializer=tf.constant_initializer(0.)) h1 = tf.nn.relu(tf.nn.xw_plus_b(X, m0, b0)) h1 = tf.nn.dropout(h1, p_keep) h2 = tf.nn.relu(tf.nn.xw_plus_b(h1, m1, b1)) h2 = tf.nn.dropout(h2, p_keep) output = tf.nn.xw_plus_b(h2, m2, b2) return output with tf.variable_scope(“model”) as scope: Y_pred = model(X, 0.8) scope.reuse_variables() Y_pred_test = model(X, 1.)
  • 60. Collections def model(X): m0 = tf.get_variable('m0', [784, 256]) b0 = tf.get_variable('b0', [256], initializer=tf.constant_initializer(0.)) m1 = tf.get_variable('m1', [256, 256]) b1 = tf.get_variable('b1', [256], initializer=tf.constant_initializer(0.)) m2 = tf.get_variable('m2', [256, 10]) b2 = tf.get_variable('b2', [10], initializer=tf.constant_initializer(0.)) h1 = tf.nn.relu(tf.nn.xw_plus_b(X, m0, b0)) h2 = tf.nn.relu(tf.nn.xw_plus_b(h1, m1, b1)) tf.add_to_collection(“activations”, h1) tf.add_to_collection(“activations”, h2) output = tf.nn.xw_plus_b(h2, m2, b2) return output Y_pred = model(X)
  • 61. Collections activations = tf.get_collection(‘activations’) activations_values = session.run(activations) parameters = tf.get_collection(‘trainable_parameters’) parameter_values = session.run(parameters)
  • 62. X = tf.placeholder(tf.float32, [128, 784]) Placeholders
  • 63. X = tf.placeholder(tf.float32, [None, 784]) Placeholders
  • 64. Placeholders X = tf.placeholder(tf.float32, [None, 784]) model = … cost = … optimizer = … for i in range(1000): trX, trY = mnist.train.next_batch(128) sess.run(optimzer, feed_dict={X: trX, Y_true: trY})
  • 65. Placeholders X = tf.placeholder(tf.float32, [None, 784]) model = … cost = … optimizer = … for i in range(1000): trX, trY = mnist.train.next_batch(128) sess.run(optimzer, feed_dict={X: trX, Y_true: trY})
  • 66. Placeholders X = tf.placeholder(tf.float32, [None, 784]) model = … cost = … optimizer = … for i in range(1000): trX, trY = mnist.train.next_batch(512) sess.run(optimzer, feed_dict={X: trX, Y_true: trY})
  • 67. Advanced Tensorflow: Building RNNs Note – Most of the code for the generation is “pseudo-code” meant mostly to illustrate my point. If you wish to see the actual code, feel free to email me and I’ll send you a copy.
  • 68. RNNs “The food at the restaurant, was very good” [1]
  • 69. RNNs [The, food, at, the, restaurant, was, very, good] [1]
  • 70. RNNs [The, food, at, the, restaurant, was, very, good] [1] t = 7 t = 0 t = 1
  • 71. RNNs 𝑌𝑡 = 𝑡𝑎𝑛ℎ(𝑚 𝑥 𝑋𝑡 + 𝑚ℎℎ 𝑡−1 + 𝑏) mxXt + mhht-1+ b Xt ht ht-1
  • 72. RNNs X = tf.placeholder(tf.float32, [28, 128, 28]) X_split = [tf.squeeze(x) for x in tf.split(0, 28, X)] rnn = tf.nn.rnn_cell.BasicRNNCell(256, 28) outputs, states = tf.nn.rnn(rnn, X_split, dtype=tf.float32)
  • 73. Scan elems = [1, 2, 3, 4, 5, 6] def step(a, x): return a + x sum = scan(step, elems) >>> sum = [1, 3, 6, 10, 15, 21]
  • 74. RNNs with Scan X = tf.placeholder(tf.float32, [28, 128, 28]) m_x = tf.get_variable(‘m_x’, [28, 256]) m_h = tf.get_variable(‘m_h’, [256, 256]) def step(h_tm1, x): return tf.tanh(tf.nn.xw_plus_b(x, m_x, b_x) + tf.nn.xw_plus_b(h_tm1, m_h, b_h)) states = tf.scan(step, X, initializer=tf.zeros(256)) 𝑌𝑡 = 𝑡𝑎𝑛ℎ(𝑚 𝑥 𝑋𝑡 + 𝑚ℎℎ 𝑡−1 + 𝑏)
  • 76. MNIST Generation t = 28 t = 0 t = 28 t = 0
  • 77. X = tf.placeholder(tf.float32, [27, 128, 28]) # first 27 rows of image Y = tf.placeholder(tf.float32, [27, 128, 28]) # last 27 rows of image m_output = tf.get_variable(tf.float32, [256, 28]) b_output = tf.get_variable(tf.float32, [28]) states = rnn(X) output_img = tf.map_fn(lambda x: tf.nn.xw_plus_b(x, m_output, b_output), tf.pack(states)) cost = tf.reduce_mean(tf.nn.sigmoid_cross_entropy_with_logits(output_ img, Y)) Language Model
  • 78. def generate(num_steps): states = [tf.zeros([batch_size, hidden_dim])] for _ in range(num_steps): next_output = tf.sigmoid(tf.nn.xw_plus_b(states[-1], m_output, b_output)) outputs.append(next_output) state = gru.step_(states[-1], outputs[-1])) states.append(state) return tf.pack(outputs) Language Model (Generate)
  • 81. X = tf.placeholder(tf.float32, [27, 128, 28]) # first 27 rows of image Y_in = tf.placeholder(tf.float32, [27, 128, 28]) # first 27 rows of target image Y_out = tf.placeholder(tf.float32, [27, 128, 28]) # last 27 rows of target image m_output = tf.get_variable(tf.float32, [256, 28]) b_output = tf.get_variable(tf.float32, [28]) with tf.variable_scope(“encoder”) as scope: encoded_states = rnn(X) final_state = tf.reverse(encoded_states, [True, False, False])[0, :, :] with tf.variable_scope(“decoder”) as scope: output_states = rnn(Y_in, initializer=final_state) output_img = tf.map_fn(lambda x: tf.nn.xw_plus_b(x, m_output, b_output), tf.pack(output_states)) cost = tf.reduce_mean(tf.nn.sigmoid_cross_entropy_with_logits(output_img, Y_out)) Seq2Seq

Hinweis der Redaktion

  1. Welcome, my name is Nathan Lintz. I am a researcher at Indico Data Solutions and I spend a lot of time writing tensorflow. In this presentation we will learn how to build basic models in tensorflow, some tips and tricks to avoid common tensorflow pitfalls, and some advanced tensorflow techniques for building RNNs. Tensorflow, and to some extent machine learning more broadly is like learning how to bake a cake.
  2. M + b = parameters associated with baking Our operation is the multiply between m and x as well as the addition operation we apply with b
  3. Transition To Next Slide: While baking is cool, this is a somewhat contrived example. For our classification problem lets try something a bit more realistic, optical character recognition. We want to take an image consisting of black and white pixels and classify it as a digit from 0-9.
  4. Confidences 98 39 73 28
  5. If we didn’t have a nonlinearity, the hidden layer won’t do anything. For a sequence of linear operations there is an equivalent linear operation that only takes a single layer. Imagine we had a rubiks cube, the linear operations are like turning one of its faces. There are a limited number of transformations we can apply and they all kinda do the same thing, turn a face. In contrast, nonlinearities are like solving a rubiks cube in little brother mode where you smash it and then rebuild it. Nonlinearities let us smash features from our model in ways that linear operations simply cannot perform. Therefore they give our model more flexibility in solving its task.
  6. I’d like to call out here that the only new part of this model is the hidden layer
  7. Transition: In addition to monitoring the model on test data, examples the model hasn’t seen, we’re also going to monitor the accuracy on train data, the examples it already has seen.
  8. Overfitting can occur when the model has too many parameters. It learns an overly complex set of parameters to reduce the train which don’t generalize to our test data.
  9. Dropout forces the model to learn more general representations. The parameters can’t get lazy and rely on eachother too heavily as they could with our original model. Dropout forces each parameter to learn how to process a useful feature from the data making them better at generalizing. Its kinda like good software design. You don’t want yourcomponents to be too tightly coupled. Sure, a tightly coupled system might be able to solve the task you’re working on currently. But as soon as you need to extend your system to new challenges, you run into trouble.
  10. I’d like to call out here that the p_keep value we are setting is how likely we are to keep an activation. 0.8 means keep any given activation with an 80% probability. 1 means keep all of the activations.
  11. Explicit about that p_keep is a little confusing
  12. If you look at it all at once, you cant account for stuff like position of the word. The food at the restaurant was very good == restaurant the food good restaurant or w/e
  13. Transition, explain that since we compute time t, this model can be used in a generative fashion as well. RNNs can be run in different modes. At train time we treat it like a standard neural network. Alternatively, we can run the rnn in generation mode where we take an element of the input sequence at time t, we apply our rnn, compute the t+1 element of our sequence. We then feed the t+1 element back in to generate the t+2 element and so on.