readme: ---
  tags:
    - text
    - emotion
    - classification
  
  language:
    - en
    
  model-index:
  - name: BERTweet_EmotAn6
    results:
    - task:
        type: sentiment-classification             # Required. Example: automatic-speech-recognition
        name: Text Classification            # Optional. Example: Speech Recognition
      dataset:
        type: emotion          # Required. Example: common_voice. Use dataset id from https://hf.co/datasets
        name: emotion          # Required. A pretty name for the dataset. Example: Common Voice (French)
      metrics:
        - type: f1          
          value: 89.4       
        - type: accuracy          
          value: 93.4       
  ---
  
  <!-- This model card has been generated automatically according to the information Keras had access to. You should
  probably proofread and complete it, then remove this comment. -->
  
  # BERTweet_EmotAn6
  
  This model is a fine-tuned version of [vinai/bertweet-base](https://huggingface.co/vinai/bertweet-base) to predict 5 categorical emotions + neutral.
  Fine-tuning is based on the CARER dataset (Saravia et al., 2018) - 5 emotions and "https://github.com/ashutoshmakone/Twitter-US-Airline-Sentiment-classification" - neutral category.
  
  Saravia, E., Liu, H. C. T., Huang, Y. H., Wu, J., & Chen, Y. S. (2018). Carer: Contextualized affect representations for emotion recognition. In Proceedings of the 2018 conference on empirical methods in natural language processing (pp. 3687-3697).
  
  
  ```
  # Model usage in tf
  from transformers import pipeline
  
  tokenizer = "vinai/bertweet-base" 
  model_path = "eevvgg/BERTweet_EmotAn6" 
  
  sentiment_task = pipeline(task = "text-classification", 
                            model = model_path, tokenizer = tokenizer)
  
  sequence = ["Please someone tell me I'm wrong", 
              "it's a bit unfair", "disappointed by that"]
              
  result = sentiment_task(sequence)
  
  labels = [i['label'] for i in result] 
  labels # ['anger', 'anger', 'sadness']
                                          
  ```
  
  ## Intended uses & limitations
  
  Emotion classification in text up to 400 tokens (maxlen).
  
  ## Training and evaluation data
  
  Trained for 1 epoch, mini-batch size of 8.
  Training results: 
  - loss: 0.4962 
  - balanced_accuracy: 0.8502 
  - val_loss: 0.2249 
  - val_balanced_accuracy: 0.9342.
  
  ## Training procedure
  
  ### Training hyperparameters
  
  The following hyperparameters were used during training:
  - optimizer: {'name': 'Adam', 'learning_rate': 3e-05, 'decay': 0.01, 'beta_1': 0.9, 'beta_2': 0.999, 'epsilon': 1e-08, 'amsgrad': False}
  
  ### Framework versions
  
  - Transformers 4.23.1
  - TensorFlow 2.9.2
  - Tokenizers 0.13.1
  
  
  It achieves the following results on the evaluation set:
  
  - macro f1-score: 0.894 
  - weighted f1-score: 0.933 
  - accuracy: 0.934
  
                precision    recall  f1-score   support
  
             0      1.000     1.000     1.000       305
             1      0.939     0.951     0.945       934
             2      0.893     0.862     0.877       406
             3      0.950     0.564     0.708       101
             4      0.818     0.913     0.863       335
             5      0.969     0.973     0.971       973
  
      