Code Monkey home page Code Monkey logo

slize's Introduction

Intent and Slot-filling on the ATIS dataset task.

Adapted for tensorflow 2.0 and shortened in comparison to original
https://github.com/mohammedterry/slots_intents

Model architecture

For this task, a model was trained to jointly predict a sentence's Intent and Slots (entities). Each word is embedded (using pre-defined word vectors) to capture the word's meaning while a character-level bidirection Long Short-Term Memory(LSTM) Network encodes the word's letters to capture its lexical structure.

The word vector and outputs of the character-level bi-LSTM are then fed into the word-level bi-LSTM which predicts the Intent. The second layer feeds into a Conditional Random Fields (CRF) layer to predict the individual slots (entities).

The model is stored in intents_slots/model.py

Word Vectors

The newly released Poincare word embeddings (100 dimensional) were used as they have been reported to better encode the hierarchical relationships inherent between words you can find the word vectors used in word_vectors/poincare.txt

Demo

you can run a demo of the pre-trained model by running intents_slots/demo.py

Training

The model was trained for 50 epochs and stored in the pretrained_models directory

  • pretrained_models/dataset_info contains all the vocabularies used by the model (character, word, intent, entity) and their mappings to numbers for encoding/decoding
  • pretrained_models/model.h5 are the weights to the model

The model's loss during training over the epochs are shown below:

The model's accuracy at predicting intents and entities (slots) over time are shown below:

You can retrain the model by running intents_slots/train.py

Tests

Joint:

Intents only:

Entites only:

to above results can be obtained by running intents_slots/evaluate.py

Improvements:

To improve the robustness of the model to out of vocab words, the training data was lemmatised prior to training and the model was retrained. Numbers were also masked using a placeholder (e.g. *) to avoid out-of-vocab times appearing (e.g. 9:30 may appear in training but not 9:29).

The results were slightly improved given the above tweaks. Precision, Recall and F1 scores improved across the board (for both intents, entities).

Perfect scores were achieved using the validation set!?? data/atis-2-dev.csv

Future Improvements (TO DO):

  • Balance out training data (its clear that the intent ATIS_FLIGHT dominates the training set)

(and 'O' dominates the entity tags)

(or if we discount this as an entity tag - then "to/fromloc.city_name" tags)

  • e.g. this can be achieved by subsampling or artificially perterbing data to generate more samples (e.g. increase training instance by sliding each sentences one,two,three,etc places)

  • Investigate the Intents & Entities which are scoring relatively low F1 scores

e.g. (intents such as ATIS_DAY_NAME, ATIS_MEAL, ATIS_FLIGHT_TIME, etc)

e.g. (entities such as compartment, booking_class, meal_code, etc)

  • Preprocess intent labels with #?
  • Embed unknown words too (if possible) rather than giving them (1)
  • convert word numbers (e.g. "one") into digits
  • improve slot extraction using additional pre-trained Named Entity Recognition (NER)s from various libraries

slize's People

Contributors

mohammedterry avatar zeionara avatar

Watchers

James Cloos 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.