Sine wave regression using Reptile

In the last section, we saw how Reptile works. Now, we'll understand Reptile better by coding it from scratch. Let's say we have a collection of tasks and the goal of each task is to regress the output of the sine wave given some input. So what do we mean by that?

Let's say y = amplitude*sin(x+phase). The goal of our algorithm is to learn to regress the value of y given x. The value of amplitude is chosen randomly between 0.1 and 5.0 and the value of phase is chosen randomly between 0 and . So, for each of the tasks, we sample only 10 data points and train the network—that is, for each of the tasks, we sample only 10 (x,y) pairs. Let's get to the code and see it in detail.

You can also check the code available as a Jupyter Notebook with an explanation here: https://github.com/sudharsan13296/Hands-On-Meta-Learning-With-Python/blob/master/07.%20Meta-SGD%20and%20Reptile%20Algorithms/7.7%20Sine%20wave%20Regression%20Using%20Reptile.ipynb.

First, we import all of the necessary libraries:

import tensorflow as tf
import numpy as np
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.93.132