Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Model Details
|
| 2 |
+
|
| 3 |
+
**Model Name:** Employee behaviour Analysis Model\
|
| 4 |
+
**Base Model:** distilbert-base-uncased\
|
| 5 |
+
**Dataset:** yelp_review_full
|
| 6 |
+
|
| 7 |
+
**Training Device:** CUDA (GPU)
|
| 8 |
+
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
## Dataset Information
|
| 12 |
+
|
| 13 |
+
**Dataset Structure:**\
|
| 14 |
+
DatasetDict({\
|
| 15 |
+
train: Dataset({\
|
| 16 |
+
features: ['employee\_feedback', 'behavior\_category'],\
|
| 17 |
+
num\_rows: 50,000\
|
| 18 |
+
})\
|
| 19 |
+
validation: Dataset({\
|
| 20 |
+
features: ['employee\_feedback', 'behavior\_category'],\
|
| 21 |
+
num\_rows: 20,000\
|
| 22 |
+
})\
|
| 23 |
+
})
|
| 24 |
+
|
| 25 |
+
**Available Splits:**
|
| 26 |
+
|
| 27 |
+
- **Train:** 15,000 examples
|
| 28 |
+
- **Validation:** 2,000 examples
|
| 29 |
+
|
| 30 |
+
**Feature Representation:**
|
| 31 |
+
|
| 32 |
+
- **employee\_feedback:** Textual feedback from employees (e.g., "The team is highly collaborative and supportive.")
|
| 33 |
+
- **behavior\_category:** Classified behavior type (e.g., "Positive Collaboration")
|
| 34 |
+
|
| 35 |
+
---
|
| 36 |
+
|
| 37 |
+
## Training Details
|
| 38 |
+
|
| 39 |
+
**Training Process:**
|
| 40 |
+
|
| 41 |
+
- Fine-tuned for 3 epochs
|
| 42 |
+
- Loss reduced progressively across epochs
|
| 43 |
+
|
| 44 |
+
**Hyperparameters:**
|
| 45 |
+
|
| 46 |
+
- Epochs: 3
|
| 47 |
+
- Learning Rate: 3e-5
|
| 48 |
+
- Batch Size: 8
|
| 49 |
+
- Weight Decay: 0.01
|
| 50 |
+
- Mixed Precision: FP16
|
| 51 |
+
|
| 52 |
+
**Performance Metrics:**
|
| 53 |
+
|
| 54 |
+
- Accuracy: 92.3%
|
| 55 |
+
|
| 56 |
+
---
|
| 57 |
+
|
| 58 |
+
## Inference Example
|
| 59 |
+
|
| 60 |
+
```python
|
| 61 |
+
import torch
|
| 62 |
+
from transformers import DistilBertTokenizer, DistilBertForSequenceClassification
|
| 63 |
+
|
| 64 |
+
def load_model(model_path):
|
| 65 |
+
tokenizer = DistilBertTokenizer.from_pretrained(model_path)
|
| 66 |
+
model = DistilBertForSequenceClassification.from_pretrained(model_path).half()
|
| 67 |
+
model.eval()
|
| 68 |
+
return model, tokenizer
|
| 69 |
+
|
| 70 |
+
def classify_behavior(feedback, model, tokenizer, device="cuda"):
|
| 71 |
+
inputs = tokenizer(
|
| 72 |
+
feedback,
|
| 73 |
+
max_length=256,
|
| 74 |
+
padding="max_length",
|
| 75 |
+
truncation=True,
|
| 76 |
+
return_tensors="pt"
|
| 77 |
+
).to(device)
|
| 78 |
+
outputs = model(**inputs)
|
| 79 |
+
predicted_class = torch.argmax(outputs.logits, dim=1).item()
|
| 80 |
+
return predicted_class
|
| 81 |
+
|
| 82 |
+
# Example usage
|
| 83 |
+
if __name__ == "__main__":
|
| 84 |
+
model_path = "your-username/employee-behavior-analysis" # Replace with your HF repo
|
| 85 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 86 |
+
model, tokenizer = load_model(model_path)
|
| 87 |
+
model.to(device)
|
| 88 |
+
|
| 89 |
+
feedback = "The team is highly collaborative and supportive."
|
| 90 |
+
category = classify_behavior(feedback, model, tokenizer, device)
|
| 91 |
+
print(f"Feedback: {feedback}")
|
| 92 |
+
print(f"Predicted Behavior Category: {category}")
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
+
**Expected Output:**
|
| 96 |
+
|
| 97 |
+
```
|
| 98 |
+
Feedback: The team is highly collaborative and supportive.
|
| 99 |
+
Predicted Behavior Category: Positive Collaboration
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
---
|
| 103 |
+
|
| 104 |
+
# Use Case: Employee Behavior Analysis Model
|
| 105 |
+
|
| 106 |
+
## **Overview**
|
| 107 |
+
|
| 108 |
+
The Employee Behavior Analysis Model, built on **DistilBERT-base-uncased**, is designed to classify employee feedback into predefined behavior categories. This helps HR and management teams analyze workforce sentiment and improve workplace culture.
|
| 109 |
+
|
| 110 |
+
## **Key Applications**
|
| 111 |
+
|
| 112 |
+
- **Sentiment & Engagement Analysis:** Identify trends in employee feedback to assess workplace satisfaction.
|
| 113 |
+
- **Performance Review Assistance:** Automate categorization of peer reviews to streamline HR evaluation.
|
| 114 |
+
- **Conflict Resolution:** Detect negative patterns in feedback to address workplace conflicts proactively.
|
| 115 |
+
- **Leadership Assessment:** Analyze feedback about managers and team leaders to enhance leadership training.
|
| 116 |
+
|
| 117 |
+
## **Benefits**
|
| 118 |
+
|
| 119 |
+
- **Scalability:** Can process thousands of employee responses in minutes.
|
| 120 |
+
- **Objective Analysis:** Reduces bias by using AI-driven classification.
|
| 121 |
+
- **Actionable Insights:** Helps HR teams make data-driven decisions.
|
| 122 |
+
|
| 123 |
+
## **Future Improvements**
|
| 124 |
+
|
| 125 |
+
- Expand dataset with more diverse employee feedback sources.
|
| 126 |
+
- Fine-tune with additional behavioral categories for nuanced classification.
|
| 127 |
+
- Integrate with company HR software for real-time feedback analysis.
|
| 128 |
+
|
| 129 |
+
---
|
| 130 |
+
|