December 2018
Beginner to intermediate
226 pages
7h 59m
English
Now we'll see how can we find the optimal parameters of our neural network with Reptile.
First, we initialize the necessary variables:
#number of epochs i.e training iterationsnum_epochs = 100#number of samples i.e number of shotsnum_samples = 50 #number of tasksnum_tasks = 2#number of times we want to perform optimizationnum_iterations = 10#mini btach sizemini_batch = 10
Then, we start the TensorFlow session:
with tf.Session() as sess: sess.run(init)
For the number of epochs:
for e in range(num_epochs): #for each task in batch of tasks for task in range(num_tasks):
We get the initial parameters of the model:
old_w1, old_b1, old_w2, old_b2 = sess.run([w1, b1, w2, b2,])
Then, we sample x and y:
x_sample, y_sample = sample_points(num_samples) ...
Read now
Unlock full access