BERT-based models for software size measurement.
Note: The industrial datasets for Case 1 and Case 2 are not publicly available due to intellectual property restrictions.
Availability: Models trained on the heterogeneous dataset are publicly available at https://huggingface.co/smtnkc/SSMBERT.
Run the following commands to shuffle each dataset:
python shuffle_data.py --dataset heterounique
python shuffle_data.py --dataset case1
python shuffle_data.py --dataset case2This script reads:
data/heterounique.csvdata/case1.csvdata/case2.csv
and produces:
data/heterounique-shuffled-data.csvdata/case1-shuffled-data.csvdata/case2-shuffled-data.csv
Two evaluation modes are supported:
-
Generic evaluation Training and testing both use the heterogeneous dataset.
-
Internal evaluation Training and testing both use an organization‑ or project‑specific dataset.
Both modes employ 5‑fold cross validation with the bert and se-bert models.
python cross_val.py --dataset heterounique --target entry --model bertThis command will:
- Load
data/heterounique-shuffled-data.csvand perform 5‑fold cross validation (5 epochs per fold, 25 epochs total). - For each fold, select the epoch with lowest MSE and generate predictions.
- Concatenate all fold predictions into
data/heterounique-shuffled-data-predby-bert-heterounique.csv. - Save the best model as
checkpoints/bert-heterounique-entry.pt. - Log metrics to
logs/heterounique-entry-predby-bert-heterounique.csv.
To run every combination of model, dataset, and target, use:
./run_cross_val.shThis executes 2 models (bert, se-bert) × 4 datasets (heterounique, heterogrouped, case1, case2) × 7 targets (entry, read, write, exit, interaction, communication, process) for 56 total runs.
Use a model trained on the heterogeneous dataset to predict on an organization‑specific set. The full dataset then serves as the test set. Available models: bert-heterounique or se-bert-heterounique.
python pred.py --dataset case1 --target entry --model bert-heterouniqueThis command will:
- Load
data/case1-shuffled-data.csvandcheckpoints/bert-heterounique-entry.pt. - Generate predictions and concatenate them into
data/case1-shuffled-data-predby-bert-heterounique.csv. - Log metrics to
logs/case1-entry-predby-bert-heterounique.csv.
To run every combination of model, dataset, and target, use:
./run_pred.shThis executes 2 models (bert-heterounique, se-bert-heterounique) ×
2 datasets (case1, case2) × 7 targets (entry, read, write, exit, interaction, communication, process) for 28 total runs.
python sum_preds.pyFor each CSV under preds/, this script:
-
Adds a
cfp_predcolumn:cfp_pred = entry_pred + read_pred + write_pred + exit_pred -
Adds a
microm_predcolumn:microm_pred = interaction_pred + communication_pred + process_pred -
Reorders columns for consistency.
python calculate_metrics.pyProcesses all prediction files in preds/ and outputs these CSVs in stats/:
mse.csv– Mean Squared Errormae.csv– Mean Absolute Errornmae.csv– Normalized MAE (MAE / mean actual)acc.csv– Exact Match Accuracy (after rounding)mmre.csv– Mean Magnitude of Relative Errorpred30.csv– Percentage of predictions with MRE ≤ 0.30nonzero.csv– Percentage of non-zero actual values
Each file reports metrics for all features (entry, read, write, exit, cfp, interaction, communication, process, microm) across:
- Model (
bert,se-bert) - Training set (
heterounique,case1,case2) - Test set (
heterounique,case1,case2)
All metric values are rounded to four decimal places.