All Projects → mailong25 → Meta Learning Bert

mailong25 / Meta Learning Bert

Meta learning with BERT as a learner

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Meta Learning Bert

Kaggle-Twitter-Sentiment-Analysis
Kaggle Twitter Sentiment Analysis Competition
Stars: ✭ 18 (-65.38%)
Mutual labels:  sentiment-analysis, text-classification
Sentiment analysis fine grain
Multi-label Classification with BERT; Fine Grained Sentiment Analysis from AI challenger
Stars: ✭ 546 (+950%)
Mutual labels:  text-classification, sentiment-analysis
Bertweet
BERTweet: A pre-trained language model for English Tweets (EMNLP-2020)
Stars: ✭ 282 (+442.31%)
Mutual labels:  text-classification, sentiment-analysis
NSP-BERT
The code for our paper "NSP-BERT: A Prompt-based Zero-Shot Learner Through an Original Pre-training Task —— Next Sentence Prediction"
Stars: ✭ 166 (+219.23%)
Mutual labels:  sentiment-analysis, text-classification
Omnicat Bayes
Naive Bayes text classification implementation as an OmniCat classifier strategy. (#ruby #naivebayes)
Stars: ✭ 30 (-42.31%)
Mutual labels:  text-classification, sentiment-analysis
Meta-SelfLearning
Meta Self-learning for Multi-Source Domain Adaptation: A Benchmark
Stars: ✭ 157 (+201.92%)
Mutual labels:  domain-adaptation, meta-learning
Multitask Learning
Awesome Multitask Learning Resources
Stars: ✭ 361 (+594.23%)
Mutual labels:  meta-learning, domain-adaptation
Text tone analyzer
Система, анализирующая тональность текстов и высказываний.
Stars: ✭ 15 (-71.15%)
Mutual labels:  sentiment-analysis, text-classification
Transferlearning
Transfer learning / domain adaptation / domain generalization / multi-task learning etc. Papers, codes, datasets, applications, tutorials.-迁移学习
Stars: ✭ 8,481 (+16209.62%)
Mutual labels:  domain-adaptation, meta-learning
Chatbot cn
基于金融-司法领域(兼有闲聊性质)的聊天机器人,其中的主要模块有信息抽取、NLU、NLG、知识图谱等,并且利用Django整合了前端展示,目前已经封装了nlp和kg的restful接口
Stars: ✭ 791 (+1421.15%)
Mutual labels:  text-classification, sentiment-analysis
NewsMTSC
Target-dependent sentiment classification in news articles reporting on political events. Includes a high-quality data set of over 11k sentences and a state-of-the-art classification model.
Stars: ✭ 54 (+3.85%)
Mutual labels:  sentiment-analysis, text-classification
Ml Classify Text Js
Machine learning based text classification in JavaScript using n-grams and cosine similarity
Stars: ✭ 38 (-26.92%)
Mutual labels:  text-classification, sentiment-analysis
MetaLifelongLanguage
Repository containing code for the paper "Meta-Learning with Sparse Experience Replay for Lifelong Language Learning".
Stars: ✭ 21 (-59.62%)
Mutual labels:  text-classification, meta-learning
ML2017FALL
Machine Learning (EE 5184) in NTU
Stars: ✭ 66 (+26.92%)
Mutual labels:  sentiment-analysis, text-classification
COVID-19-Tweet-Classification-using-Roberta-and-Bert-Simple-Transformers
Rank 1 / 216
Stars: ✭ 24 (-53.85%)
Mutual labels:  sentiment-analysis, text-classification
Text mining resources
Resources for learning about Text Mining and Natural Language Processing
Stars: ✭ 358 (+588.46%)
Mutual labels:  text-classification, sentiment-analysis
awesome-text-classification
Text classification meets word embeddings.
Stars: ✭ 27 (-48.08%)
Mutual labels:  sentiment-analysis, text-classification
TLA
A comprehensive tool for linguistic analysis of communities
Stars: ✭ 47 (-9.62%)
Mutual labels:  sentiment-analysis, text-classification
Tf Rnn Attention
Tensorflow implementation of attention mechanism for text classification tasks.
Stars: ✭ 735 (+1313.46%)
Mutual labels:  text-classification, sentiment-analysis
Few Shot Text Classification
Few-shot binary text classification with Induction Networks and Word2Vec weights initialization
Stars: ✭ 32 (-38.46%)
Mutual labels:  meta-learning, text-classification

Fewshot text classification with meta learning and BERT

Requirements

  • transformers==2.2.1
  • python>=3.6
  • torch==1.3.0

Introduction

This repository is an implementation of First-order MAML and Reptile on top of BERT. For those who interested in Second-order MAML, we also provide a script that performs functional forward with specified BERT's weights

Application can be use for domain adaptation with limited training examples. In our case, we try to build an build an accurate sentiment analysis model of Amazon product reviews for low-resource domains (~ 80 training examples/domain).

What is domain adaptation?

Domain adaptation is a field associated with machine learning and transfer learning. This scenario arises when we aim at learning from high-resource domains a well performing model on low-resource (but related) domains.

For example, this is the number of training examples per domain in our case:

'apparel': 1717,

'baby': 1107,

'beauty': 993,

'books': 921,

'camera_&_photo': 1086,

'cell_phones_&_service': 698,

'dvd': 893,

'electronics': 1277,

'grocery': 1100,

'health_&_personal_care': 1429,

'jewelry_&_watches': 1086,

'kitchen_&_housewares': 1390,

'magazines': 1133,

'music': 1007,

'outdoor_living': 980,

'software': 1029,

'sports_&_outdoors': 1336,

'toys_&_games': 1363,

'video': 1010,

'automotive': 100,

'computer_&_video_games': 100,

'office_products': 100

According to the statistics, We have 100 training examples for "office_products", "automotive", "computer_&videogames". Can we still build an accurate model on these domain ?

-> Absolutetly, we actually achieved an average accuracy of 93% on test domains with just 80 training examples.

Solution

We leverage data from high-resource domains to create a good "starting point". From this point, we start training a specific model for low-resource domain.

Approach 1: Transfer learning

We train a single model (Model_X) on concatenated data from high-resource domains. Then, we retrain Model_X on low-resource domain

Approach 2: Meta learning

We stimulate a lot of situations where the Model_X are forced to learn fast with limited training datad. The model_X are getting better at "learning with less" after each training situation. We called these situations as Meta-task. Each task contain two sets:

  • Support set: contain few training samples
  • Query set: Provide learning feedback. The model use this feedback to adapt its learning strategy

There meta tasks is constructed from high-resource domains, serving as meta training data.

So, what is the form of "learning strategy" of a learner ? . It's simply an initialization of weights.

  • A good learner (learner that learn fast and obtrain good result on test-set) have a good initialization of weight, which can be easily tunned on data from new domains.
  • A bad learner simply have a bad initialization of weights.

In other words, meta training is simply a process of learning to initialize model's weights such that these weights can be easily tunned.

Example usage

Please take a look at Interactive.ipynb

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].