Skip to main content

A simple and explainable deep learning model for NLP.

Project description

XSWEM

Build Status Build Status

A simple and explainable deep learning model for NLP implemented in TensorFlow.

Based on SWEM-max as proposed by Shen et al. in Baseline Needs More Love: On Simple Word-Embedding-Based Models and Associated Pooling Mechanisms, 2018.

This package is currently in development. The purpose of this package is to make it easy to train and explain SWEM-max.

You can find demos of the functionality we have implemented in the notebooks directory of the package. Each notebook has a badge that allows you to run it yourself in Google Colab. We will add more notebooks as new functionality is added.

For a demo of how to train a basic SWEM-max model see train_xswem.ipynb.

Local Explanations

We are currently implementing some methods we have developed for local explanations.

local_explain_most_salient_words

So far we have only implemented the local_explain_most_salient_words method. This method extracts the words the model has learnt as most salient from a given input sentence. Below we show an example of this method using a sample from the ag_news dataset. This method is explained in more detail in the local_explain_most_salient_words.ipynb notebook.

local_explain_most_salient_words.png

Global Explanations

We have implemented the global explainability method proposed in section 4.1.1 of the original paper. You can see a demo of this method in the notebook global_explain_embedding_components.ipynb.

How to install

This package is hosted on PyPI and can be installed using pip.

pip install xswem

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xswem-1.0.0.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xswem-1.0.0-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file xswem-1.0.0.tar.gz.

File metadata

  • Download URL: xswem-1.0.0.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5

File hashes

Hashes for xswem-1.0.0.tar.gz
Algorithm Hash digest
SHA256 a0c585f3f0bc2a9757e3e89b3e196b60c23832e8166359a309760a34d2228514
MD5 02ddd6d9ce2febed432a384e6fb687d7
BLAKE2b-256 d58369f3eab8a6030a18d55a89f2bbf24fb463a02baafaa0feb883e55b05b839

See more details on using hashes here.

File details

Details for the file xswem-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: xswem-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5

File hashes

Hashes for xswem-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a49700b44876d982829ccc852f81798b10da0cbae0373c99af8105dbf48428e4
MD5 f3b70bd23a7af5315245312556d9d929
BLAKE2b-256 ceedcdac130e8c47dd6f18d63c7e827b67ca228f83baf66325da20c7302b2fd6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page