ModhiSathvik commited on
Commit
96b15ad
·
verified ·
1 Parent(s): 687bd84

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +10 -455
README.md CHANGED
@@ -1,455 +1,10 @@
1
- # Intelligent Task Load Balancer
2
-
3
- A machine learning-based system that predicts developer overload risk and optimizes task assignments in software development teams. The system analyzes workload, skills, deadlines, and team context to recommend optimal task assignments and prevent developer burnout.
4
-
5
- ## Overview
6
-
7
- This system uses an XGBoost classifier to predict three levels of developer overload risk:
8
- - **Green (Healthy)**: Developer has capacity for new tasks
9
- - **Yellow (Moderate)**: Proceed with caution, monitor workload
10
- - **Red (Overload)**: High risk, consider reassignment or deadline extension
11
-
12
- The model considers 21 engineered features including current workload, skill matching, deadline urgency, team velocity, and historical overtime patterns.
13
-
14
- ## Features
15
-
16
- ### Core Functionality
17
- - **Single Prediction**: Check overload risk for a specific developer-task assignment
18
- - **Batch Prediction**: Upload CSV files to analyze multiple task assignments simultaneously
19
- - **Load Balancing**: Recommend the best developer for a new task based on current team workload
20
- - **Risk Analysis**: Identify contributing factors to overload risk with confidence scores
21
- - **Feature Engineering**: Automated calculation of derived metrics (workload ratio, urgency score, capacity indicator)
22
-
23
- ### Model Capabilities
24
- - Multi-class classification with probability distributions
25
- - Feature importance analysis
26
- - Cross-validated performance metrics
27
- - Explainable predictions with contributing factors
28
-
29
- ## Project Structure
30
-
31
- ```
32
- INTELLIGENT TASK LOAD BALANCER
33
- ├── intelligent-task-load-balancer/
34
- │ ├── api/
35
- │ │ ├── __pycache__/
36
- │ │ ├── __init__.py
37
- │ │ ├── inference.py # Prediction logic and OverloadPredictor class
38
- │ │ └── schemas.py # Pydantic models for API validation
39
- │ ├── data/
40
- │ │ ├── sample_input.csv # Example input data
41
- │ │ └── task_assignments.csv # Training dataset
42
- │ ├── models/
43
- │ │ ├── label_encoder.pkl # Sklearn LabelEncoder for skills
44
- │ │ ├── model_metadata.json # Model configuration and metrics
45
- │ │ └── xgboost_overload_classifier.pkl # Trained XGBoost model
46
- │ ├── notebooks/ # Jupyter notebooks for exploration
47
- │ ├── results/
48
- │ │ ├── confusion_matrix.png # Model evaluation visualization
49
- │ │ ├── feature_importance.csv # Feature ranking data
50
- │ │ └── feature_importance.png # Feature importance chart
51
- │ ├── scripts/
52
- │ │ ├── generate_data.py # Synthetic data generation
53
- │ │ └── train_model.py # Model training pipeline
54
- │ ├── tests/
55
- │ │ ├── team_workload.csv # Test data for team workload
56
- │ │ └── test_batch.csv # Test data for batch predictions
57
- │ ├── utils/
58
- │ │ ├── __init__.py
59
- │ │ ├── feature_engineering.py # Feature transformation utilities
60
- │ │ └── visualization.py # Plotting and charting functions
61
- │ ├── venv/ # Virtual environment
62
- │ ├── .gitignore
63
- │ ├── app.py # Flask/FastAPI application entry point
64
- │ ├── LICENSE
65
- │ ├── README.md
66
- │ └── requirements.txt # Python dependencies
67
- ```
68
-
69
- ## Installation
70
-
71
- ### Prerequisites
72
- - Python 3.8 or higher
73
- - pip package manager
74
- - Virtual environment (recommended)
75
-
76
- ### Setup Instructions
77
-
78
- 1. Clone the repository:
79
- ```bash
80
- git clone <repository-url>
81
- cd intelligent-task-load-balancer
82
- ```
83
-
84
- 2. Create and activate virtual environment:
85
- ```bash
86
- python -m venv venv
87
-
88
- # On Windows
89
- venv\Scripts\activate
90
-
91
- # On macOS/Linux
92
- source venv/bin/activate
93
- ```
94
-
95
- 3. Install dependencies:
96
- ```bash
97
- pip install -r requirements.txt
98
- ```
99
-
100
- 4. Train the model (optional - pre-trained model included):
101
- ```bash
102
- python scripts/train_model.py
103
- ```
104
-
105
- 5. Run the application:
106
- ```bash
107
- python app.py
108
- ```
109
-
110
- 6. Access the web interface:
111
- ```
112
- http://127.0.0.1:7860
113
- ```
114
-
115
- ## Usage
116
-
117
- ### Web Interface
118
-
119
- The application provides three modes of operation through an intuitive web UI:
120
-
121
- #### 1. Single Prediction
122
- Check risk for a specific developer-task assignment by providing:
123
- - **Developer Metrics**: ID, current task count, completion time, skill match score, story points assigned, overtime hours, task switch frequency, pending PR reviews
124
- - **Task Details**: Priority level, estimated story points, days until deadline, required skill, dependencies, task type
125
- - **Team Context**: Team size, sprint days remaining, team average velocity
126
-
127
- **Output**: Risk level, confidence score, probability distribution, contributing factors, and actionable recommendations.
128
-
129
- #### 2. Batch Prediction (CSV Upload)
130
- Upload a CSV file containing multiple task assignments with the following columns:
131
- ```
132
- developer_id, current_task_count, avg_completion_time_days, skill_match_score,
133
- total_story_points_assigned, recent_overtime_hours, task_switch_frequency,
134
- pr_review_pending, priority, estimated_story_points, days_until_deadline,
135
- required_skill, has_dependencies, task_type, team_size, sprint_days_remaining,
136
- team_avg_velocity
137
- ```
138
-
139
- **Output**: CSV file with predictions, risk labels, confidence scores, and probability distributions for each assignment.
140
-
141
- #### 3. Load Balancing (Recommend Developer)
142
- Provide task details and upload team workload CSV to get ranked recommendations for which developer should receive the new task.
143
-
144
- **Output**: Ranked list of developers with suitability scores, risk assessments, current workload, and recommendations.
145
-
146
- ### Python API
147
-
148
- #### Initialize Predictor
149
- ```python
150
- from api.inference import OverloadPredictor
151
- from api.schemas import TaskAssignment
152
-
153
- predictor = OverloadPredictor()
154
- ```
155
-
156
- #### Single Prediction
157
- ```python
158
- assignment = TaskAssignment(
159
- developer_id=5,
160
- current_task_count=4,
161
- avg_completion_time_days=6,
162
- skill_match_score=85,
163
- total_story_points_assigned=15,
164
- recent_overtime_hours=2,
165
- task_switch_frequency=3,
166
- pr_review_pending=2,
167
- priority=1,
168
- estimated_story_points=5,
169
- days_until_deadline=7,
170
- required_skill="backend",
171
- has_dependencies=0,
172
- task_type=0,
173
- team_size=10,
174
- sprint_days_remaining=8,
175
- team_avg_velocity=50
176
- )
177
-
178
- result = predictor.predict(assignment)
179
- print(f"Risk Level: {result.risk_label}")
180
- print(f"Confidence: {result.confidence:.2%}")
181
- print(f"Recommendation: {result.recommendation}")
182
- ```
183
-
184
- #### Batch Prediction
185
- ```python
186
- import pandas as pd
187
-
188
- df = pd.read_csv('data/test_batch.csv')
189
- results = predictor.predict_batch(df)
190
- results.to_csv('predictions.csv', index=False)
191
- ```
192
-
193
- #### Developer Recommendation
194
- ```python
195
- task_details = {
196
- 'priority': 0,
197
- 'estimated_story_points': 5,
198
- 'days_until_deadline': 7,
199
- 'required_skill': 'backend',
200
- 'has_dependencies': 0,
201
- 'task_type': 0
202
- }
203
-
204
- team_workload = pd.read_csv('tests/team_workload.csv')
205
- recommendations = predictor.recommend_developer(task_details, team_workload)
206
- print(recommendations.head())
207
- ```
208
-
209
- ## Model Architecture
210
-
211
- ### Algorithm
212
- **XGBoost Classifier** with the following configuration:
213
- - Number of estimators: 200
214
- - Maximum depth: 6
215
- - Learning rate: 0.1
216
- - Subsample ratio: 0.8
217
- - Column subsample ratio: 0.8
218
- - Objective: Multi-class softmax
219
- - Number of classes: 3 (Green, Yellow, Red)
220
-
221
- ### Feature Engineering
222
-
223
- The model uses 21 features, including 16 input features and 5 engineered features:
224
-
225
- **Input Features:**
226
- - current_task_count
227
- - avg_completion_time_days
228
- - skill_match_score
229
- - total_story_points_assigned
230
- - recent_overtime_hours
231
- - task_switch_frequency
232
- - pr_review_pending
233
- - priority (0=P0/Critical, 1=P1, 2=P2, 3=P3)
234
- - estimated_story_points
235
- - days_until_deadline
236
- - required_skill (encoded)
237
- - has_dependencies (0=No, 1=Yes)
238
- - task_type (0=Feature, 1=Bug, 2=Maintenance)
239
- - team_size
240
- - sprint_days_remaining
241
- - team_avg_velocity
242
-
243
- **Engineered Features:**
244
- - **workload_ratio**: total_story_points_assigned / 40
245
- - **urgency_score**: (31 - days_until_deadline) / 30
246
- - **capacity_indicator**: Weighted combination of task count, switch frequency, and workload ratio
247
- - **overtime_risk**: recent_overtime_hours / 20 (clipped to [0, 1])
248
- - **skill_deficit**: (100 - skill_match_score) / 100
249
-
250
- ### Training Process
251
-
252
- 1. **Data Preparation**: Load task assignments dataset and encode categorical features
253
- 2. **Feature Engineering**: Calculate derived metrics
254
- 3. **Train-Test Split**: 80-20 split with stratification
255
- 4. **Model Training**: XGBoost with histogram-based tree method
256
- 5. **Cross-Validation**: 5-fold stratified cross-validation
257
- 6. **Evaluation**: Classification report, confusion matrix, F1-score
258
- 7. **Feature Importance Analysis**: Identify top contributing features
259
- 8. **Model Persistence**: Save model, encoder, and metadata
260
-
261
- ## Model Performance
262
-
263
- The model achieves strong performance across all risk categories:
264
-
265
- ### Metrics
266
- - **Accuracy**: ~0.95
267
- - **F1-Score (Weighted)**: ~0.95
268
- - **Cross-Validation F1**: Mean ~0.94
269
-
270
- ### Classification Report
271
- ```
272
- precision recall f1-score support
273
-
274
- Green (0) 0.96 0.97 0.96 XXX
275
- Yellow (1) 0.93 0.92 0.93 XXX
276
- Red (2) 0.96 0.96 0.96 XXX
277
- ```
278
-
279
- ### Feature Importance
280
-
281
- Top contributing features:
282
- 1. capacity_indicator
283
- 2. current_task_count
284
- 3. workload_ratio
285
- 4. total_story_points_assigned
286
- 5. skill_match_score
287
- 6. recent_overtime_hours
288
- 7. urgency_score
289
- 8. days_until_deadline
290
- 9. avg_completion_time_days
291
- 10. overtime_risk
292
-
293
- Detailed feature importance rankings are available in `results/feature_importance.csv` and visualized in `results/feature_importance.png`.
294
-
295
- ## Screenshots
296
-
297
- ### Project Structure
298
- The complete folder hierarchy showing all modules, data files, trained models, and results.
299
-
300
- ![Project Structure](image_1.jpg)
301
-
302
- ### Web Application Interface
303
- Interactive web UI with three operation modes: Single Prediction for individual risk assessment, Batch Prediction for CSV uploads, and Load Balancing for developer recommendations.
304
-
305
- ![Web UI](image_2.jpg)
306
-
307
- The interface includes:
308
- - Real-time risk prediction with confidence scores
309
- - Interactive sliders and input fields for all parameters
310
- - Priority selection buttons (P0, P1, P2, P3)
311
- - Story point selection (1, 2, 3, 5, 8, 13)
312
- - Skill dropdown for backend/frontend/fullstack/devops/etc.
313
- - Team context configuration
314
- - Visual feedback with risk-level color coding
315
-
316
- ## API Endpoints
317
-
318
- If using as a REST API (via Flask/FastAPI):
319
-
320
- ### POST /predict
321
- Single task assignment prediction
322
- ```json
323
- {
324
- "developer_id": 5,
325
- "current_task_count": 4,
326
- "avg_completion_time_days": 6.0,
327
- "skill_match_score": 85,
328
- ...
329
- }
330
- ```
331
-
332
- **Response:**
333
- ```json
334
- {
335
- "developer_id": 5,
336
- "overload_risk": 0,
337
- "risk_label": "Green (Healthy)",
338
- "confidence": 0.87,
339
- "risk_probabilities": {
340
- "green": 0.87,
341
- "yellow": 0.10,
342
- "red": 0.03
343
- },
344
- "contributing_factors": ["No significant risk factors"],
345
- "recommendation": "Safe to assign. Developer has capacity."
346
- }
347
- ```
348
-
349
- ### POST /predict-batch
350
- Batch prediction from CSV upload
351
-
352
- ### POST /recommend
353
- Developer recommendation for new task
354
-
355
- ## Technical Stack
356
-
357
- - **Machine Learning**: XGBoost, scikit-learn
358
- - **Backend**: Flask/FastAPI
359
- - **Data Processing**: Pandas, NumPy
360
- - **Validation**: Pydantic
361
- - **Visualization**: Matplotlib, Seaborn
362
- - **Persistence**: Joblib
363
- - **Frontend**: HTML, CSS, JavaScript (Gradio or custom)
364
-
365
- ## Requirements
366
-
367
- Key dependencies (see `requirements.txt` for full list):
368
- ```
369
- xgboost>=1.7.0
370
- scikit-learn>=1.2.0
371
- pandas>=1.5.0
372
- numpy>=1.23.0
373
- pydantic>=1.10.0
374
- fastapi>=0.95.0
375
- joblib>=1.2.0
376
- matplotlib>=3.6.0
377
- seaborn>=0.12.0
378
- ```
379
-
380
- ## Data Schema
381
-
382
- ### Input CSV Format
383
- Columns required for batch predictions:
384
- - developer_id (int)
385
- - current_task_count (int, 0-12)
386
- - avg_completion_time_days (float, 1-25)
387
- - skill_match_score (int, 0-100)
388
- - total_story_points_assigned (int, 0-40)
389
- - recent_overtime_hours (int, 0-20)
390
- - task_switch_frequency (float, 0-10)
391
- - pr_review_pending (int, 0-15)
392
- - priority (int, 0-3)
393
- - estimated_story_points (int, 1-13)
394
- - days_until_deadline (int, 1-30)
395
- - required_skill (str: backend/frontend/fullstack/devops/ml/mobile)
396
- - has_dependencies (int, 0-1)
397
- - task_type (int, 0-2)
398
- - team_size (int, 5-15)
399
- - sprint_days_remaining (int, 1-14)
400
- - team_avg_velocity (int, 20-80)
401
-
402
- ## Use Cases
403
-
404
- 1. **Sprint Planning**: Optimize task distribution at sprint start
405
- 2. **Real-time Assignment**: Check capacity before assigning urgent tasks
406
- 3. **Workload Monitoring**: Identify developers at risk of burnout
407
- 4. **Resource Planning**: Make data-driven hiring decisions based on team capacity
408
- 5. **Performance Analysis**: Track how task assignments affect team velocity
409
-
410
- ## Limitations
411
-
412
- - Model trained on synthetic or historical data may not capture all real-world scenarios
413
- - Requires accurate input data for reliable predictions
414
- - Does not account for developer preferences or personal circumstances
415
- - Skill matching is simplified to single primary skill
416
- - Assumes story point estimates are accurate
417
-
418
- ## Future Enhancements
419
-
420
- - Multi-skill matching with weighted proficiency levels
421
- - Time-series forecasting for long-term capacity planning
422
- - Integration with JIRA, GitHub, and other project management tools
423
- - Real-time dashboard with team workload visualization
424
- - A/B testing framework for assignment strategies
425
- - Deep learning models for sequential task dependencies
426
- - Sentiment analysis from code review comments
427
- - Anomaly detection for sudden workload spikes
428
-
429
- ## Contributing
430
-
431
- Contributions are welcome. Please follow these guidelines:
432
-
433
- 1. Fork the repository
434
- 2. Create a feature branch
435
- 3. Make your changes with clear commit messages
436
- 4. Add tests for new functionality
437
- 5. Update documentation as needed
438
- 6. Submit a pull request
439
-
440
- ## License
441
-
442
- This project is licensed under the MIT License. See the LICENSE file for details.
443
-
444
- ## Acknowledgments
445
-
446
- - XGBoost development team for the gradient boosting framework
447
- - scikit-learn contributors for machine learning utilities
448
- - Open source community for Python data science ecosystem
449
-
450
- ## Contact
451
-
452
- For questions, issues, or suggestions, please open an issue on the repository or contact the maintainers.
453
-
454
-
455
- ```
 
1
+ ---
2
+ title: Intelligent Task Load Balancer
3
+ emoji: ⚖️
4
+ colorFrom: blue
5
+ colorTo: green
6
+ sdk: gradio
7
+ sdk_version: 5.9.1
8
+ app_file: app.py
9
+ pinned: false
10
+ ---