A method for predicting the severity of defect reports based on description keyword extraction
By extracting keywords from defect descriptions and combining them with defect summaries for vector representation, the problem of limited performance of the defect report severity prediction model is solved, achieving more accurate defect report severity prediction and higher model performance.
Patent Information
- Application Number
- CN202110412776.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-16
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2041-04-16
AI Technical Summary
Existing defect report severity prediction models have limited performance due to less text in defect summaries, making it difficult to achieve accurate predictions.
By extracting keywords from the defect description, combining it with the defect summary for vector representation, and using the logistic regression classification method to train the severity prediction model, the number of data sets and model performance are enhanced.
Improved the performance of the defect report severity prediction model, using fewer keywords to achieve better model performance, and enhanced the efficiency of rapid repair and distribution of defect reports.
Smart Images

Figure CN113011180B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of software quality assurance, and in particular to a defect report severity prediction method based on description keyword extraction. Background Art
[0002] With the development of Internet technology, software engineering technology has developed accordingly. Due to the increasing number of software projects, there will inevitably be software defects of varying sizes in software projects. 90% of software defects will seriously affect the user experience, so it is particularly important to track and manage defects in software projects. In the defect report tracking system, defect reports are used to report problems encountered by users. The severity in the defect report can be used by testers to reasonably allocate defect reports and developers to quickly fix defects, thereby reducing the workload of manual allocation and achieving rapid repair of defects.
[0003] In view of the above situation, the defect report severity prediction performs text preprocessing according to the content of the defect report, and finally realizes the prediction of the severity attribute value in the defect report. At present, the prediction of the severity of defect reports usually uses the defect summary as the training data set, but the defect summary has less text, which limits the performance of the severity prediction model.
[0004] How to solve the above technical problems is the subject faced by the present invention. Summary of the invention
[0005] In order to solve the above-mentioned invention problems, the present invention provides a defect report severity prediction method based on descriptive keyword extraction. For the current prediction of defect report severity, defect summaries are usually used as training data sets, but the defect summaries have less text, which limits the performance of the severity prediction model. Based on this, the prediction method uses the remaining content in the defect report to supplement the defect summary to further enhance the model performance.
[0006] The present invention proposes a defect report severity prediction method based on description keyword extraction, the prediction method comprising the following steps:
[0007] (1) Select defect reports with status of CLOSED and FIXED and severity of Blocker, Critical, Major, Minor, and Trivial from the defect tracking system where the project is located, and download the data of these defect reports. The downloaded fields include defect summary, defect description, and defect report severity, and the data set is constructed based on this.
[0008] (2) The text in the defect summary field in the dataset is segmented, stop words are removed, and word form is restored in sequence to obtain the corresponding segmentation set Ts ;
[0009] (3) Using the word set T s The word embedding method FastText is used to train and obtain the summary word vector model F according to the severity of the defect reports in the dataset. s , use this model to vectorize the defect summary, specifically: based on the summary word vector model F s Get the vector of each word in the defect summary, and sum the vectors of each word in the defect summary to get the defect summary vector E s ;
[0010] (4) Extract and represent keywords for the defect description field in the data set to obtain the defect description vector E d ;
[0011] (5) Merge the defect summary vector E s With the defect description vector E d As the input vector E input ;
[0012] (6) Based on the input vector E input and the severity of defect reports in the dataset, using the logistic regression classification method to train and obtain a defect report severity prediction model;
[0013] (7) Input a new defect report, process its defect summary in step (2), process its defect description in step (4), merge the two vectors based on step (5) and input them into the defect report severity prediction model obtained in step (6) to obtain the final prediction result;
[0014] In step (4), keywords are extracted and represented for the defect description field in the experimental data set to obtain the defect description vector E d , specifically including the following steps:
[0015] 1) Use the regularization method to replace the string of the defect description field in the dataset, including: matching the content containing URL and replacing it with the "url" string, matching the console output content and replacing it with the "console" string, matching the code snippet and replacing it with the "code" string, then perform word segmentation, stop word removal, and lemmatization to obtain the corresponding word segmentation set;
[0016] 2) Based on the word set, the keyword extraction method Textrank is used to extract the keyword set T of the defect description d ;
[0017] 3) Based on the keyword set T dThe severity corresponding to the data set is trained using the word embedding method FastText to obtain the description word vector model F d , use this model to represent the defect description vector, specifically: based on the description word vector model F d Get the vector of each keyword in the defect description, and sum the vectors of each keyword in the defect description to obtain the defect description vector E d .
[0018] Compared with the prior art, the beneficial effect of the embodiments of the present invention is that the present invention uses the keywords extracted from the defect description to supplement the defect summary, which can increase the number of data sets and thereby improve the prediction performance of the defect report severity prediction model. Among them, the keywords obtained by the keyword extraction method Textrank can improve the performance of the defect report severity prediction model while compressing the defect description information, that is, using fewer keywords to achieve better model performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The accompanying drawings are used to provide further understanding of the present invention and constitute a part of the specification. They are used to explain the present invention together with the embodiments of the present invention and do not constitute a limitation of the present invention.
[0020] Figure 1 The figure is a flow chart of the defect report severity prediction method based on description keyword extraction according to the present invention. DETAILED DESCRIPTION
[0021] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the following embodiments further describe the present invention in detail. Of course, the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0022] Example 1
[0023] See also Figure 1 The present invention provides a defect report severity prediction method based on description keyword extraction, the prediction method comprising the following steps:
[0024] (1) From the defect tracking system where the project is located, defect reports with status of CLOSED and FIXED and severity of Blocker, Critical, Major, Minor, and Trivial are selected, and the data of these defect reports are downloaded. The downloaded fields include defect summary, defect description, and defect report severity, which ultimately constitute the data set.
[0025] This embodiment uses the Eclipse project in the Bugzilla defect tracking system as the experimental object, and downloads a data set including defect summary, defect description and defect report severity. For the severity of the defect report in the data set, we only consider 5 severity levels, remove the default option Normal and Enhancement, which does not belong to a real defect, because in the field of defect report severity prediction, the two severity levels of Normal and Enhancement are considered to be noise data and cannot contribute to the construction of a defect report severity prediction model. For the remaining 5 severity levels, we merge Blocker, Critical, and Major into the "serious" category, and Minor and Trivial into the "not serious" category, and use the "serious" and "not serious" categories to train the defect report severity prediction model. The number of defect reports at different severity levels is shown in Table 1.
[0026] Table 1 Number of defect reports at different severity levels
[0027]
[0028] (2) The text in the defect summary field in the dataset is segmented, stop words are removed, and word form is restored in sequence to obtain the corresponding segmentation set T s .
[0029] The problem of predicting the severity of defect reports can be modeled as a text classification problem. This problem first requires segmenting the text content, removing stop words, and restoring the word form to obtain the corresponding word set T s .
[0030] in,
[0031] Word segmentation: It is to divide a defect report into a series of words, and remove punctuation marks and other non-word content, which is a preliminary processing of the original text data.
[0032] Stop words: These are words that appear frequently but have no real meaning, such as 'the', 'is', 'at', 'which', 'on', etc. We will remove them. Removing stop words can improve model performance and reduce the size of the text.
[0033] Lemma restoration: restores various forms of words to their root forms. In real text data, words have different tenses and voices, but the meanings of words in different states are similar. For example, the words "make", "makes", and "making" have different states, which will increase the redundancy of text information and lead to a decrease in model performance. Therefore, it is necessary to restore the lemma of words.
[0034] Table 2 shows the word set T obtained by the defect summary after the above steps. s .
[0035] Table 2 Defect summary is processed by word segmentation, stop word removal and lemmatization
[0036]
[0037] (3) Using the word set T s The word embedding method FastText is used to train and obtain the summary word vector model F according to the severity of the defect reports in the dataset. s , use this model to vectorize the defect summary, specifically: based on the summary word vector model F s Get the vector of each word in the defect summary, and sum the vectors of each word in the defect summary to get the defect summary vector E s .
[0038] Among them, the word embedding method FastText is a word vector representation algorithm that incorporates a string-based method to understand the morphological features of words. FastText uses a hierarchical classifier and hierarchical Softmax, and uses the Huffman tree algorithm to establish a tree structure for characterizing categories. On the one hand, it can reduce the number of model prediction targets, and on the other hand, it can reduce the complexity of calculations. In the embodiment, the parameter settings in the word embedding method FastText adopt the parameter settings of the original paper, specifically the window size n-gram=3, and the word vector dimension hidden=10.
[0039] Based on the word set T obtained in step (2) s The severity of the defect reports in the dataset is trained and the summary word vector model F is constructed. s , when the summary word vector model F is obtained s Then, a word segment in a defect summary is input into the model and its vector representation is obtained. The vector of each word segment in the defect summary is summed to obtain the defect summary vector E. s .
[0040] (4) Extract and represent keywords from the defect description field in the data set to obtain the defect description vector E d .
[0041] The defect description field contains more data than the defect summary. However, the effect of using the defect description to build a defect report severity prediction model is slightly inferior to that of using the defect summary. This shows that the defect description data contains noise, which will interfere with the final performance of the model. Therefore, the keyword extraction method Textrank is used to extract keywords from the defect description for data supplementation. The main steps are:
[0042] 1) The defect description field in the dataset is replaced by a regularization method, including matching the content containing the URL and replacing it with the "url" string, matching the console output content and replacing it with the "console" string, matching the code snippet and replacing it with the "code" string. Then, it is segmented, stop words are removed, and lemmatization is performed to obtain the corresponding segmentation set.
[0043] 2) Based on the word set, the keyword extraction method Textrank is used to extract the keyword set T of the defect description d Among them, the keyword extraction method Textrank is an algorithm that represents the given text relationship based on a graph. The algorithm first builds a word segmentation dictionary and builds a graph model based on the word segmentation. Based on the graph model, the PageRank algorithm is used to calculate the score of the word segmentation, where the top-k word segmentations are considered as keywords. It can better understand the relationship between word segmentations.
[0044] 3) Based on the keyword set T d The severity corresponding to the data set is trained using the word embedding method FastText to obtain the description word vector model F d , use this model to represent the defect description vector, specifically: based on the description word vector model F d Get the vector of each keyword in the defect description, and sum the vectors of each keyword in the defect description to obtain the defect description vector E d .
[0045] The above word segmentation, stop word removal, and word form restoration are the same as step (2). The word vector model F d , defect description vector E d The acquisition method is similar to step (2). Table 3 shows the keyword set T obtained by processing the defect description accordingly. d process.
[0046] Table 3 Defect description and handling process
[0047]
[0048]
[0049] (5) Merge the defect summary vector E s With the defect description vector E d As the input vector E input .
[0050] According to the defect summary vector E obtained in step (3) s The defect description vector E obtained in step (4) d, the word vectors are concatenated. Since the word vector dimension hidden = 10 in this embodiment, the dimension length of the word vector after concatenation becomes 20.
[0051] (6) Based on the input vector E input Based on the severity of defect reports in the dataset, a logistic regression classification method is used to train and obtain a defect report severity prediction model.
[0052] Among them, the logistic regression classification method is a classical classification algorithm in statistics and can be used in binary or multi-classification problems.
[0053] In a classification problem,
[0054]
[0055]
[0056] In the above formula, x represents the input word vector, and y represents the classification result, where y contains k categories. k With b k are two parameters in the logistic regression method. In this experiment, k=2, specifically two categories: "serious" and "not serious".
[0057] Using the logistic regression method, based on the input vector E obtained in step (5) input The defect report severity prediction model is trained and constructed based on the defect report severity in the dataset.
[0058] (7) Input a new defect report, process its defect summary in step (2), process its defect description in step (4), merge the two vectors based on step (5) and input them into the defect report severity prediction model obtained in step (6) to obtain the final prediction result.
[0059] When a new defect report is input, the present invention first uses step (2) to segment the defect summary, remove stop words, and restore the word form to obtain the corresponding word set T s , using the summary word vector model F from step (3) s Vector representation of the defect summary. Use step (4) to replace the string of the defect description, then perform word segmentation, remove stop words, and restore the word form to obtain the corresponding word segmentation set. Then, use the keyword extraction method Textrank to extract the keyword set T of the defect description. d , using the description word vector model F from step (4) d The defect description is represented by a vector. The vector obtained by merging in step (5) is input into the defect report severity prediction model obtained in step (6) to obtain the final prediction result.
[0060] In the embodiment, the data set of the Eclipse project is used for the experiment. First, the data set is divided into a training set and a test set in a time series order of 8:2. The performance of the defect report severity prediction model is evaluated using three commonly used evaluation indicators: F-Measure, Precision and Recall. The calculation formula is as follows:
[0061]
[0062]
[0063]
[0064] Table 4 Confusion matrix
[0065] Predicted Positive Negative Actual Positive TP FN Negative FP TN
[0066] The confusion matrix is shown in Table 4. TP+FP+TN+FN=total number of samples, F-Measure is the harmonic mean of recall and precision, and the higher the F-Measure value, the more effective the method.
[0067] Based on the Eclipse dataset, the experimental results are shown in Table 5 under the two benchmarks of the Naive Bayes method and the k-nearest neighbor method.
[0068] Table 5 Experimental results
[0069] F-Measure Precision Recall Naive Bayes method 0.660 0.652 0.681 k-nearest neighbor method 0.656 0.674 0.646 The present invention 0.704 0.738 0.687
[0070] The experimental results show that the present invention has better model effects on the three evaluation indicators. In addition, the present invention extracts keywords from the defect description as a supplement to the defect summary, which adds less data than the defect description and has better model performance.
[0071] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A defect report severity prediction method based on description keyword extraction, characterized in that: The prediction method comprises the following steps: S1. Select defect reports with status of CLOSED and FIXED and severity of Blocker, Critical, Major, Minor and Trivial from the defect tracking system where the project is located, and download the data of the above defect reports. The downloaded fields include defect summary, defect description and defect report severity, and a data set is constructed based on this. S2. Perform word segmentation, stop word removal, and lemmatization on the text in the defect summary field in the dataset to obtain the corresponding word segmentation set T s ; S3, using the word set T in step S2 s The word embedding method FastText is used to train and obtain the summary word vector model F according to the severity of the defect reports in the dataset. s , use this model to vectorize the defect summary, specifically: based on the summary word vector model F s Get the vector of each word in the defect summary, and sum the vectors of each word in the defect summary to get the defect summary vector E s ; S4. Extract and represent keywords for the defect description field in the data set to obtain the defect description vector E. d ; S5. Merge the defect summary vector E s With the defect description vector E d As the input vector E input ; S6. Based on the input vector E input and the severity of defect reports in the dataset, using the logistic regression classification method to train and obtain a defect report severity prediction model; S7. Input a new defect report, process its defect summary in step S2, process its defect description in step S4, merge the two vectors based on step S5 and input the defect report severity prediction model obtained in step S6 to obtain the final prediction result.
2. The defect report severity prediction method based on description keyword extraction according to claim 1 is characterized in that: In step S4, keywords are extracted and represented for the defect description field in the experimental data set to obtain the defect description vector E d , specifically including the following steps: S401, using a regularization method to perform string replacement on the defect description field in the data set, including: matching content containing URLs and replacing them with the "url" string, matching console output content and replacing them with the "console" string, matching code snippets and replacing them with the "code" string, and then performing word segmentation, stop word removal, and lemmatization processing on them to obtain a corresponding word segmentation set; S402: Based on the word segmentation set, a keyword extraction method Textrank is used to extract a keyword set T of the defect description. d ; S403, based on the keyword set T d The severity corresponding to the data set is trained using the word embedding method FastText to obtain the description word vector model F d , use this model to represent the defect description vector, specifically: based on the description word vector model F d Get the vector of each keyword in the defect description, and sum the vectors of each keyword in the defect description to obtain the defect description vector E d .
