Early defect prediction method, device and equipment and computer readable storage medium

By extracting and predicting early test data in the early stage of software development, and using machine learning technology, the problem that traditional defect detection needs to be performed after coding is completed is solved, efficient defect prediction and processing is achieved, and software development efficiency is improved and quality.

CN119166513APending Publication Date: 2024-12-20SHENZHEN MENGWANG YUNCHUANG TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411229424.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-03
Publication Date
2024-12-20

AI Technical Summary

Technical Problem

Traditional software defect detection is usually performed after coding is completed, resulting in inefficient defect processing, time-consuming and costly, and it is difficult to meet the increasing demands of software scale and complexity.

Method used

In the early stages of the software development cycle, feature extraction of early test data of prediction software, target feature data is generated, and input it into the defect prediction model, and defect prediction is used to predict defects and discover potential defects in advance.

Benefits of technology

Through early defect prediction, the defect processing time cost is reduced, the defect processing efficiency is improved, resource allocation is optimized, and the overall quality and development efficiency of the software are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119166513A_ABST
    Figure CN119166513A_ABST
Patent Text Reader

Abstract

The invention discloses an early-stage defect prediction method which comprises the following steps: in an early stage of a software development stage, performing feature extraction on early-stage test data of software to be predicted to generate target feature data; inputting the target feature data into a defect prediction model as input information; and determining a defect prediction result according to output information calculated by the defect prediction model based on the input information. The invention further discloses an early defect prediction device and equipment and a computer readable storage medium. In the early stage of the development cycle of the to-be-predicted software, the defect prediction is carried out on the to-be-predicted software according to the early test data of the to-be-predicted software, so that developers can know potential defects according to the defect prediction result obtained through prediction, the defects are avoided, and the development efficiency of the to-be-predicted software is improved. Therefore, after software development is completed, it is unnecessary to spend a lot of time to repair the defects, and the problem that in a traditional defect processing mode, defect detection and repair can only be conducted after software coding is completed, and consequently the defect processing efficiency is low is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of software engineering, and in particular to an early defect prediction method, device and computer-readable storage medium. Background Art

[0002] With the development of computer technology, software applications have an increasingly greater impact in various fields, such as military equipment, aerospace, and people's daily business and activities. At the same time, the diversification and complexity of software functions have led to an increasing scale and structural complexity of software, resulting in an increasing number and types of potential defects. Faulty software will cause failures during operation, which will increase development and maintenance costs and reduce customer satisfaction. In severe cases, it will bring unpredictable results and significant losses. Traditional software defect detection is usually carried out through testing after coding is completed. First, defects are discovered through various testing methods such as unit testing, integration testing, and system testing. Then, developers locate the specific causes of the defects and repair them. After the repair is completed, regression testing is required to ensure that the repair does not introduce new problems. This consumes a lot of time and costs, resulting in inefficient defect handling.

[0003] The above contents are only used to assist in understanding the technical solution of the present invention and do not constitute an admission that the above contents are prior art. Summary of the invention

[0004] The main purpose of the present invention is to provide an early defect prediction method, device, equipment and computer-readable storage medium, aiming to solve the problem that traditional defect handling methods require defect detection and repair after software coding is completed, resulting in low defect handling efficiency.

[0005] To achieve the above object, the present invention provides an early defect prediction method, which comprises the following steps:

[0006] In the early stage of the software development cycle, feature extraction is performed on the early test data of the software to be predicted to generate target feature data;

[0007] Inputting the target feature data as input information into a defect prediction model;

[0008] The defect prediction result is determined according to the output information calculated by the defect prediction model based on the input information.

[0009] Optionally, the early test data includes at least one of a requirement document, a design document, and preliminary coding information.

[0010] Optionally, in the early stage of the software development cycle, the step of extracting features from early test data of the software to be predicted and generating target feature data includes:

[0011] Preliminarily screening the early test data to obtain initial feature data;

[0012] Determining a characteristic index of the initial characteristic data;

[0013] The initial feature data is feature screened according to the feature index to determine target feature data.

[0014] Optionally, the method of determining the feature index of the initial feature data includes at least one of the following:

[0015] Determine a target Pearson correlation coefficient of the initial feature data, and use the target Pearson correlation coefficient as the feature index;

[0016] Determine a target importance score of the initial feature data using a machine learning algorithm, and use the target importance score as the feature indicator;

[0017] A feature selection algorithm is used to determine a target effectiveness score of the initial feature data, and the target effectiveness score is used as the feature indicator.

[0018] Optionally, the step of performing feature screening on the initial feature data according to the feature index to determine target feature data includes:

[0019] Determine a correlation score between the initial feature data and the defect according to the feature index;

[0020] The initial feature data corresponding to a correlation score greater than or equal to a preset correlation score is used as the target feature data.

[0021] Optionally, the method further comprises:

[0022] Collecting historical early test data of historical projects and historical defect sets corresponding to the historical projects;

[0023] Acquiring historical feature data based on the historical early test data;

[0024] The model is trained according to the historical feature data and the historical defect set to generate the defect prediction model.

[0025] In addition, to achieve the above-mentioned purpose, the present invention also provides an early defect prediction device, which includes a feature extraction module, a defect prediction module and a defect generation module:

[0026] A feature extraction module, wherein the feature extraction module is used to extract features from early test data of the software to be predicted and generate target feature data;

[0027] A defect prediction module, wherein the defect prediction module includes a defect prediction model, and the defect prediction model is used to calculate output information according to input information;

[0028] The defect generation module is used to determine a defect prediction result according to the output information.

[0029] Optionally, the feature extraction module further includes:

[0030] A preliminary screening module, the preliminary screening module is used to perform preliminary screening on the early test data to obtain initial feature data;

[0031] A feature engineering module, wherein the feature engineering module is used to determine feature indicators of the initial feature data;

[0032] A feature screening module is used to perform feature screening on the initial feature data according to the feature index to determine target feature data.

[0033] In addition, to achieve the above-mentioned purpose, the present invention also provides an early defect prediction device, which includes the early defect prediction device as described above; the early defect prediction device also includes: a memory, a processor, and an early defect prediction program stored in the memory and executable on the processor, and when the early defect prediction program is executed by the processor, the steps of the early defect prediction method as described above are implemented.

[0034] In addition, to achieve the above objectives, the present invention also provides a computer-readable storage medium, on which an early defect prediction program is stored, and when the early defect prediction program is executed by a processor, the steps of the early defect prediction method as described above are implemented.

[0035] An early defect prediction method proposed in an embodiment of the present invention extracts features from early test data of the software to be predicted in the early stage of the software development cycle to generate target feature data, and then inputs the target feature data as input information into a defect prediction model, and finally determines the defect prediction result according to the output information calculated by the defect prediction model based on the input information. The embodiment of the present invention utilizes data and features in the early stage of software development, combined with advanced machine learning and deep learning technologies, to achieve effective prediction of software defects in the early stage of software development, thereby reducing the time cost of defect processing and improving defect processing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 It is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present invention;

[0037] Figure 2It is a flow chart of the first embodiment of the early defect prediction method of the present invention;

[0038] Figure 3 It is a flow chart of a second embodiment of the early defect prediction method of the present invention;

[0039] Figure 4 Detailed flowchart of step S13 in the second embodiment of the early defect prediction method of the present invention.

[0040] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0041] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0042] The main solution of the embodiment of the present invention is: in the early stage of the software development cycle, feature extraction is performed on the early test data of the software to be predicted to generate target feature data; the target feature data is input into the defect prediction model as input information; and the defect prediction result is determined according to the output information calculated by the defect prediction model based on the input information.

[0043] like Figure 1 As shown, Figure 1 It is a schematic diagram of the software test structure of the hardware operating environment involved in the embodiment of the present invention.

[0044] The terminal in the embodiment of the present invention may be a PC, or may be a terminal device such as a smart phone or a tablet computer.

[0045] like Figure 1 As shown, the terminal may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002. The communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WiFi interface). The memory 1005 may be a high-speed RAM memory, or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0046] Optionally, the terminal may also include a camera, an RF (Radio Frequency) circuit, a sensor, an audio circuit, a WiFi module, and the like. Among them, sensors include light sensors, motion sensors, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display screen according to the brightness of the ambient light, and the proximity sensor may turn off the display screen and / or backlight when the mobile terminal is moved to the ear. As a type of motion sensor, the gravity acceleration sensor can detect the magnitude of acceleration in each direction (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that identify the posture of the mobile terminal (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; of course, the mobile terminal may also be configured with other sensors such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., which will not be repeated here.

[0047] Those skilled in the art will understand that Figure 1 The terminal structure shown in the figure does not constitute a limitation on the terminal, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.

[0048] like Figure 1 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and an early defect prediction program.

[0049] exist Figure 1 In the terminal shown, the network interface 1004 is mainly used to connect to the backend server and perform data communication with the backend server; the user interface 1003 is mainly used to connect to the client (user end) and perform data communication with the client; and the processor 1001 can be used to call the early defect prediction program stored in the memory 1005 and perform the following operations:

[0050] In the early stage of the software development cycle, feature extraction is performed on the early test data of the software to be predicted to generate target feature data;

[0051] Inputting the target feature data as input information into a defect prediction model;

[0052] The defect prediction result is determined according to the output information calculated by the defect prediction model based on the input information.

[0053] Further, the processor 1001 may call the early defect prediction program stored in the memory 1005, and further perform the following operations:

[0054] Preliminarily screening the early test data to obtain initial feature data;

[0055] Determining a characteristic index of the initial characteristic data;

[0056] The initial feature data is feature screened according to the feature index to determine target feature data.

[0057] Further, the processor 1001 may call the early defect prediction program stored in the memory 1005, and further perform the following operations:

[0058] Determine a target Pearson correlation coefficient of the initial feature data, and use the target Pearson correlation coefficient as the feature index;

[0059] Determine a target importance score of the initial feature data using a machine learning algorithm, and use the target importance score as the feature indicator;

[0060] A feature selection algorithm is used to determine a target effectiveness score of the initial feature data, and the target effectiveness score is used as the feature indicator.

[0061] Further, the processor 1001 may call the early defect prediction program stored in the memory 1005, and further perform the following operations:

[0062] Determine a correlation score between the initial feature data and the defect according to the feature index;

[0063] The initial feature data corresponding to a correlation score greater than or equal to a preset correlation score is used as the target feature data.

[0064] Further, the processor 1001 may call the early defect prediction program stored in the memory 1005, and further perform the following operations:

[0065] Collecting historical early test data of historical projects and historical defect sets corresponding to the historical projects;

[0066] Acquiring historical feature data based on the historical early test data;

[0067] The model is trained according to the historical feature data and the historical defect set to generate the defect prediction model.

[0068] First embodiment

[0069] Reference Figure 2 A first embodiment of the present invention provides an early defect prediction method, the early defect prediction method comprising:

[0070] Step S10, in the early stage of the software development cycle, feature extraction is performed on the early test data of the software to be predicted to generate target feature data;

[0071] Step S20, inputting the target feature data as input information into a defect prediction model;

[0072] Step S30, determining a defect prediction result according to output information calculated by the defect prediction model based on the input information.

[0073] In the prior art, in the software development process, defect detection usually occurs after the coding is completed, and is discovered and repaired through the testing phase. This process is often time-consuming and costly. With the expansion of software scale and the increase in complexity, traditional manual review and testing methods have been unable to meet the needs of efficient and accurate prediction and prevention of defects. Therefore, automated software defect prediction technology based on artificial intelligence has become a research hotspot, aiming to predict potential defects in the early stages of the software life cycle in advance, thereby optimizing resource allocation and improving development efficiency. Optionally, this embodiment proposes a method for predicting potential defects in the early stages of the software development cycle, so that corrections can be made in the early stages of development, and by avoiding the subsequent occurrence of defects, large-scale reconstruction in the later stage can be avoided to reduce the defect processing time and the cost required for subsequent defect processing. In addition, by predicting and avoiding potential defects, it also helps to improve the overall quality of the software.

[0074] Optionally, it is noted that the present application is not limited to the software to be tested, and the software to be tested may be various software, such as game software, instant messaging software, e-commerce software, office software, compression software, input method software, customer relationship management (CRM) software, etc.

[0075] Optionally, in the software development cycle, "early stage" refers to the stage from the beginning of requirement analysis to the completion of preliminary coding, and the early stage includes the requirement analysis stage, which is used to define the functional and non-functional requirements of the software; the design stage, which is used to design the software architecture and component interfaces; and the preliminary coding stage, which is used to write preliminary code implementations.

[0076] Optionally, when the software to be predicted is in the early stage of the software development cycle, early test data of the software to be predicted is obtained. The early test data is data generated in the early stage of the development of the software to be predicted. This data reflects the status of the early stage of software development and can be used to predict defects that may occur later. The early test data is obtained from the above-mentioned requirements analysis stage, design stage and preliminary coding stage.

[0077] Optionally, the early test data obtained from the demand analysis phase includes demand documents, which include business demand documents, functional demand documents, etc. The demand documents describe the functions that the software should implement. Optionally, when there are inconsistent and / or ambiguous requirements in the demand documents, the probability of subsequent defects in the software to be predicted is high. Therefore, this embodiment obtains the demand documents and deeply analyzes the demand documents through natural language processing technology (Natural Language Processing, NLP) to obtain the analysis results, which include functional descriptions, constraints, business rules, etc., and the analysis results are structured and stored for subsequent prediction of defects based on the analysis results. Optionally, the early test data obtained from the demand analysis phase also includes use case documents, which define the specific behavior and interaction mode of the software system.

[0078] Optionally, the early test data obtained from the design phase includes design documents, including: architecture design documents, which describe the overall architecture of the software system; component design documents, which describe in detail the internal structure and interface design of each component; interface design documents, which include UI (User Interface) / UX (User Experience) design documents, which describe the layout and interaction design of the user interface. Optionally, during the software development process, if logic errors and / or logic omissions occur in the design documents, the probability of defects in the software developed according to the design documents is high. Therefore, this embodiment analyzes the design documents and extracts the errors in the design documents, thereby realizing defect prediction of the software to be predicted.

[0079] Optionally, the early test data obtained from the preliminary coding stage includes preliminary coding information, which includes: code change records, code changes refer to any modifications made to the existing code base during the software development process, including the behavior of adding, deleting or modifying code; the code change records include code change records formed in the preliminary coding stage, and can also include newly generated code change records after the software is updated. For example, developers may add a new function, fix a known bug, or optimize a section of code to improve performance; it is understandable that software defects are often highly correlated with code changes, such as frequent code modifications may indicate design deficiencies or unclear requirements, which are potential sources of defects. During software development, starting from the early stages of software development, developers will constantly modify the code to achieve functional requirements, so this embodiment can improve the accuracy of defect prediction by collecting code change records. The code change record can reflect changes in development progress and code quality. The preliminary coding information also includes code complexity indicators. Prime code complexity indicators include Cyclic Complexity, LOC (number of lines of code), etc. The code complexity indicators can be used to evaluate the quality and maintainability of the code; the preliminary coding information also includes version control history. The early defect prediction device of this embodiment can record the information of each submission, including submission messages, file changes, etc., by utilizing version control systems such as Git.

[0080] Optionally, the early test data also includes a developer activity log, which is used to record developer activities, such as task assignments and discussion records in a project management system. The early test data also includes open source code libraries, API documents, etc. These resources can provide reference and support for software development.

[0081] Optionally, after acquiring the early test data, feature extraction is performed on the early test data to generate target feature data, wherein the target feature data is data that is highly correlated with software defects, such as code change records with a code modification frequency higher than a preset frequency, changes in the number of code lines, specific pattern errors, etc.

[0082] Optionally, after obtaining the target feature data, the target feature data is used as input information and input into the defect prediction model, so that the defect prediction model can calculate the defect prediction result corresponding to the software to be predicted according to the target feature data, and the defect prediction result includes defect type, defect root cause, defect impact and defect corresponding repair strategy, etc. Optionally, the defect prediction result can be displayed in a graphical form through a visual interface and a report generation tool to help developers quickly find problem areas or potential risks in the code. The report generated by the report generation tool supports multiple types, such as PDF, HTML, Wxce l, etc., and the appropriate report type can be selected according to user needs, so that the user can better understand the prediction results based on his own habits and take corresponding measures. Optionally, the report can also be displayed in a graphical form, and it can also have multiple types, such as data chart form, chart and dynamic trend analysis form, etc. The chart type in the report can be set according to user needs, so that the user can better understand the prediction results based on the chart type in the displayed report. Optionally, an expert knowledge base can be set up to store a large amount of information related to software defects, such as the type, root cause, impact and repair strategy of software defects. The data in the expert knowledge base can be pre-stored in the system development stage or historical data stored in the actual operation process. Due to the existence of the expert knowledge base, a more in-depth explanation of the defect prediction results can be obtained.

[0083] Optionally, the defect prediction model is generated by iterative training according to a machine learning algorithm (random forest, support vector machine) and / or a deep learning model (convolutional neural network, recurrent neural network). Optionally, the early defect prediction method further includes:

[0084] Collecting historical early test data of historical projects and historical defect sets corresponding to the historical projects;

[0085] Acquiring historical feature data based on the historical early test data;

[0086] The model is trained according to the historical feature data and the historical defect set to generate the defect prediction model.

[0087] Optionally, in order to improve the accuracy of prediction, this embodiment selects a corresponding model for iterative training according to the properties of historical feature data and / or prediction requirements, such as iterative training of historical feature data of text type using an RNN model (Recurrent Neural Network model).

[0088] Optionally, the properties of the historical feature data include the number of features. When the historical feature data is small, a linear model may be considered; when the historical feature data is large, a nonlinear model such as a random forest or a neural network may be considered.

[0089] Optionally, the properties of the historical feature data may further include feature types. If the historical feature data contains text or sequence data, a deep learning model is used for training, such as a convolutional neural network (CNN) or a recurrent neural network (RNN).

[0090] Optionally, the nature of the historical feature data may also include data volume. If the data volume is small, a simple model is tried for iterative training, such as logistic regression or decision tree; if the data volume is large, a complex model is considered, such as a deep neural network.

[0091] Optionally, the properties of the historical feature data may also include feature data complexity, which is used to characterize the complexity of the relationship between feature data. When the relationship between feature data is relatively simple, a simple model such as logistic regression or decision tree can be selected, while when the relationship between features is complex, a complex model such as a deep neural network can be selected.

[0092] Optionally, the prediction requirement can be characterized by a problem type, and the problem type includes a classification problem and a regression problem. Optionally, when the problem type is a classification problem, a corresponding model can be selected by a classification target. For example, if the classification target is to predict the presence or absence of a software defect, a classification model such as logistic regression, support vector machine (SVM), random forest or neural network can be selected. Optionally, when the problem type is a regression problem, a corresponding model can be selected by a regression target. For example, if the regression target is to predict the number of defects or other numerical indicators, a regression model such as linear regression, decision tree regression or neural network can be selected.

[0093] Optionally, the prediction demand can also be characterized by model training time, and a suitable model can be selected according to the time required for model training. For example, if there is a limit on the model training time, you can consider using a model with a faster training speed, such as a linear model; if a longer training time is acceptable, you can consider using a model with a slower training speed but better prediction performance, such as a deep learning model.

[0094] Optionally, the prediction requirement can also use interpretability as an indicator, and a suitable model can be selected according to the level of interpretability. For example, if the model needs to have good interpretability in order to understand the prediction logic, you can consider using models such as logistic regression and decision trees; if the interpretability requirement is not high, you can consider using black box models such as random forests and neural networks.

[0095] Optionally, this embodiment improves the accuracy of model prediction by selecting a suitable model for iterative training based on the properties of historical feature data and / or prediction requirements. Optionally, the properties of historical feature data and / or prediction requirements can be compared with the model and the indicators can be quantified to obtain the scores corresponding to each model. The model with the highest score is determined as the model to be selected. For example, when the feature type of the historical feature data is text data and the prediction requirement is a short model training time, the score corresponding to the text data of the deep learning model is 100 points, and the score corresponding to the prediction requirement is 60. The score corresponding to the deep learning model at this time is 180, and the score corresponding to the text data of the machine learning model is 60, and the score corresponding to the prediction requirement is 80. The score corresponding to the machine learning model at this time is 140, and the deep learning model is selected as the model required for this iterative training.

[0096] Optionally, after collecting historical early test data of historical projects and historical defect sets corresponding to the historical projects, the selected model is used to iteratively train the historical early test data and the historical defect sets to establish a mapping relationship between early test data and defects, thereby achieving defect prediction for the software to be predicted. Optionally, the historical early test data includes historical requirement documents, historical design documents, historical preliminary coding information, etc., and the historical defect set includes defects that occurred in the historical projects.

[0097] Optionally, after obtaining historical early test data and historical defects, data preprocessing is performed, and the data preprocessing includes data cleaning, missing value processing, standardization, etc., and then feature extraction is performed on the historical early data to obtain historical feature data. Optionally, based on domain knowledge and statistical analysis, effective features can be constructed or selected to obtain initial historical feature data, and then feature screening is performed. Features highly correlated with software defects are screened out by using statistical methods such as correlation analysis, chi-square test, ANOVA, etc., and features highly correlated with software defects are used as historical feature data. Then, a suitable model is selected according to the nature of the historical feature data and / or prediction requirements; then, the data set is divided into a training set and a validation set (usually in a ratio of 70%-30% or 80%-20%), and the selected model is trained using the training set. During the training process, the selected model is hyperparameter tuned. Optionally, the hyperparameters of the model are adjusted using methods such as grid search and random search to find the optimal configuration. In order to improve the accuracy of model prediction, this embodiment also performs model training on the model training results, and optionally uses k-fold cross validation to evaluate the generalization ability of the model to ensure that the model performs well on unseen data to determine the model training results of the selected model; it is also possible to select appropriate performance indicators such as accuracy, precision, recall, F1 score, etc. according to the prediction requirements, and determine the model training results according to the performance indicators. Optionally, after obtaining the model training results, the best model is selected based on the performance of the model in cross validation. Optionally, after determining the best model, the feature data is iterated, the historical feature data is adjusted according to the model performance, and the historical feature data is continuously optimized; optionally, the model can also be iterated according to the actual prediction effect, the model parameters or structure are continuously adjusted, and new data is introduced for model retraining to improve the prediction accuracy.

[0098] For example, an automated software defect prediction system based on artificial intelligence is developed. The first step is to collect data from the requirements document, design document, and preliminary coding stage. The second step is to extract features from the collected data. First, perform a preliminary screening of the feature data to generate initial historical feature data. On the one hand, feature extraction can be performed based on domain knowledge. 1. Requirement consistency: Analyze the requirement document through natural language processing technology to identify consistency and ambiguity in the requirement description. 2. Design integrity: Check logical loopholes and incompleteness in the design document. 3. Code complexity: Calculate indicators such as Cyc lomat ic Comp l exi ty of the code. On the other hand, feature extraction can be performed based on statistical analysis. 1. Code modification frequency: Count the frequency of modification of each code segment in the code change record. 2. Change in the number of code lines: Calculate the change in the number of code lines before and after the code change. 3. Specific error patterns: Identify common programming error patterns. Then, the initial historical feature data is subjected to feature screening. Optionally, features highly correlated with software defects can be screened out by using statistical methods such as correlation analysis, chi-square test, ANOVA, etc.; the feature importance score provided by the machine learning algorithm can also be used to further screen features. The third step is to determine the model based on the nature of the historical feature data and / or the prediction requirements, train the model using the training set, and adjust the hyperparameters during the training process, such as the regularization parameter in logistic regression, the number of trees in the random forest, etc. The fourth step is to evaluate the model training results, and the best performing model can be determined by cross-validation and / or calculation of performance indicators. Finally, according to the actual prediction effect, the model parameters or structure are continuously adjusted, and the model is retrained by introducing new data to improve the prediction accuracy, thereby obtaining a defect prediction model with high prediction accuracy.

[0099] Alternatively, by comprehensively considering factors such as problem type, data characteristics, model complexity, and combining cross-validation and other techniques to evaluate model performance, the most suitable machine learning or deep learning model for a specific task can be effectively selected and trained. This approach helps improve the efficiency of quality control in the software development process, reduce the cost of later repairs, and improve the overall stability of software products.

[0100] Optionally, after the defect prediction model is generated, the defect prediction model can be used to perform defect prediction on the software to be predicted.

[0101] In this embodiment, a defect prediction model is generated through training. In actual application, early test data of the software to be predicted is obtained in the early stage of the software development cycle, and target feature data that is highly correlated with defects is extracted based on the early test data. The target feature data is then input into the defect prediction model as input information, so that the defect prediction model can calculate output information based on the input information. The output information is the defect prediction result of the software to be predicted, that is, the defects that may occur in the software to be predicted. This embodiment predicts defects in advance at an early stage, so that developers can intervene early according to the defect prediction results to avoid defects that may occur, thereby improving defect handling efficiency. It also reduces time and resource costs and improves resource utilization efficiency by avoiding defects in advance. By avoiding defects in advance, more serious defects in the software to be predicted can be avoided in the future, thereby improving the stability of software development.

[0102] Second embodiment

[0103] Based on the first embodiment, refer to Figure 3 , the S10 comprises:

[0104] Step S11, preliminarily screening the early test data to obtain initial feature data;

[0105] Step S12, determining the characteristic index of the initial characteristic data;

[0106] Step S13, performing feature screening on the initial feature data according to the feature index to determine target feature data.

[0107] Optionally, in this embodiment, after the early test data is acquired, feature extraction is performed on the early test data to acquire target feature data having a high correlation with the defect of the software to be predicted.

[0108] Optionally, the early test data is preliminarily screened to screen initial feature data associated with defects.

[0109] Optionally, the preliminary screening can be performed by establishing an expert database, which includes domain knowledge, and the domain knowledge is used to indicate which features are associated with software defects. The expert database also includes academic papers and technical documents in related fields. By searching the academic papers and technical documents, the initial feature data associated with the software to be predicted is determined.

[0110] Optionally, the preliminary screening method can also be to retrieve using a statistical analysis method, and optionally, to calculate the statistical correlation between the feature and the software defect (such as the Pearson correlation coefficient, the Spearman rank correlation coefficient, etc.) using a correlation analysis method. Highly correlated features usually show a higher correlation coefficient, and the initial feature data is screened out according to the calculated correlation coefficient; optionally, the corresponding initial feature data can also be screened out using a chi-square test method, and for the categorical variables in the early test data, a chi-square test is used to detect whether there is independence between the feature and the category (such as whether there is a defect) in the early test data, and the independence is characterized by a p-value. When the p-value is low, the feature is determined to be associated with the type, and the feature is determined as the initial feature data. Optionally, the initial feature data can also be determined by variance analysis, and continuous variables and categorical variables are determined from the early test data, and variance analysis is used to test whether there is a significant difference in the mean of the variables under different categories. If so, the continuous variable is determined as the initial feature data.

[0111] Optionally, the method of obtaining the initial feature data includes but is not limited to the above method.

[0112] Optionally, after obtaining the initial feature data, in order to reduce the redundancy of the initial feature data and thus improve the efficiency of defect prediction, the present embodiment also performs feature screening on the initial feature data, and takes the initial feature data with a correlation higher than or equal to a preset correlation as target feature data. The correlation is used to characterize the correlation between the initial feature data and the software defect. The higher the correlation, the higher the correlation, and the lower the correlation, the lower the correlation.

[0113] Optionally, the method for feature screening the initial feature data is to determine feature indicators of the initial feature data, and determine the corresponding correlation based on the feature indicators. The feature indicators are used to characterize the contribution of the initial feature data to defect prediction. The higher the contribution, the higher the correlation.

[0114] Optionally, the method of determining the feature index of the initial feature data includes at least one of the following:

[0115] Determine a target importance score of the initial feature data using a machine learning algorithm, and use the target importance score as the feature indicator;

[0116] Determine a target effectiveness score of the initial feature data using a feature selection algorithm, and use the target effectiveness score as the feature indicator;

[0117] A deep learning algorithm is used to determine the target contribution of the initial feature data, and the target contribution is used as the feature index.

[0118] Optionally, the feature index includes a target importance score, which is used to characterize the contribution of the initial feature data to the model prediction ability. The higher the target importance score, the higher the contribution. The target importance score can be calculated by a machine learning algorithm, for example, a random forest algorithm, a gradient boosting tree, etc.

[0119] Optionally, the feature index includes a target effectiveness score, which is used to characterize the effectiveness of the initial feature data set for prediction. The higher the target effectiveness score, the higher the effectiveness, and the higher the value of the initial feature data. The target effectiveness score can be calculated by a feature selection algorithm, for example, such as a recursive feature elimination algorithm (RFE algorithm), a penalty-based feature selection algorithm (LASSO), etc.

[0120] Optionally, the feature index includes a target contribution, and the higher the contribution, the higher the correlation between the initial feature data and the defect. The target contribution can be calculated through an attention mechanism.

[0121] Optionally, the feature index includes a target decision influence. The higher the target decision influence, the higher the correlation between the initial feature data and the defect. The target decision influence can be calculated by visualization technology. Exemplarily, the visualization technology can be a heat map or an activation map. Optionally, the target decision influence can be used for initial feature data of image type and / or sequence data type.

[0122] Optionally, the feature index may also include a contribution of a feature combination. Optionally, the performance of the model under different feature combinations may be evaluated by cross-validation and other techniques to determine which feature combinations can bring the best prediction performance.

[0123] Optionally, the characteristic indicators include but are not limited to the above indicators.

[0124] Optionally, after determining the characteristic index corresponding to the initial characteristic index, the initial characteristic data is subjected to characteristic screening according to the characteristic index. Optionally, referring to Figure 4 , the S13 comprises:

[0125] Step S131, determining a correlation score between the initial feature data and the defect according to the feature index;

[0126] Step S132: taking the initial feature data corresponding to a correlation score greater than or equal to a preset correlation score as the target feature data.

[0127] Optionally, the correlation score is used to characterize the correlation between the initial feature data and the defect. The higher the correlation score, the higher the correlation between the initial feature data and the software defect of the software to be predicted, and the higher the accuracy of the defect prediction when the initial feature data is used for defect prediction.

[0128] Optionally, the correlation score may be calculated by quantifying the feature indicators of the initial feature data to obtain the scores corresponding to each feature indicator, and obtaining the weights corresponding to each different type of feature indicator, and adding the weights according to the scores corresponding to each feature indicator and the corresponding weights, thereby obtaining the correlation scores corresponding to each feature indicator.

[0129] Optionally, the method of quantizing the characteristic indicators can be determined according to a preset indicator quantization method, which can be the final quantization indicator method selected when the optimal defect prediction model is generated by adjusting the quantization indicator method corresponding to each characteristic indicator when iteratively training the model; optionally, the weights corresponding to different types of characteristic indicators can be preset weights, which are the final weights selected when the optimal defect prediction model is generated by adjusting the weights corresponding to each characteristic indicator when iteratively training the model.

[0130] Optionally, after determining the correlation scores corresponding to each initial feature data, the initial feature data corresponding to a correlation score greater than or equal to a preset correlation score is used as the target feature data. The preset correlation score can be determined based on the corresponding average value of the correlation scores corresponding to all the initial feature data during the defect prediction. It can also be set by the developer. It can also be the final preset correlation score selected when generating the best defect prediction model by adjusting the preset correlation score during iterative training of the model. There is no limitation here.

[0131] Optionally, this embodiment can effectively identify features that are highly correlated with the defects of the software to be predicted by comprehensively applying domain knowledge, statistical analysis and machine learning techniques, thereby improving the accuracy and efficiency of defect prediction.

[0132] In addition, the present invention also provides an early defect prediction device, which includes a feature extraction module, a defect prediction module and a defect generation module:

[0133] A feature extraction module, wherein the feature extraction module is used to extract features from early test data of the software to be predicted and generate target feature data;

[0134] A defect prediction module, wherein the defect prediction module includes a defect prediction model, and the defect prediction model is used to calculate output information according to input information;

[0135] The defect generation module is used to determine a defect prediction result according to the output information.

[0136] Optionally, the feature extraction module further includes:

[0137] A preliminary screening module, the preliminary screening module is used to perform preliminary screening on the early test data to obtain initial feature data;

[0138] A feature engineering module, wherein the feature engineering module is used to determine feature indicators of the initial feature data;

[0139] A feature screening module is used to perform feature screening on the initial feature data according to the feature index to determine target feature data.

[0140] Optionally, the feature screening module further includes a correlation score calculation module, and the correlation score calculation module is used to determine the correlation score between the initial feature data and the defect according to the feature index.

[0141] In addition, an embodiment of the present invention further provides a computer-readable storage medium, on which an early defect prediction program is stored. When the early defect prediction program is executed by a processor, the steps of the various embodiments described above are implemented.

[0142] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.

[0143] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0144] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present invention.

[0145] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. An early defect prediction method, characterized in that: The early defect prediction method comprises the following steps: In the early stage of the software development cycle, feature extraction is performed on the early test data of the software to be predicted to generate target feature data; Inputting the target feature data as input information into a defect prediction model; The defect prediction result is determined according to the output information calculated by the defect prediction model based on the input information.

2. The early defect prediction method according to claim 1, characterized in that: The early test data includes at least one of a requirement document, a design document, and preliminary coding information.

3. The early defect prediction method according to claim 1, characterized in that: In the early stage of the software development cycle, feature extraction is performed on the early test data of the software to be predicted. The steps to generate target feature data include: Preliminarily screening the early test data to obtain initial feature data; Determining a characteristic index of the initial characteristic data; The initial feature data is feature screened according to the feature index to determine target feature data.

4. The early defect prediction method according to claim 3, characterized in that: The method of determining the characteristic index of the initial characteristic data includes at least one of the following: Determine a target importance score of the initial feature data using a machine learning algorithm, and use the target importance score as the feature indicator; Determine a target effectiveness score of the initial feature data using a feature selection algorithm, and use the target effectiveness score as the feature indicator; A deep learning algorithm is used to determine the target contribution of the initial feature data, and the target contribution is used as the feature index.

5. The early defect prediction method according to claim 3, characterized in that: The step of performing feature screening on the initial feature data according to the feature index to determine target feature data comprises: Determine a correlation score between the initial feature data and the defect according to the feature index; The initial feature data corresponding to a correlation score greater than or equal to a preset correlation score is used as the target feature data.

6. The early defect prediction method according to claim 1, characterized in that: The method further comprises: Collecting historical early test data of historical projects and historical defect sets corresponding to the historical projects; Acquiring historical feature data based on the historical early test data; The model is trained according to the historical feature data and the historical defect set to generate the defect prediction model.

7. An early defect prediction device, characterized in that: The early defect prediction device includes a feature extraction module, a defect prediction module and a defect generation module: A feature extraction module, wherein the feature extraction module is used to extract features from early test data of the software to be predicted and generate target feature data; A defect prediction module, wherein the defect prediction module includes a defect prediction model, and the defect prediction model is used to calculate output information according to input information; The defect generation module is used to determine a defect prediction result according to the output information.

8. The early defect prediction device according to claim 7, characterized in that: The feature extraction module also includes: A preliminary screening module, the preliminary screening module is used to perform preliminary screening on the early test data to obtain initial feature data; A feature engineering module, wherein the feature engineering module is used to determine feature indicators of the initial feature data; A feature screening module is used to perform feature screening on the initial feature data according to the feature index to determine target feature data.

9. An early defect prediction device, characterized in that: The early defect prediction device comprises the early defect prediction device according to any one of claims 7 to 8; The early defect prediction also includes: a memory, a processor, and an early defect prediction program stored in the memory and executable on the processor. When the software test program is executed by the processor, the steps of the early defect prediction method according to any one of claims 1 to 6 are implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores an early defect prediction program, and when the early defect prediction program is executed by a processor, the steps of the early defect prediction method according to any one of claims 1 to 6 are implemented.