Click4Ai

467.

Hard

Meta-Learning Basics

====================

In this problem, you will be implementing a meta-learning model using a Model-Agnostic Meta-Learning (MAML) algorithm.

**Example:** Given a set of tasks, adapt the model to each task and evaluate its performance.

**Constraints:** Use a MAML algorithm with a model-agnostic loss function and a first-order approximation.

**Note:** You can assume the task is represented as a dictionary with input and output data.

Test Cases

Test Case 1
Input: [{'input': np.array([1, 2, 3, 4, 5]), 'output': np.array([6, 7, 8, 9, 10])}, {'input': np.array([11, 12, 13, 14, 15]), 'output': np.array([16, 17, 18, 19, 20])}]
Expected: [0.5, 0.5]
Test Case 2
Input: [{'input': np.array([21, 22, 23, 24, 25]), 'output': np.array([26, 27, 28, 29, 30])}, {'input': np.array([31, 32, 33, 34, 35]), 'output': np.array([36, 37, 38, 39, 40])}]
Expected: [0.5, 0.5]
+ 3 hidden test cases