1 Introduction

Software maintenance is a fundamental step of software development. One of the main functions of the maintenance cycle is bug identification [1]. Unfortunately, due to the large number of bugs displayed in the software items, the bug resolution has become a difficult and troublesome task [2]. The critical software configurations over a longer drag period tends to increase the frustration rate or decrease the efficiency which related with the performance [3].Software bug is a defect, error or defect that results in incorrect or unpredictable results. The presence of this software bug directly affects the quality and maintenance cost of the software framework [4, 5]. A software defect may also occur when the last software product does not meet the client requirement or client assumption [11].

Accurate prediction of software errors can be exceptionally helpful in providing direction to the software testing process. Error expectation methods are used to identify gaps in the software structure that contain errors [6]. Quality, reliability and cost of maintenance are significantly affected by the presence of software errors [27]. Early detection of a product error allows software to be adapted to different conditions and improves resource utilization. In computer programming, testing and debugging are very expensive and require a very large scale of assets [12]. Efficient defect prediction saves test cost and may further improve software quality [7, 8]. Software defect prediction strategies vary from product measurements to machine learning (ML) and Software Computing (SC) practices [9]. The AI ​​system is a significant part of PCs for software error prediction [13]. Various feature selection techniques have been used to select a better element subcommittee for imperfect prediction, as the meaningless and repetitive features in the decay information may distort the exhibition of grouping models [10, 14]. Finally, software bug prediction should be possible by sorting blocks / classes as a preferred issue.

The main contribution of the proposed model as follows,

  • To detect the software bugs, adaptive golden eagle optimizer (AGEO) and Long Short-Term Memory (LSTM) based recurrent neural network (RNN) is used here.

  • To select the optimal features, the suggested method utilizes the Adaptive Golden Eagle Optimizer (AGEO).

  • LSTM based recurrent neural network (RNN) is proposed here to detect the bug from the software.

  • The experiment performed on 15 different Promise repository datasets. To calculate the proposed performance, different metrics are evaluated. According to the conclusion, the proposed model gives better result compare with another existing model.

The structure of the paper is organized as follows. In the next section we will discuss about related work 2, architectural design and algorithm of AGEO and LSTM based RNN were discussed in Section 3, result and discussion were explained in Section 4, and conclusion & future work in Section 5 were discussed.

2 Literature review

A brief overview of the latest software bug prediction techniques are explained in this section. Using machine learning and statistical techniques, the number of defects in a given software system were predicted by many researchers earlier. Most of the researches have included the prediction techniques such as graph convolutional neural networks [15], deep learning [16], layered recurrent neural network [17], kernel Principal Component Analysis and weighted extreme learning machine [18], Ensemble learning [19] and Artificial Immune Network [21], etc.

Kapil Juneja [15] have presented a fuzzy filtered neural fuzzy framework to predict external and internal software programming. Using a combination of information gain and return ratio measurements, a mixed scientific concept of each product characteristic was determined. After selecting the high-way highlights, fuzzy rules were used. Finally, this technique was used for neuro fuzzy classifier software bug prediction. In this method contains lower accuracy. Similarly, Lei Qiao et al. [16] have proposed an ingenious method that uses in-deep learning practices to predict the extent of faults in the software framework. Pre-processing is processing, using log conversion and data standardization. Then, at that time, they organized input data for the in-depth learning model. Then, at that time, a deep neural network-based model was used to predict the extent of the defects.

Because of the large amount of data from mining software history repositories, therefore some measurements are not associated with errors, this misleading the result of learning algorithms and thus reducing its effectiveness. Outcomes of the method is not very clear to identify the bug. To address this problem, Hamza Turabieh et al. [17] have presented software defect prediction by using the layered recurrent neural network with the iterated feature selection. They used three distinct inclusive feature determination calculations and completed the defect prognosis by layered recurrence neural network system.

Zhou Xu et al. [18] have proposed a weighted extreme learning machine (WELM) and kernel Principal Component Analysis (KPCA) for software defect prediction. To deal with the complex construction of defect information, KPCA was first used to software data outside of a passive element. Later, at that time, WELM was proposed to differentiate the decay in the product.

To address the class imbalance and over fitting problem, Sushant Kumar Pandey et al. [19] have proposed a simple sequence-based structure for bug prediction using Deep representation and Ensemble learning (BPDET) techniques. Here the feature was first extracted, at which point the error prediction was completed by two layers of the EL state (TEL). Likewise, Sammar Moustafa et al. [20] proposed a defect prediction model based on weighted randomized majority voting method. They have used those methods for various arrangements of software measurements in actual datasets of different sizes.

Error prediction has built-in parameters that control their features, but most of the time these classifiers sometimes do not work well when using default settings. So, FAIZA KHAN et al. [21] have proposed a product expectation model based on the Artificial Immune Network (AIN). They have used hyper-parameter optimization to further improve error expectation accuracy. Mahajan and Chaudhary [31] developed software bug localization. To achieve this objective, a hybrid optimization-based CNN was developed. They introduced hybridized cuckoo search-based sea lion optimization algorithm for feature selection. The method attained good results compared to other methods. Rani et al. [32] introduced deep reinforcement learning technique-based bug detection in video games. Wang et al. [33] developed a graph CNN-based software version-to-version bug prediction system. Choetkiertikul et al. [34] had analysed deep learnig algorithm based bug prediction. Cynthia et al. [35] developed software bug detection based on Feature transformation. Here, they mainly focused on feature selection-based prediction. Moreover, Giray et al. [36] developed a deep learning algorithm-based bug prediction. Here, they analyzed different machine learning algorithms and deep learning algorithm performance.

In this research, the features are optimally selected by AGEO for reducing the data dimension problem and the bug prediction is done by LSTM based RNN. While considerable work has been done for feature optimization, but the performance of the earlier classifier achieves minimum results. In order to achieve the better performance, the proposed method uses the AGEO and LSTM based RNN for bug prediction.

3 Motivation

The main problem with the current system is the data dimension. This problem affects the performance of the existing bug prediction system. Therefore in the early research uses a certain number of features to predict errors in software programs. Using all features or a fixed number does not provide a high performance on all databases. This problem motivates to selecting the most valuable features by examining the database using feature selection algorithms. For selecting the optimal features, the AGEO algorithm is used here. The main aim of the AGEO algorithm is selects the optimal features with shortest time. Based on the valuable features, bug prediction classifier performance is increases in the proposed model.

4 Proposed methodology

Defect prediction, one of the major software engineering problems, has been in the focus of researchers [28, 29]. Many researchers have built a software bug prediction model, which classify faulty and non-faulty module which are associated with software metrics. To estimate the software quality, bug prediction is the most required measure [25, 28, 30]. In quality and cost, software defects are expensive [26]. The early detection of the software error boosts the adaptation of software to various conditions and enhances the usage of resources. So that, effective software bug prediction model is proposed in this paper. At first the input bug dataset is preprocessed. In preprocessing, remove the duplicate data instances from the dataset. After the preprocessing, the feature selection is done by Adaptive Golden Eagle Optimizer (AGEO). Finally, the proposed approach utilizes a long short-term memory (LSTM) based recurrent neural network (RNN) for bug prediction. Long Short-Term Memory (LSTM) network is a type of recurrent neural network. Recurrent Neural Networks (RNN) is a class of Artificial Neural Networks that can process a sequence of inputs in deep learning and retain its state while processing the next sequence of inputs. In Fig. 1, the overall semantic diagram of proposed model is shown.

Fig. 1
figure 1

Semantic diagram of overall proposed model

Let as considers the input dataset is PROMISE and NASA dataset (http://promise.site.uottawa.ca/SERepository/datasets-page.html) for bug prediction. These datasets are noise free and have no missing values. At first the input data is preprocessed. Then optimal features are selected. Based on the optimal features, the software bug is predicted. The proposed method considers the three main steps such as,

  • Preprocessing

  • Optimal Feature selection

  • Bug Prediction

The detailed description of each step is explained below,

4.1 Preprocessing

In the real world dataset, the software modules have the same software metrics and same class labels. This repetitive events lead to a negative impact on machine learning. Furthermore, they make the training phase more time consuming and reduce the performance of the model. In order to overcome those problems, the duplicate data instances are removed from the software model in preprocessing steps. Once the duplicate data is removed, the resultant output is fed to the feature selection process.

4.2 Feature selection using AGEO

The main motive of the feature selection is to compute the efficient features form the input data. The main objective of feature selection techniques is utilized to compute the optimal feature set which denotes the input data. Normally, the feature selection is affected by NP hard issue. Huge issues cannot be solved with the consideration of optimal feature selection. Hence, metaheuristic algorithms are utilized to select optimal features in the proposed design model. The metaheuristic algorithm is utilized to compute the optimal and closest solution set for solving specific issues. Here the feature selection is done by adaptive golden eagle optimizer (AGEO). The detailed explanation AGEO algorithm is illustrated in further section.

4.2.1 Adaptive Golden Eagle Optimizer (AGEO)

Intelligence of gold eagles at the tuning speed at different stages of the twisting direction for hunting is propelled in Golden Eagle Optimizer (GEO) [22]. They are more propensities to stroll around and search for prey in the early stages of the hunt and are more prone to attack in the later stages. Both of these elements are adjusted by the golden eagle and get the best prey in the shortest time. This behavior has been numerically demonstrated to highlight the study and exploitation of the global optimization system. The process of hunting the golden eagle,

  • For searching the prey, GEO follows the spiral motion and for attacking the prey, GEO follows the straight path.

  • In the initial stage, GEO shows more propensities to cruise and in the final stage, GEO shows more propensities to attack.

  • In every moment of the flight, GEO holds the tendency for both cruise and attack.

  • GEO search for information about other eagles' prey.

In this proposed methodology, the conventional GEO technique is changed with the consideration of Opposition Based Learning (OBL) [24]. The OBL concept is introduced with the consideration of opposite relationship among entities. These entities are focusing on enhancement of the optimization performance in the lower dimension. This OBL is connected with the GEO which defined as the adaptive golden eagle optimizer (AGEO). The following section provides the mathematical formulation of the AGEO algorithm is given. The AGEO have six different phases which presented follows,

  1. 1)

    Initialization of golden eagles

  2. 2)

    Initialize the opposition based golden eagles

  3. 3)

    Evaluating the golden eagles with the fitness function

  4. 4)

    Renewing eagles cruise vector and attack vector

  5. 5)

    Updating the position of the eagles with the new memory

  6. 6)

    Transition from exploration to exploitation

Mathematical model of AGEO algorithm

figure afigure afigure afigure a

Based on the above feature selection process, optimal features are selected from the input PROMISE dataset. Then the selected features are fed to the bug detection process.

4.3 Bug Detection using LSTM based RNN

Here, the proposed approach uses the Recurrent Neural Network (RNN) based on Long Short Tern Memory (LSTM) [23] for error prediction. RNNs are a class of artificial neural networks that may interact with the organization of contributions to in-depth learning and maintain their status when dealing with the following information sources. The LSTM network is a type of intermediate neural system. LSTM consists of four neural system layers that interface in an optimal way. LSTM can add or erase data to the memory cell state, using an exceptionally planned architecture labeled "Gateway". This is the area where the gateway function information is selected, ie elements of information. It consists of the layering and multiplication work of the sigmoid neural structure. The sigmoid layer reverses the information of the features by the sigmoid capability and evaluates the results somewhere between 0 and 1, depicting how much information elements can be experienced in section A of the framework. "0" indicates that no information is allowed to be sent. "1" indicates that all information is allowed to be sent. At each successor list level, the gate structure in the LSTM is associated with an information gateway, a forgetting gate and an output gate.

4.3.1 Forget gate

The Forget gate will select which information to discard or keep from last minute's memory:

$$\mathop F\nolimits_{G} = \sigma \left[ {w^{F} \left( {\mathop F\nolimits_{t} ,\,\mathop Y\nolimits_{t - 1} } \right) + c^{F} } \right]$$
(15)

Where, FGcan be described as the forget gate. C and w indicate the control and weight boundaries. Ft addresses input at the current timestamp; Yt-1 indicates the result got at the timestamp t-1 from the past square of LSTM. \(\sigma\) indicates the calculated sigmoid capacity and they give the result esteem between 0 or 1. On the off chance that the result is '0' then it implies obstructing of entryways. In case the result is '1' entryways letting everything pass.

4.3.2 Input gate

The input gate \(\mathop I\nolimits_{G}\) chooses the information that should be stored:

$$\mathop I\nolimits_{G} = \sigma \left[ {w^{I} \left( {\mathop F\nolimits_{t} ,\,\mathop Y\nolimits_{t - 1} } \right) + C^{I} } \right]$$
(16)

4.4 Output gate

Finally, the output gate determines which part of the memory is in the long run yielded:

$$\mathop O\nolimits_{G} = \sigma \left[ {w^{O} \left( {\mathop F\nolimits_{t} ,\,\mathop Y\nolimits_{t - 1} } \right) + C^{O} } \right]$$
(17)

Another candidate memory call \(\mathop M\nolimits_{t}\) is made by a tanH layer and is denoted as,

$$\mathop M\nolimits_{t} = \tan H\left[ {w^{M} \left( {F_{t} ,\,\mathop Y\nolimits_{t - 1} } \right) + c^{M} } \right]$$
(18)

Where, tanH allows LSTM to add or remove data from the last input. The information gateway selects the age of the incoming memory cell, and the forgetgate selects whether to hold or delete data to create the last memory.

$$\mathop M\nolimits_{t} = \mathop F\nolimits_{G} *\mathop M\nolimits_{t - 1} + \mathop I\nolimits_{G} *\mathop M\nolimits_{t}$$
(19)

Where Mt denotes memory cell state at current time stamp (t) and *represent the element-wise multiplication of the vector. Finally the output is evaluated by,

$$\mathop Y\nolimits_{t} = \mathop O\nolimits_{G} * \tan H\left( {\mathop M\nolimits_{t} } \right)$$
(20)

Where,* represents the element-wise multiplication of the vectors, Yt points the output obtained through the softmax output layer to get the predicted output from the current block. Mt denotes memory cell state. Finally, the loss function of the model is evaluated by choosing the mean square error as the error calculation,

$$Loss = \sum\limits_{t = 1}^{N} {\mathop {\left( {\mathop Y\nolimits_{t} - \mathop T\nolimits_{t} } \right)}\nolimits^{2} }$$
(21)

Where, Tt denotes the desired output. N is the prediction generated from a sample of n data points. If the rated score is 0, at that point, the component is considered as a bug and if the rated score is 1, at that point, the included information is considered as a bug. In its light, the proposed technique distinguishes the bug in the software.

5 Experimental result analysis

An experimental result obtained from the proposed software bug predictions is analysed in this section. The execution is done in the python. The execution used system have 2 GHz dual core computer with 4 GB RAM running a 64-bit version of Windows 2007. The measures used to evaluate the proposed performance are Accuracy, F-measure, G-measure, and Matthews Correlation Coefficient (MCC). The parameter range of AGEO algorithm is presented in Table 1.

Table 1 Parameters of AGEO algorithm

5.1 Dataset description

For experimental analysis, two sets of datasets is used namely, the PROMISE and NASA dataset. In this paper, we analyze 10 real software responsibility schemes since the PROMISE public software engineering repository (http://promise.site.uottawa.ca/SERepository/datasets-page.html), which are extremely suggested by numerous investigators in software engineering. The attribute present in the PROMISE dataset is given in Table 2. Moreover, in this paper, we examine five projects from the NASA dataset. The attributes present in the NASA dataset are given in Table 3.

Table 2 PROMISE dataset features and selected features
Table 3 NASA dataset features and selected features

5.2 Performance analysis of proposed bug detection model

In this section, the proposed model performance is analyzed. For that the method considered the ten datasets from Promise dataset and five dataset from NASA. The performance result of the proposed model is tabulated in Tables 4 and 5.

Table 4 The proposed performance of Promise dataset
Table 5 The proposed performance of NASA dataset

Table 4 shows the performance analysis of proposed model using promise dataset. Here the proposed method is considered the ten projects for evaluation, such as Ant 1.6, Ant 1.7, Camel 1.4, Camel 1.6, Jedit 4.3, Log4j 1.0, Prop 4, Xalan 2.4, Xalan 2.5 and Xerces 1.2. From the proposed performance analysis result, the project prop 4 achieves the maximum accuracy, f-measure and MCC value is 93.41%, 0.883 and 0.68. The project camel 1.4 achieves the maximum G-measure value is 0.878.

Table 5 shows the performance analysis of proposed model using NASA dataset. Here the five projects are considered for proposed evaluation, such as CM1, JM1, KC1, KC2, and PC1. From the proposed performance analysis result, the project PC1 achieves the maximum accuracy, f-measure and G-measure value is 92.8%, 0.962 and 0.957. The project CM1 achieves the maximum MCC value is 0.58.The following section discusses the comparative study of the suggested mechanism and the results are contrasted with other research papers.

5.3 Comparative study of recommended model

Here, the experimental results are compared with other software bug prediction model. For comparison the method considered the existing bug detection algorithm is artificial neural network (ANN), K-nearest neighbor (KNN), Naive bias (NB), and Random forest (RF) and Support vector machine (SVM). The average results are plotted in below,

When analyzing the Fig. 4, it shows the comparison result of bug detection for promise dataset. Here the proposed method attains the accuracy value is 80.01% but the existing method attains the minimum accuracy value. The F-measure and G-measure value of the proposed method is 0.7816 and 0.77, which is maximum value when compared to the ANN, KNN, NB, RF and SVM. The proposed MCC value of the proposed promise bug detection dataset is 0.52, but the existing ANN, KNN, NB, RF and SVM achieves the MCC value is 0.463, 0.3, 0.244, 0.34 and 0.42. From the results, the suggested method attains the maximum accuracy, F-measure, G-measure and MCC value compared to the existing method.

Fig. 4
figure 2

Average results of bug detection for promise dataset

The comparison result of bug detection for NASA dataset is shown in Fig. 5. Here the proposed method attains the accuracy value is 85.5% but the existing ANN, KNN, NB, RF and SVM achieves the accuracy value is 81.5%, 72%, 64%, 52.1% and 71% which is minimum value when compared to the proposed value. The F-measure and G-measure value of the proposed method is 0.884 and 0.906, which is maximum value when compared to the ANN, KNN, NB, RF and SVM. The proposed MCC value of the proposed NASA bug detection dataset is 0.47. From the results, the suggested method attains the maximum accuracy, F-measure, G-measure and MCC value compared to the existing method.To perform the comparison, the suggested method considers various existing research papers are Kapil Juneja [15], Hamza Turabieh [17], Zhou Xu [18] and Sushant Kumar Pandey [19]. The exiting research paper [15] uses the software bug prediction technique is fuzzy-filtered neuro-fuzzy framework. In [17], the software bug detection is done by iterated feature selection algorithms with layered recurrent neural network and in [18] kernel PCA and weighted extreme learning machine is used for software bug detection. In [19], the bug detection is done by Deep Representation and Ensemble Learning Techniques. The comparison results are box plotted in below,

Fig. 5
figure 3

Average results of bug detection for NASA dataset

From the above Fig. 6, 7, 8, 9, it shows the comparison result of promise dataset. The experimental result shows that, the proposed method attains better result for all the ten projects of promise dataset compared to the existing algorithm. The proposed accuracy value of Ant 1.6 is 84.68%, Ant 1.7 is 88.82%, Camel 1.4 is 66.78%, Camel 1.6 is 87.66%, Jedit 4.3 is 77.92%, Log4j 1.0 is 81.88%, Prop 4 is 93.41%, Xalan 2.4 is 67.84%, Xalan 2.5 is 76.87% and Xerces 1.2 is 75.86%. Among these, the Prop 4 project attains the maximum accuracy value compared to all the other projects. From the results, the accuracy of the proposed method is maximum value when compared to the existing method [15] and existing method [17]. The f-measure and g-measure value of the proposed method is maximum value for all the ten projects compared to the existing methods. The proposed MCC value of Ant 1.6 is 0.795, Ant 1.7 is 0.89, Camel 1.4 is 0.878, Camel 1.6 is 0.62, Jedit 4.3 is 0.863, Log4j 1.0 is 0.792, Prop 4 is 0.852, Xalan 2.4 is 0.712, Xalan 2.5 is 0.72 and Xerces 1.2 is 0.652. Among these, the Ant 1.7 project attains the maximum MCC value compared to all the other projects. When compared to the existing method, the suggested method achieves better result compared to the state of art methods.

Fig. 6
figure 4

Accuracy comparison of promise dataset

Fig. 7
figure 5

F-Measure comparison of promise dataset

Fig. 8
figure 6

G-Measure comparison of promise dataset

Fig. 9
figure 7

MCC comparison of promise dataset

The comparison result of NASA dataset is shown in the above Fig. 10, 11, 12, 13. The experimental result shows that, the proposed method attains better result for all the five projects of NASA dataset compared to the existing algorithm. The proposed accuracy value of CM1 is 79.84%, JM1 is 80.68%, KC1 is 85.42%, KC2 is 88.95%, and PC1 is 92.8%. Among these, the PC1 project attains the maximum accuracy value compared to all the other projects. From the results, the accuracy of the proposed method is maximum value when compared to the existing method [18] and existing method [19]. The f-measure and g-measure value of the proposed method is maximum value for all the five projects compared to the existing methods. The proposed MCC value of CM1 is 0.58, JM1 is 0.479, KC1 is 0.452, KC2 is 0.447, and PC1 is 0.42. Among these, the CM1 project attains the maximum MCC value compared to all the other projects. When compared to the existing method, the suggested method achieves better result compared to the state of art methods.

Fig. 10
figure 8

Accuracy comparison of NASA dataset

Fig. 11
figure 9

F-Measure comparison of NASA dataset

Fig. 12
figure 10

G-Measure comparison of NASA dataset

Fig. 13
figure 11

MCC comparison of NASA dataset

6 Conclusion

Adaptive golden eagle optimizer (AGEO) and LSTM based recurrent neural network was proposed to detect the software bug in this paper. For selecting the optimal features AGEO algorithm was proposed. Finally software bug detection was done by LSTM based recurrent neural network. The aim of the work is to improve bug detection accuracy; so, the model particularly selects the optimal features. This optimal features lead to enhance the performance of bug detection. The proposed method was implemented in the working platform of JAVA. Here the method considered the input dataset was Promise and NASA dataset. The performance evaluation of proposed method has been done using different metrics such as Accuracy, F-measure, G-measure and MCC. The proposed method attains the maximum bug detection accuracy for promise dataset is 80.1% and the detection accuracy for NASA dataset is 85.5%. Empirical results prove that the proposed approach achieves better performance compared to the existing method. In future, to enhance the performance of software bug detection, hybrid deep learning based detection method will be included in the proposed model also we will use this method for real time applications.