CoolFace
Modelpublic

AventIQ-AI/Sentiment-Analysis-for-Regulatory-Complaince-Feedback

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes1downloads
Model Card

๐Ÿง  SentimentClassifier-BERT-RegulatoryCompliance

A BERT-based sentiment analysis model fine-tuned on regulatory feedback and compliance-related text. This model classifies input text into Positive, Neutral, or Negative, making it well-suited for analyzing complaints, formal feedback, and regulatory communication.


โœจ Model Highlights

  • โ€”๐Ÿ“Œ Based on `bert-base-uncased`
  • โ€”๐Ÿ” Fine-tuned on a custom dataset of labeled regulatory feedback
  • โ€”โšก Supports prediction of 3 classes: Positive, Neutral, Negative
  • โ€”๐Ÿง  Built using Hugging Face Transformers and PyTorch

๐Ÿง  Intended Uses

  • โ€”โœ… Regulatory and compliance feedback classification
  • โ€”โœ… Complaint monitoring and triaging
  • โ€”โœ… Customer sentiment analysis for compliance departments

๐Ÿšซ Limitations

  • โ€”โŒ Not optimized for multi-language input (English only)
  • โ€”๐Ÿ“ Input longer than 128 tokens will be truncated
  • โ€”๐Ÿค” Model may misinterpret informal or slang language
  • โ€”โš ๏ธ Not intended to replace expert human judgment in legal matters

๐Ÿ‹๏ธโ€โ™‚๏ธ Training Details

AttributeValue
Base Modelbert-base-uncased
DatasetCustom .txt file with feedbacks
LabelsNegative (0), Neutral (1), Positive (2)
Max Token Length128
Epochs3
Batch Size16
OptimizerAdamW
Loss FunctionCrossEntropyLoss
FrameworkPyTorch + Transformers
HardwareCUDA-enabled GPU

๐Ÿ“Š Evaluation Metrics

MetricScore
Accuracy0.84
Precision0.85
Recall0.84
F1 Score0.85

๐Ÿ”Ž Label Mapping

Label IDSentiment
0Negative
1Neutral
2Positive

๐Ÿš€ Usage

python
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
import torch.nn.functional as F

model_name = "your-username/sentiment-bert-regulatory-compliance"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
model.eval()

def predict(text):
    inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True, max_length=128)
    with torch.no_grad():
        outputs = model(**inputs)
        probs = F.softmax(outputs.logits, dim=1)
        pred = torch.argmax(probs, dim=1).item()
        label_map = {0: "Negative", 1: "Neutral", 2: "Positive"}
        return f"Sentiment: {label_map[pred]} (Confidence: {probs[0][pred]:.2f})"

# Example
print(predict("The issue was resolved promptly and professionally."))

๐Ÿ“ Repository Structure

bash
Copy
Edit
.
โ”œโ”€โ”€ model/               # Fine-tuned model files (pytorch_model.bin, config.json)
โ”œโ”€โ”€ tokenizer/           # Tokenizer config and vocab
โ”œโ”€โ”€ training_script.py   # Training code
โ”œโ”€โ”€ feedbacks.txt        # Source dataset
โ”œโ”€โ”€ README.md            # Model card

๐Ÿค Contributing

Contributions are welcome! Feel free to open an issue or pull request to improve the model or its documentation.