How to implement Meta learning on the base model(neural network)

225 views Asked by At

I have a complex data in which there are only two features and around 18211 labels(Multi-label regression problem). The two features are categorical data, feature1 has 6 categories(A,B,C,D,E,F) and feature2 has 144 categories. Based on this, 18211 labels are predicted. The most tricky part is that training data consist only of 4 feature1 categories(A,B,C,D) and only handful number of other two category examples(E,F).Whereas, test data consist of only two categories (E and F). All those categories of feature1 are related to eachother. Basically, I have to make predictions on almost unseen categories.

feature1 feature2 label1 ---- label-18211
A xxx 0.321 ---- -0.787
B yyy -1.942 ---- 0.862

later, I encoded the features using one hot encoding and split data into training and validation data.


Data Configuration:

training data: features: (429, 152) labels: (429, 18211)

validation data: features: (185, 152) labels: (185, 18211)

One approach here can be "meta learning" where I can give the feature1 categories(A,B,C,D,E,F) as a "task" to the meta learner. I tried to implement the code using MAML algorithm in tensorflow, but failed multiple times. Please help for writing this code using tensorflow.

1

There are 1 answers

3
Chih-Hao Liu On

To apply the Model-Agnostic Meta-Learning (MAML) algorithm, you should begin by partitioning the data into two distinct sets: the support set and the query set.

enter image description here

Meta Training Stage

In the meta-training stage, your model undergoes training with various tasks drawn from the support set within the training dataset. Subsequently, the model's performance is assessed and validated using the query set within the training data.

Meta Testing Stage

During the meta-testing stage, the pre-trained model is further fine-tuned using the support set derived from the testing dataset. The ultimate evaluation of the model's performance is conducted using the query set from the testing dataset.

To implement the algorithm, you can refer the code as following link: https://github.com/hereismari/tensorflow-maml/blob/master/maml.ipynb

However, I personelly consider it may be difficult to use ML/DL algorithm to solve your problem, since the dimension of the label data is significantly larger than your feature. Therefore, it may be better to reduce the size of your label's dimenision.