Answers.Body: <p>I assume in your case what you need to be doing is to collate your 3 datasets together - these would form the training dataset, and then leave the testing dataset aside.</p>
  <p>During Meta-Training, the code will sample a batch of tasks in each iteration. This batch of tasks will be split into support and query, the algorithm will train on the support and update model parameters, then it will test on the query and then re-update initial theta.</p>
  <p>This Meta-Training is a form of 'cross validation'. Now during meta testing, you must ensure that it samples from the testing dataset.</p>
  <p>You can use this <a href="https://github.com/cbfinn/maml" rel="nofollow noreferrer">code</a> as a start. In <code>data_generator.py</code> it has a place where it splits the images into training and validation. What you need to be doing is to do the same thing but for your structured data, there, you will specify which datasets to sample for training and which dataset to sample for testing.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-06-06T10:08:35.987Z
Answers.LastActivityDate: 2021-06-06T10:08:35.987Z
Answers.UserDisplayName: Perl Del Rey
Body: <p>I've been trying to understand the meta-learning paradigm, more precisely, the optimization-based models, such as <a href="https://arxiv.org/abs/1703.03400" rel="nofollow noreferrer">MAML</a>, but I have a hard time understanding how I should correctly split my data to train such models.</p>
  <p>For example, let's consider we have 4 traffic datasets, and we would like to use 3 of them as source datasets (to train the model) and the remaining one as target (to fine-tune on it and then test the model performance). As far as I understood, for each source dataset, I need to split it into train and validation. During training, I would randomly select 2 batches of samples from the training datasets, use one batch to compute the task-specific parameters and the other one to compute the loss. Then repeat the same process with the validation dataset, such that I can select the best candidate model. After the training is done, I need to fine-tune the model on the target dataset. I assume the process is the same, but I need to use the target dataset instead.</p>
  <p>During testing (after the model is fully learned and fine-tuned), how exactly do I test it? It is the same procedure as if I was training a supervised model? I would like to know if the setup I described is correct and it fits the meta-learning paradigm.</p>
  
Tags: <meta-learning><training-datasets><model-agnostic-meta-learning>
Title: How to split data for meta-learning?
UserDisplayName: razvanc92
ThreadText: # How to split data for meta-learning?
  
  (Asked by: username_0 on 2021-03-17)
  
  I've been trying to understand the meta-learning paradigm, more precisely, the optimization-based models, such as [MAML](https://arxiv.org/abs/1703.03400), but I have a hard time understanding how I should correctly split my data to train such models.
  
  For example, let's consider we have 4 traffic datasets, and we would like to use 3 of them as source datasets (to train the model) and the remaining one as target (to fine-tune on it and then test the model performance). As far as I understood, for each source dataset, I need to split it into train and validation. During training, I would randomly select 2 batches of samples from the training datasets, use one batch to compute the task-specific parameters and the other one to compute the loss. Then repeat the same process with the validation dataset, such that I can select the best candidate model. After the training is done, I need to fine-tune the model on the target dataset. I assume the process is the same, but I need to use the target dataset instead.
  
  During testing (after the model is fully learned and fine-tuned), how exactly do I test it? It is the same procedure as if I was training a supervised model? I would like to know if the setup I described is correct and it fits the meta-learning paradigm.
  
  **Tags:** meta-learning, training-datasets, model-agnostic-meta-learning
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-06-06. Score: 2
  
  I assume in your case what you need to be doing is to collate your 3 datasets together - these would form the training dataset, and then leave the testing dataset aside.
  
  During Meta-Training, the code will sample a batch of tasks in each iteration. This batch of tasks will be split into support and query, the algorithm will train on the support and update model parameters, then it will test on the query and then re-update initial theta.
  
  This Meta-Training is a form of 'cross validation'. Now during meta testing, you must ensure that it samples from the testing dataset.
  
  You can use this [code](https://github.com/cbfinn/maml) as a start. In `data_generator.py` it has a place where it splits the images into training and validation. What you need to be doing is to do the same thing but for your structured data, there, you will specify which datasets to sample for training and which dataset to sample for testing.
  
  
  ---
  
  