All Projects → clvrai → Maml Tf

clvrai / Maml Tf

Tensorflow Implementation of MAML

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Maml Tf

Bayesian Neural Networks
Pytorch implementations of Bayes By Backprop, MC Dropout, SGLD, the Local Reparametrization Trick, KF-Laplace, SG-HMC and more
Stars: ✭ 900 (+1945.45%)
Mutual labels:  regression
Mfe
Meta-Feature Extractor
Stars: ✭ 20 (-54.55%)
Mutual labels:  meta-learning
The Deep Learning With Keras Workshop
An Interactive Approach to Understanding Deep Learning with Keras
Stars: ✭ 34 (-22.73%)
Mutual labels:  regression
Breast Cancer Prediction
Predicting the probability that a diagnosed breast cancer case is malignant or benign based on Wisconsin dataset
Stars: ✭ 19 (-56.82%)
Mutual labels:  regression
Transferlearning
Transfer learning / domain adaptation / domain generalization / multi-task learning etc. Papers, codes, datasets, applications, tutorials.-迁移学习
Stars: ✭ 8,481 (+19175%)
Mutual labels:  meta-learning
Deep learning projects
Stars: ✭ 28 (-36.36%)
Mutual labels:  regression
Learningtocompare fsl
PyTorch code for CVPR 2018 paper: Learning to Compare: Relation Network for Few-Shot Learning (Few-Shot Learning part)
Stars: ✭ 837 (+1802.27%)
Mutual labels:  meta-learning
Chemometricstools.jl
A collection of tools for chemometrics and machine learning written in Julia.
Stars: ✭ 39 (-11.36%)
Mutual labels:  regression
Tribuo
Tribuo - A Java machine learning library
Stars: ✭ 882 (+1904.55%)
Mutual labels:  regression
Learning To Learn By Pytorch
"Learning to learn by gradient descent by gradient descent "by PyTorch -- a simple re-implementation.
Stars: ✭ 31 (-29.55%)
Mutual labels:  meta-learning
Owl
Owl - OCaml Scientific and Engineering Computing @ http://ocaml.xyz
Stars: ✭ 919 (+1988.64%)
Mutual labels:  regression
Rlur
Shiny dashboard for Land Use Regression modelling
Stars: ✭ 8 (-81.82%)
Mutual labels:  regression
Mt Net
Code accompanying the ICML-2018 paper "Gradient-Based Meta-Learning with Learned Layerwise Metric and Subspace"
Stars: ✭ 30 (-31.82%)
Mutual labels:  meta-learning
Tidyreg
🎓 Tidy regression tools for academics
Stars: ✭ 19 (-56.82%)
Mutual labels:  regression
Mlj.jl
A Julia machine learning framework
Stars: ✭ 982 (+2131.82%)
Mutual labels:  regression
Hcn Prototypeloss Pytorch
Hierarchical Co-occurrence Network with Prototype Loss for Few-shot Learning (PyTorch)
Stars: ✭ 17 (-61.36%)
Mutual labels:  meta-learning
Ailearning
AiLearning: 机器学习 - MachineLearning - ML、深度学习 - DeepLearning - DL、自然语言处理 NLP
Stars: ✭ 32,316 (+73345.45%)
Mutual labels:  regression
Machine Learning From Scratch
Succinct Machine Learning algorithm implementations from scratch in Python, solving real-world problems (Notebooks and Book). Examples of Logistic Regression, Linear Regression, Decision Trees, K-means clustering, Sentiment Analysis, Recommender Systems, Neural Networks and Reinforcement Learning.
Stars: ✭ 42 (-4.55%)
Mutual labels:  regression
Yannl
Yet another neural network library
Stars: ✭ 37 (-15.91%)
Mutual labels:  regression
Few Shot Text Classification
Few-shot binary text classification with Induction Networks and Word2Vec weights initialization
Stars: ✭ 32 (-27.27%)
Mutual labels:  meta-learning

MAML implementation in Tensorflow

As part of the implementation series of Joseph Lim's group at USC, our motivation is to accelerate (or sometimes delay) research in the AI community by promoting open-source projects. To this end, we implement state-of-the-art research papers, and publicly share them with concise reports. Please visit our group github site for other projects.

This project is implemented by Yuan-Hong Liao and the codes have been reviewed by Youngwoon Lee before being published.

Description

Model-Agnostic Meta-Learning for Fast Adaptation of Deep Networks (MAML) aims to learn the representation that is able to adapt to new environments/goals/tasks in a few shots. Many recent work on few-shot learning rely on meta-learning[1,2]. Following the mainstream of previous work, MAML proposed a general meta-learning framework for few-shot learning and conducted experiments on regression, classificaiton, and reinforcement learning problems.

The main idea of MAML is to minimize the number of gradient updates required to adapt to any new tasks. In other words, MAML tries to find parameters that can easily and quickly adapt to all tasks. In each iteration, a batch of tasks are sampled and data of each sampled task is splitted into meta-train and meta-val. For K-shot learning, we sample K example(s) from the meta-train. A meta network $\theta$ is trained for each task i using mata-train. Hence, we can get $\theta_{i}$ for each task i which simulates one-shot (few-shot) learning for the task i. Then, the meta loss for taks i is computed using $\theta_{i}$ with meta-val. At the end of each iteration, the parameters are updated to minimize the sum of losses from all taks.

The following figure is the pseudocode of MAML:

Note that this implementation may differ in details from the original paper such as model architectures, hyperparameters, applied optimizer, etc. while maintaining the main proposed idea.

*This code is still being developed and subject to change.

Prerequisites

Usage

Regression

Train 5-shot regreesion model:

python main.py --dataset sin --K 5 --num_updates 1 --norm None --is_train

Details about the training FLAGs

--K: draw K samples as meta-train and meta-val
--model_type: for regression, I only use fully connected layers
--loss_type: for regression, I use MeanSquareError as loss criterion
--num_updates: do `num_updates` graident step for meta-step
--norm: use batch_norm or not
--alpha: learning rate for meta-train (same notation as the paper)
--beta: learning rate for meta-val (same notation as the paper)
--is_train: speficy a training phase

Evalaute the model (either specify the directory of the checkpoint or the checkpoint itself):

python main.py --dataset sin --K 5 --num_updates 5 --norm None --restore_checkpoint PATH_TO_CHECKPOINT

Details about the evaluation FLAGs (some are overlapped with training)

--K: draw K samples as meta-train and meta-val
--num_updates: do `num_updates` graident step for meta-step
--restore_checkpoint: specify the path to the checkpoint
--restore_dir: specify the path to the directory of the checkpoint (directly choose the latest one)
--test_sample: number of testing samples
--draw: visualize or not

Results

Regression

Model trained on: 10-shots, 1 updates, batch_size=25, without batch normalization

Results (updates=1) Results (updates=5) Results (updates=10)
5-shots
L2 loss 0.6609 0.3024 0.2714
10-shots
L2 loss 0.4506 0.2024 0.1903

For more regression results: check here

What's inside the training?

Tricks

For regression, don't use batch normalization if the K is small (e.g., less than 10).

References

  • [1] Matching Networks for One Shot Learning
  • [2] Optimization as a Model for Few-Shot Learning
  • [3] Model-Agnostic Meta-Learning for Fast Adaptation of Deep Networks
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].