Training using MAML

Now, we define a class called MAML where we implement the MAML algorithm. In the __init__ method, we will initialize all of the necessary variables. Then, we define our sigmoid activation function. Following this we define our train function.

We define the class for implementing MAML:

class MAML(object):

We define the __init__ method and initialize all of the necessary variables:

def __init__(self):

We initialize a number of tasks—that is, the number of tasks we need in each batch of tasks:

        self.num_tasks = 10

Following is the number of samples—that is, number of shots—a number of data points (k) we need to have in each task:

        self.num_samples = 10

Following is the number of epochs, that is, training iterations:

 self.epochs ...

Get Hands-On Meta Learning with Python 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.