Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
tags:
|
| 3 |
+
- multi-label-classification
|
| 4 |
+
- software-defect-prediction
|
| 5 |
+
metrics:
|
| 6 |
+
- hamming-loss
|
| 7 |
+
- f1
|
| 8 |
+
- precision-at-k
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# Multi-Label Software Defect Prediction Models
|
| 12 |
+
|
| 13 |
+
This repository contains trained models for predicting multiple software defects simultaneously.
|
| 14 |
+
|
| 15 |
+
## Models Included
|
| 16 |
+
|
| 17 |
+
- **SVM**: Support Vector Machine with One-vs-Rest strategy
|
| 18 |
+
- **Logistic Regression**: Multi-label logistic regression
|
| 19 |
+
- **Perceptron**: Online learning perceptron for multi-label
|
| 20 |
+
- **DNN**: Deep Neural Network with sigmoid output layer
|
| 21 |
+
|
| 22 |
+
## Features
|
| 23 |
+
|
| 24 |
+
The models use various software metrics including:
|
| 25 |
+
- Code complexity metrics
|
| 26 |
+
- Size metrics
|
| 27 |
+
- Coupling metrics
|
| 28 |
+
- Cohesion metrics
|
| 29 |
+
|
| 30 |
+
## Performance
|
| 31 |
+
|
| 32 |
+
| Model | Hamming Loss | Micro-F1 | Macro-F1 |
|
| 33 |
+
|-------|--------------|----------|----------|
|
| 34 |
+
| SVM | 0.15 | 0.78 | 0.72 |
|
| 35 |
+
| Logistic Regression | 0.17 | 0.75 | 0.69 |
|
| 36 |
+
| Perceptron | 0.20 | 0.70 | 0.64 |
|
| 37 |
+
| DNN | 0.13 | 0.82 | 0.76 |
|
| 38 |
+
|
| 39 |
+
## Usage
|
| 40 |
+
|
| 41 |
+
```python
|
| 42 |
+
import pickle
|
| 43 |
+
import numpy as np
|
| 44 |
+
|
| 45 |
+
# Load model and scaler
|
| 46 |
+
with open('defect_svm_model.pkl', 'rb') as f:
|
| 47 |
+
model = pickle.load(f)
|
| 48 |
+
with open('defect_scaler.pkl', 'rb') as f:
|
| 49 |
+
scaler = pickle.load(f)
|
| 50 |
+
|
| 51 |
+
# Prepare features
|
| 52 |
+
features = np.array([...]) # Your feature vector
|
| 53 |
+
features_scaled = scaler.transform(features.reshape(1, -1))
|
| 54 |
+
|
| 55 |
+
# Predict
|
| 56 |
+
predictions = model.predict(features_scaled)
|
| 57 |
+
probabilities = model.predict_proba(features_scaled)
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
## Training Details
|
| 61 |
+
|
| 62 |
+
- **Online Learning**: Perceptron uses online learning mode with per-sample weight updates
|
| 63 |
+
- **Multi-label Strategy**: One-vs-Rest for SVM and Logistic Regression
|
| 64 |
+
- **Hyperparameter Tuning**: Grid search with cross-validation
|