Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Model Details
|
| 2 |
+
|
| 3 |
+
**Model Name:** Work Ethic 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', 'ethic_category'],
|
| 17 |
+
num_rows: 50,000
|
| 18 |
+
})
|
| 19 |
+
validation: Dataset({
|
| 20 |
+
features: ['employee_feedback', 'ethic_category'],
|
| 21 |
+
num_rows: 20,000
|
| 22 |
+
})
|
| 23 |
+
})
|
| 24 |
+
|
| 25 |
+
**Available Splits:**
|
| 26 |
+
- **Train:** 15,000 examples
|
| 27 |
+
- **Validation:** 2,000 examples
|
| 28 |
+
|
| 29 |
+
**Feature Representation:**
|
| 30 |
+
- **employee_feedback:** Textual feedback from employees (e.g., "John consistently meets deadlines and takes initiative.")
|
| 31 |
+
- **ethic_category:** Classified work ethic type (e.g., "Strong Initiative")
|
| 32 |
+
|
| 33 |
+
---
|
| 34 |
+
|
| 35 |
+
## Training Details
|
| 36 |
+
|
| 37 |
+
**Training Process:**
|
| 38 |
+
- Fine-tuned for 3 epochs
|
| 39 |
+
- Loss reduced progressively across epochs
|
| 40 |
+
|
| 41 |
+
**Hyperparameters:**
|
| 42 |
+
- Epochs: 3
|
| 43 |
+
- Learning Rate: 3e-5
|
| 44 |
+
- Batch Size: 8
|
| 45 |
+
- Weight Decay: 0.01
|
| 46 |
+
- Mixed Precision: FP16
|
| 47 |
+
|
| 48 |
+
**Performance Metrics:**
|
| 49 |
+
- Accuracy: 92.3%
|
| 50 |
+
|
| 51 |
+
---
|
| 52 |
+
|
| 53 |
+
## Inference Example
|
| 54 |
+
|
| 55 |
+
```python
|
| 56 |
+
import torch
|
| 57 |
+
from transformers import DistilBertTokenizer, DistilBertForSequenceClassification
|
| 58 |
+
|
| 59 |
+
def load_model(model_path):
|
| 60 |
+
tokenizer = DistilBertTokenizer.from_pretrained(model_path)
|
| 61 |
+
model = DistilBertForSequenceClassification.from_pretrained(model_path).half()
|
| 62 |
+
model.eval()
|
| 63 |
+
return model, tokenizer
|
| 64 |
+
|
| 65 |
+
def classify_ethic(feedback, model, tokenizer, device="cuda"):
|
| 66 |
+
inputs = tokenizer(
|
| 67 |
+
feedback,
|
| 68 |
+
max_length=256,
|
| 69 |
+
padding="max_length",
|
| 70 |
+
truncation=True,
|
| 71 |
+
return_tensors="pt"
|
| 72 |
+
).to(device)
|
| 73 |
+
outputs = model(**inputs)
|
| 74 |
+
predicted_class = torch.argmax(outputs.logits, dim=1).item()
|
| 75 |
+
return predicted_class
|
| 76 |
+
|
| 77 |
+
# Example usage
|
| 78 |
+
if __name__ == "__main__":
|
| 79 |
+
model_path = "your-username/work-ethic-analysis" # Replace with your HF repo
|
| 80 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 81 |
+
model, tokenizer = load_model(model_path)
|
| 82 |
+
model.to(device)
|
| 83 |
+
|
| 84 |
+
feedback = "John consistently meets deadlines and takes initiative."
|
| 85 |
+
category = classify_ethic(feedback, model, tokenizer, device)
|
| 86 |
+
print(f"Feedback: {feedback}")
|
| 87 |
+
print(f"Predicted Work Ethic Category: {category}")
|
| 88 |
+
```
|
| 89 |
+
|
| 90 |
+
**Expected Output:**
|
| 91 |
+
```plaintext
|
| 92 |
+
Feedback: John consistently meets deadlines and takes initiative.
|
| 93 |
+
Predicted Work Ethic Category: Strong Initiative
|
| 94 |
+
```
|
| 95 |
+
|
| 96 |
+
---
|
| 97 |
+
|
| 98 |
+
# Use Case: Work Ethic Analysis Model
|
| 99 |
+
|
| 100 |
+
## **Overview**
|
| 101 |
+
|
| 102 |
+
The **Work Ethic Analysis Model**, built on **DistilBERT-base-uncased**, is designed to classify employee feedback into predefined work ethic categories. This helps HR teams and management analyze employee dedication, responsibility, and productivity.
|
| 103 |
+
|
| 104 |
+
## **Key Applications**
|
| 105 |
+
|
| 106 |
+
- **Performance Assessment:** Identify patterns in employee feedback for objective performance reviews.
|
| 107 |
+
- **Employee Recognition:** Highlight employees demonstrating strong work ethics for rewards and promotions.
|
| 108 |
+
- **Early Warning System:** Detect negative trends in work ethic and take proactive measures.
|
| 109 |
+
- **Leadership and Training Enhancement:** Use feedback analysis to improve training programs for employees and managers.
|
| 110 |
+
|
| 111 |
+
## **Benefits**
|
| 112 |
+
|
| 113 |
+
- **Scalability:** Can process thousands of employee feedback entries in minutes.
|
| 114 |
+
- **Unbiased Evaluation:** AI-driven classification removes subjective bias from evaluations.
|
| 115 |
+
- **Actionable Insights:** Helps HR teams make data-driven decisions for workforce improvement.
|
| 116 |
+
|
| 117 |
+
---
|