File size: 3,918 Bytes
19f5e13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
---
language: ne
tags:
- sentiment-analysis
- nepali
- nepse
- stock-market
- finance
- bilstm
- cnn
- keras
license: mit
datasets:
- custom
metrics:
- accuracy
model-index:
- name: nepse-sentiment-analyzer
  results:
  - task:
      type: text-classification
      name: Sentiment Analysis
    dataset:
      type: custom
      name: NEPSE Financial News (Nepali)
    metrics:
    - type: accuracy
      value: 0.9766
      name: Training Accuracy
---

# NEPSE Sentiment Analyzer 📈

A BiLSTM-CNN hybrid neural network for sentiment analysis of Nepali financial text, specifically designed for Nepal Stock Exchange (NEPSE) related content.

## Model Description

This model performs 5-class sentiment classification on Nepali text:
- **Very Negative** (0): बहुत नकारात्मक
- **Negative** (1): नकारात्मक  
- **Neutral** (2): तटस्थ
- **Positive** (3): सकारात्मक
- **Very Positive** (4): बहुत सकारात्मक

## Architecture

- **Model Type**: BiLSTM-CNN Hybrid
- **Parameters**: 126,333 trainable parameters
- **Framework**: TensorFlow/Keras
- **Input**: Nepali text (max 100 tokens)
- **Output**: 5-class probability distribution

### Architecture Details:
```
Input Layer (100 tokens) 

Embedding Layer (100 dims)

BiLSTM Layer (64 units)

CNN Layer (128 filters, kernel=3)

Global Max Pooling

Dense Layer (32 units, ReLU)

Output Layer (5 units, Softmax)
```

## Training Data

- **Dataset Size**: 2,986 samples
- **Language**: Nepali (Devanagari script)
- **Domain**: Financial/Stock Market
- **Distribution**: Balanced across 5 sentiment classes
- **Augmentation**: Synonym replacement and paraphrasing

## Performance

| Metric | Score |
|--------|-------|
| Training Accuracy | 97.66% |
| Validation Accuracy | ~95% |
| Parameters | 126,333 |
| Model Size | 1.5 MB |

## Usage

```python
import tensorflow as tf
from tensorflow.keras.models import load_model
import numpy as np

# Load the model
model = load_model('best_model.keras')

# Prepare text (example)
def preprocess_text(text):
    # Add your preprocessing logic here
    # Tokenization, padding, etc.
    return processed_text

# Predict sentiment
text = "शेयर बजारमा राम्रो वृद्धि भएको छ"
processed = preprocess_text(text)
prediction = model.predict(processed)
sentiment_class = np.argmax(prediction)

# Classes: 0=Very Negative, 1=Negative, 2=Neutral, 3=Positive, 4=Very Positive
```

## Applications

- 📊 **Stock Market Analysis**: Analyze sentiment of NEPSE-related news
- 📱 **Social Media Monitoring**: Track public sentiment about stocks
- 🤖 **Trading Bots**: Incorporate sentiment signals
- 📰 **News Analysis**: Classify financial news sentiment
- 📈 **Investment Research**: Gauge market sentiment

## Limitations

- Trained specifically on financial/stock market terminology
- Performance may vary on general Nepali text
- Requires preprocessing for optimal results
- Best suited for short to medium-length texts

## Training Process

1. **Data Collection**: 500+ samples per sentiment class
2. **Augmentation**: Expanded to 2,986 total samples
3. **Architecture**: BiLSTM for sequence + CNN for n-grams
4. **Optimization**: Adam optimizer with early stopping
5. **Validation**: Stratified k-fold cross-validation

## Citation

```bibtex
@misc{nepse-sentiment-2025,
  title={NEPSE Sentiment Analyzer: BiLSTM-CNN for Nepali Financial Text},
  author={Your Name},
  year={2025},
  publisher={Hugging Face},
  url={https://huggingface.co/your-username/nepse-sentiment-analyzer}
}
```

## License

MIT License - Feel free to use for research and commercial applications.

## Contact

For questions or collaboration opportunities, please reach out via GitHub or Hugging Face discussions.

---

*Built with ❤️ for the Nepali ML community*