Now, let's see how CAML works steps by step:
- Let's say we have a model f parameterized by a parameter θ and we have a distribution over tasks p(T). First, we randomly initialize the model parameter θ. We also initialize our context parameter ∅0= 0.
- Now, we sample some batch of tasks Ti from a distribution of tasks, that is, Ti ∼ p(T).
- Inner loop: For each task (Ti) in tasks (T), we sample k data points and prepare our train and test datasets:
Now, we set our context parameter to 0:
Then, we calculate loss on , minimize the loss using gradient descent, and learn the task specific parameter ∅i:
- Outer loop: Now, we perform meta optimization in the test set—that is, here we try to minimize the loss in the test set and find the optimal parameter:
- Repeat steps 2 to step 4 for n number of iterations.