Now, we define a class called ADML where we implement the ADML algorithm. In the __init__ method, we will initialize all of the necessary variables. Then, we define our sigmoid function and we define our train function.
We will see this step-by-step and later see the final code as a whole:
class ADML(object):
We define the __init__ method and initialize 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 = 2
We initialize a number of samples—that is, a number of shots—a number of data points (k) we need to have in each task:
self.num_samples = 10
We initialize a number of epochs—that is, training iterations:
self.epochs ...