You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+33-13Lines changed: 33 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,38 +8,56 @@
8
8
9
9
> A PyTorch-based 1D Convolutional Neural Network for real-world text classification tasks. Includes tokenization, padded sequence handling, GPU-accelerated training, performance evaluation, and reproducible preprocessing utilities.
10
10
11
-
---
11
+
## 🚀 Quickstart Demo (For Reviewers)
12
12
13
-
## 🚀 Quickstart Demo
13
+
Run a simple inference example using sample text:
14
14
15
15
```bash
16
16
pip install -r requirements.txt
17
-
python run_demo.py
17
+
python demo_predict.py
18
18
```
19
19
20
-
Runs an end-to-end example using a sample complaint for inference.
20
+
This confirms preprocessing, embedding, convolutional feature extraction, and classifier output.
21
+
22
+
---
23
+
24
+
## 📦 Full Training Run
25
+
26
+
Train the full 1D-CNN model:
27
+
28
+
```bash
29
+
python train_cnn_classifier.py
30
+
```
31
+
32
+
This script handles:
33
+
34
+
- Tokenization + vocabulary
35
+
- Sequence batching
36
+
- CNN feature extraction
37
+
- Classification head training
38
+
- Train/validation split
39
+
- Accuracy reporting
21
40
22
41
---
23
42
24
43
## 📁 Files
25
44
26
45
```text
27
46
train_cnn_classifier.py # Full supervised training script
28
-
run_demo.py # Sample inference demo
47
+
run_demo.py # Example inference demo
29
48
requirements.txt # Dependencies
30
49
```
31
50
32
51
---
33
52
34
53
## 🏗 Overview
35
54
36
-
- Token embedding layer
37
-
- 1D convolutional feature extractor
38
-
- Global max pooling layer
39
-
- Fully connected classification head
40
-
- Cross-entropy loss + accuracy tracking
55
+
- Token Embedding → Conv1D → Global Max Pool → Linear Classifier
56
+
- Efficient for short-to-medium text sequences
57
+
- Demonstrates convolutional NLP modeling
58
+
- Fast training even on CPU
41
59
42
-
This design balances speed, simplicity, and performance for text classification.
60
+
This architecture is commonly used for sentiment analysis and short-text classification.
43
61
44
62
---
45
63
@@ -50,7 +68,8 @@ This design balances speed, simplicity, and performance for text classification.
0 commit comments