An automated approach for requirement classification using machine learning
摘要
In today’s dynamic and fast-paced software development landscape, the accurate classification of requirements, particularly distinguishing between functional requirements (FR) and non-functional requirements (NFR), remains a significant challenge. Misclassification often leads to architectural mismatches, increased rework, and delays. Existing machine learning (ML)-based methods often overlook contextual elements, like stakeholder knowledge, organizational structures, and environmental limitations, which may result in incorrect classifications that need rework on large-scale projects. To address this, we propose a context-aware approach that incorporates contextual factor mapping into the classification and feature selection process. We test two text vectorization methods, Bag of Words (BoW) and Chi-Squared (CHI2), and three classifiers, Logistic Regression (LR), Multinomial Naïve Bayes (MNB), and Support Vector Machines (SVM), using the PROMISE_exp dataset. BoW + MNB leads with F1 = 0.73 in an 11-class NFR job, earns an F1 score of 0.92 in binary FR/NFR classification, and both SVM-CHI2 and LR-CHI2 produce F1 = 0.77 in the combined 12-class scenario. These findings demonstrate that adding contextual information significantly improves classification accuracy by lowering misclassification rates and offering practical recommendations to cut down on manual labor and rework. Consequently, our study lays a solid basis for further research on context-aware requirements engineering.