Coder Social home page Coder Social logo

angadhn / laughbot-transformer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from katepark/laughbot-transformer

0.0 0.0 0.0 2.88 MB

extending laughbot project to encoder-based transformer model finetuned on same dataset for humor classification

Python 0.27% Jupyter Notebook 99.73%

laughbot-transformer's Introduction

laughbot-transformer

Extending laughbot project (https://github.com/katepark/laughbot) and paper (https://cs.stanford.edu/~katepark/Laughbot.pdf) to transformer model finetuned with same dataset of the Switchboard Corpora (3000 transcripts from phone conversations between two speakers)

Dataset: Any line of a transcript preceding indication of laughter (often transcribed as "[laughter]") classified as a positive "punchline." Else, "unfunny". Example

Transcript Class
A: Uh-huh. Well, you must have a relatively clean conscience then. Punchline
B: [Laughter] -

Num Examples

  • Train: 23658 (38.7% "punchline")
  • Val: 2966
  • Test: 2893
Model Model Description Accuracy Precision Recall F1-score
Positive Baseline Always predict positive class ("punchline") 37.2 37.2 100.0 54.2
Random Weighted Baseline Predict positive class 37.2% of the time matching overall dataset distribution 37.2 37.2 37.2 37.2
Logistic regression (language only) Logistic Regression trained on language features(ngrams, parts of speech, sentiment, line length) 70.6 62.7 51.4 56.5
RNN (audio only) RNN trained on acoustic features (MFCC vectors, Energy level) 71.7 63.5 55.9 59.4
Paper Final Model (RNN+LogReg) Extract final hidden state vector from RNN trained on acoustic features. Concatenate with language features. Train logistic regression model on combined feature vector 73.9 66.5 60.3 63.2
Finetuned Transformer (this repo) distilbert-base-uncased finetuned on tokenized transcripts, no audio features 74.1 73.3 73.6 73.7


Transformers rock!

Overfitting...

Dataset Accuracy Precision Recall F1-score
Train 89.9 89.9 89.9 89.9
Val 72.2 71.7 72.1 71.8


You can play with the model here https://huggingface.co/goldenk/distilbert-base-uncased-finetuned-switchboard-2
Open in Colab: https://colab.research.google.com/github/katepark/laughbot-transformer/blob/main/laughbot_transformer_scratch.ipynb

Future Work

  • joke text-generator fed into existing humor detection
  • better dataset than switchboard for humor detection

Citation

This work drew from Hugging Face's NLP with Transformers

  @book{tunstall2022natural,
    title={Natural Language Processing with Transformers: Building Language Applications with Hugging Face},
    author={Tunstall, Lewis and von Werra, Leandro and Wolf, Thomas},
    isbn={1098103246},
    url={https://books.google.ch/books?id=7hhyzgEACAAJ},
    year={2022},
    publisher={O'Reilly Media, Incorporated}
  }

laughbot-transformer's People

Contributors

katepark avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.