Recommend Source Codes Considering Designing Patterns using Machine Learning Algorithm
Thennakoon A.G.D.S., Wijeratne P.M.A.K., Kumara B. T. G. S. · 2024
As a result of the fact that design patterns offer templates that are necessary for addressing common problems and improving the communication, productivity, and maintainability of projects consistently, design patterns are of the highest importance in the process of developing software. Machine learning (ML) techniques, such as Support Vector Machine (SVM) and Decision Trees (DT), can be utilized to simplify the process of recognizing software design patterns in source code to educate machines on how to deal with complex data, unsupervised learning is used to recognize patterns, and supervised learning is used to map inputs to outputs. The research was carried out to employ ML to produce predictions about design patterns that are present in code. Initially, the procedure begins with the gathering of datasets from professionals in the field of software engineering. These datasets were eventually classified into three categories: Abstract Factory, Factory Method, and Singleton. Three different ML models and one deep learning model were applied to make predictions. K-Nearest Neighbors (KNN), SVM, DT and Long Short-Term Memory (LSTM) respectively. For the goal of creating such predictions, SVM which has been demonstrated to correctly recognize design patterns with an impressive 98.67% accuracy, is the suitable algorithm to use. The degree of cosine similarity among the input code snippets and the group code snippets is used to decide which 5 code suggestions are the next most relevant.