|
| 1 | +# ATIS Intent Classification Model |
| 2 | + |
| 3 | +This repository contains an ATIS (Airline Travel Information System) intent classification model built using deep learning techniques. The model is designed to classify user queries related to flight schedules, airfare, flight details, and more, into predefined intents such as `atis_flight`, `atis_airfare`, and `atis_flight_time`. |
| 4 | + |
| 5 | +## Table of Contents |
| 6 | +- [Project Overview](#project-overview) |
| 7 | +- [Dataset](#dataset) |
| 8 | +- [Model Architecture](#model-architecture) |
| 9 | +- [Training](#training) |
| 10 | +- [Testing and Evaluation](#testing-and-evaluation) |
| 11 | +- [Usage](#usage) |
| 12 | +- [Installation](#installation) |
| 13 | +- [License](#license) |
| 14 | + |
| 15 | +## Project Overview |
| 16 | + |
| 17 | +This project uses natural language processing (NLP) techniques and deep learning to classify flight-related queries into specific intents. The model is trained using the ATIS dataset and employs a Bidirectional LSTM network for intent classification. |
| 18 | + |
| 19 | +### Key Features: |
| 20 | +- **Intent Classification:** Classify user queries into one of 8 intents. |
| 21 | +- **Accuracy:** Achieves a test accuracy of **97%** and high F1-scores for most intents. |
| 22 | +- **Model:** Uses an embedding layer followed by two bidirectional LSTM layers and dense layers for classification. |
| 23 | + |
| 24 | +## Dataset |
| 25 | + |
| 26 | +The model is trained on the [ATIS dataset](https://www.kaggle.com/datasets/uciml/atis), which consists of natural language queries related to flight details. The dataset is divided into: |
| 27 | +- **Training Data:** 4,833 queries |
| 28 | +- **Testing Data:** 799 queries |
| 29 | + |
| 30 | +### Data Columns: |
| 31 | +- **Intent:** The intent label (e.g., `atis_flight`, `atis_airfare`). |
| 32 | +- **Query:** The user's flight-related query. |
| 33 | + |
| 34 | +## Model Architecture |
| 35 | + |
| 36 | +The model architecture consists of the following layers: |
| 37 | +1. **Embedding Layer:** Converts words into 128-dimensional vectors. |
| 38 | +2. **Bidirectional LSTM Layers:** Capture contextual information from both directions of the input sequence. |
| 39 | +3. **Dropout Layers:** Help prevent overfitting by randomly dropping connections during training. |
| 40 | +4. **Dense Layers:** Final classification layer that outputs the predicted intent. |
| 41 | + |
| 42 | +### Hyperparameters: |
| 43 | +- **Vocabulary Size:** 872 |
| 44 | +- **Max Sequence Length:** 46 |
| 45 | +- **Number of Classes (Intents):** 8 |
| 46 | +- **Total Parameters:** 253,992 (All trainable) |
| 47 | + |
| 48 | +## Training |
| 49 | + |
| 50 | +- The model is trained for 10 epochs. |
| 51 | +- **Training Accuracy:** Ranges from 96.25% (Epoch 1) to 98.77% (Epoch 10). |
| 52 | +- **Validation Accuracy:** Peaked at 98.24%. |
| 53 | +- **Loss:** Training loss decreased from 0.1218 to 0.0457, with minimal overfitting. |
| 54 | + |
| 55 | +### Observations: |
| 56 | +- The model shows excellent performance, but certain underrepresented classes such as `atis_quantity` and `atis_flight_time` need more attention. |
| 57 | +- **Training Accuracy:** 98.77% |
| 58 | +- **Validation Accuracy:** 98.24% |
| 59 | + |
| 60 | +## Testing and Evaluation |
| 61 | + |
| 62 | +- **Test Accuracy:** 97% |
| 63 | +- **Precision, Recall, and F1-Score:** |
| 64 | + - `atis_flight`: Precision 0.99, Recall 0.98 |
| 65 | + - `atis_airfare`: Precision 0.90, Recall 0.90 |
| 66 | + - `atis_abbreviation`: Precision 0.94, Recall 1.00 |
| 67 | + - F1-Scores are lower for some classes like `atis_quantity` (0.55) and `atis_flight_time` (0.67). |
| 68 | + |
| 69 | +## Usage |
| 70 | + |
| 71 | +To classify the intent of a query, use the `predict_intent()` function. Example: |
| 72 | + |
| 73 | +```python |
| 74 | +from intent_classifier import predict_intent |
| 75 | + |
| 76 | +query = "show me flights from New York to Los Angeles" |
| 77 | +intent = predict_intent(query) |
| 78 | +print(f"Predicted Intent: {intent}") |
| 79 | +``` |
0 commit comments