GithubHelp home page GithubHelp logo

prrao87 / fine-grained-sentiment-app-dash Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 2.0 10.32 MB

A LIME explainer app for fine-grained sentiment classification, written using Dash.

License: MIT License

Python 64.72% CSS 35.28%
dash explainer nlp interpretability visualization lime lime-explainer web-app

fine-grained-sentiment-app-dash's Introduction

A Dash Explainer App for Fine Grained Sentiment Classification

This repo contains the Plotly Dash equivalent of an existing interactive application, that explains the results of fine-grained sentiment classification, described in detail in this Medium Series.

A number of classifiers are implemented and their results explained using the LIME explainer. The classifers were trained on the Stanford Sentiment Treebank (SST-5) dataset. The class labels are any of [1, 2, 3, 4, 5], where 1 is very negative and 5 is very positive.

Why Dash?

Dash is a powerful, highly customizable library for building dashboards in Python. It is written on top of Flask, Plotly.js and React.js, allowing for fluid, reactive web applications that scale well to multiple client sessions. It also allows developers a lot of flexibility to customize the app's appearance, by providing access to the underlying CSS.

Installation

First, set up virtual environment and install from requirements.txt:

python3 -m venv venv
source venv/bin/activate
pip3 install -r requirements.txt

For further development, simply activate the existing virtual environment.

source venv/bin/activate

Usage

Run the file app.py and then enter a sentence, choose a type of classifier and click on the button Explain results. We can then observe the features (i.e. words or tokens) that contributed to the classifier predicting a particular class label.

Demo for the front-end

The front-end app takes in a text sample and outputs LIME explanations for the different methods. The app is is deployed using Heroku at this location: https://sst5-explainer-dash-0642.herokuapp.com/

Play with your own text examples as shown below and see the fine-grained sentiment results explained!

NOTE: Because the PyTorch-based models (Flair and the causal transformer) are quite expensive to run inference with (they require a GPU), these methods are not deployed. However, they can be run on a local instance of the app.

fine-grained-sentiment-app-dash's People

Contributors

prrao87 avatar

Watchers

 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.