How to do it...

  1. We'll start by loading libraries and starting a graph session:
import matplotlib.pyplot as plt 
import tensorflow as tf 
sess = tf.Session() 
  1. We then declare our constants and variables in the graph:
x_initial = tf.constant(1.0) 
y_initial = tf.constant(1.0) 
X_t1 = tf.Variable(x_initial) 
Y_t1 = tf.Variable(y_initial) 
# Make the placeholders 
t_delta = tf.placeholder(tf.float32, shape=()) 
a = tf.placeholder(tf.float32, shape=()) 
b = tf.placeholder(tf.float32, shape=()) 
c = tf.placeholder(tf.float32, shape=()) 
d = tf.placeholder(tf.float32, shape=()) 
  1. Next, we will implement the prior introduced discrete system, and then update the X and Y populations:
X_t2 = X_t1 + (a * X_t1 + b * X_t1 * Y_t1) * t_delta Y_t2 = Y_t1 + (c * ...

Get TensorFlow Machine Learning Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.