GithubHelp home page GithubHelp logo

xzh1983 / happiness Goto Github PK

View Code? Open in Web Editor NEW

This project forked from robhawkins/happiness

0.0 0.0 0.0 185 KB

Sentiment analysis on ~70,000 TripAdvisor hotel reviews using fastai, LSTM, stacking, xgboost

Jupyter Notebook 100.00%

happiness's Introduction

happiness

Sentiment analysis on ~70,000 TripAdvisor hotel reviews using fastai, LSTM, stacking, xgboost

This code makes use of the fastai library found at https://github.com/fastai/fastai to label TripAdvisor hotel reviews as having positive or negative sentiment

Basic steps taken were to create a LSTM language model and feed that plus a few categorical features to a RNN. After tuning, do 10 fold cross validation, get the out-of-fold probability predictions, average them, and convert to the target labels. Also tried feeding these 10 outputs along with output from lightgbm and a couple other models to XGBoost, which resulted in a slight improvement from .91051 to .91382 accuracy on a public LB

Things I'd do differently next time

  1. Start with a smaller subset of data. I forgot to do this and spent too long on parameter tuning as a result.
  2. Stop training when overfitting. I kept trying to train more, thinking I'd reach a new minimum error. Sometimes it did, but only after many epochs, and I think the gains were basically in the same valley
  3. Use algorithms that implement early stopping, or implement it myself

Description of files

  • Happiness-cv10.ipynb - does training, saves models
  • Happiness-cv-predict.ipynb - Basically same code as previous file, but set up to run predictions using a different GPU so it can be done in parallel with training
  • Happiness-stack.ipynb - A few different attempts at stacking. This part was after the competition ended.

More on Stacking

I was trying get this to work under a time constraint (an hour), and therefore tried a few different implementations that I saw people recommended. Given an hour, I couldn't find the right parameters to start Vowpal Wabbit for training. Its training kept finishing in 1 second and I felt that couldn't be right.

I also tried Driverless AI, which is commercial and too expensive for individuals (quoted $80k/year, I have a trial now), and it performed as well on the merged predictions as my tuning in XGBoost. I didn't want to submit this result before the end of the competition since DAI's software is proprietary.

I think DAI would be a good option for organizations who want to do deep learning, can't find data scientists, and want to do some of the work with their own staff rather than handing the whole process to consultants.

Ultimately, XGBoost was easiest to set up thanks to this walkthrough, whose initial parameters and tuning process seemed to work well for this dataset.

Prep for next time

I want to get familiar with more automated deep learning tools. StackNet and Xcessive are at the top of my list. After doing parameter tuning once for one competition, I'm eager to reduce time spent on that

Final thoughts

Deeping learning is both easy and hard. Easy because you can learn it, hard because improving on results with parameter tuning can take a lot of time, and it's easy to follow rabbit holes that yield marginal gains. Shifting gears to try a new approach that could yield more gains takes more effort.

happiness's People

Contributors

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