Software defect prediction model training method, software defect prediction method, equipment, medium and program

By integrating metric features and semantic features in the software defect prediction model and using logistic regression classifier to train the model, the problem of low prediction accuracy in cross-project defect prediction is solved, and the accuracy of software defect prediction is improved.

CN120492307APending Publication Date: 2025-08-15AGRICULTURAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510610085.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-13
Publication Date
2025-08-15

AI Technical Summary

Technical Problem

Existing software defect prediction models have low prediction accuracy in cross-project defect prediction, mainly due to the differences in data distribution between different software projects and the traditional model ignores code structure and semantic information.

Method used

By obtaining the associated project code vector sample data of the target sample software project, metric features and semantic features are extracted, and inputting them into the logistic regression classifier for training, a software defect prediction model is constructed.

Benefits of technology

The prediction accuracy of the software defect prediction model is improved and the accuracy of software defect prediction is enhanced, especially in the absence of historical data in emerging software projects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120492307A_ABST
    Figure CN120492307A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a software defect prediction model training method and device, a software defect prediction method and device, a medium and a program. The software defect prediction model training method comprises the steps of obtaining associated item code vector sample data of a target sample software item; extracting measurement features of the target sample software project according to the associated project code vector sample data; extracting semantic features of the target sample software project according to the associated project code vector sample data; and inputting the metric features and the semantic features of the target sample software project into a logistic regression classifier to train an overall model to obtain a software defect prediction model. According to the technical scheme provided by the embodiment of the invention, the prediction precision of the software defect prediction model on the software defect can be improved, and the accuracy of software defect prediction is further improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the fields of computer software applications and artificial intelligence technology, and in particular to a software defect prediction model training and software defect prediction method, device, electronic device, storage medium and program. Background Art

[0002] Software defect prediction (SDP) is an effective means of ensuring software quality and has attracted widespread attention in recent years. Software defect prediction involves identifying code with a high defect risk during the initial stages of software development. Specifically, before software project testing, software defect prediction tools are used to predict defect-prone modules in the software project, thereby reducing the resources required for testing the software project.

[0003] In actual software development and testing, developers and testers often need to predict defects for new software projects. However, these projects often lack sufficient defect annotation data, making it difficult to train efficient defect prediction models using this limited data. To address situations where software projects are newly proposed or historical defect data is limited, cross-project defect prediction (CPDP) has been introduced. Cross-project defect prediction is a viable solution for building accurate prediction models in the absence of sufficient historical defect data. It leverages defect data from different projects to predict defects in the current project, addressing the lack of historical data for emerging software projects.

[0004] In the process of implementing the present invention, the inventors discovered that the existing technology has the following defects: due to the differences in software functions, programming languages and developers among different software projects, there are often differences in data distribution between the constructed data sets, and traditional defect prediction models often ignore the structure, semantics and contextual information of the code, resulting in the actual prediction performance of the CPDP model being unsatisfactory. Summary of the Invention

[0005] Embodiments of the present invention provide a software defect prediction model training and software defect prediction method, device, electronic device, storage medium and program, which can improve the prediction accuracy of the software defect prediction model for software defects, thereby improving the accuracy of software defect prediction.

[0006] According to one aspect of the present invention, a software defect prediction model training method is provided, comprising:

[0007] Obtaining associated project code vector sample data of a target sample software project;

[0008] Extracting the metric features of the target sample software project based on the associated project code vector sample data;

[0009] Extracting semantic features of the target sample software project based on the associated project code vector sample data;

[0010] The metric features and semantic features of the target sample software project are input into a logistic regression classifier to train the overall model and obtain a software defect prediction model.

[0011] According to another aspect of the present invention, a software defect prediction method is provided, comprising:

[0012] Obtain project code vector data of the target prediction software project;

[0013] Extracting metric features of the target prediction software project based on the project code vector data;

[0014] Extracting semantic features of the target prediction software project based on the project code vector data;

[0015] Inputting the metric features and semantic features of the target prediction software project into a logistic regression classifier, so as to predict the software defects of the target prediction software project according to the metric features and semantic features of the target prediction software project through the logistic regression classifier;

[0016] The logistic regression classifier is trained using the software defect prediction model training method described in the first aspect.

[0017] According to another aspect of the present invention, a software defect prediction model training device is provided, comprising:

[0018] An associated project code vector sample data acquisition module is used to acquire associated project code vector sample data of a target sample software project;

[0019] A first metric feature extraction module is configured to extract metric features of the target sample software project based on the associated project code vector sample data;

[0020] A first semantic feature extraction module is used to extract the semantic features of the target sample software project based on the associated project code vector sample data;

[0021] The software defect prediction model training module is used to input the metric features and semantic features of the target sample software project into the logistic regression classifier to train the overall model and obtain the software defect prediction model.

[0022] According to another aspect of the present invention, there is provided a software defect prediction device, comprising:

[0023] A project code vector data acquisition module is used to acquire project code vector data of a target prediction software project;

[0024] A second metric feature extraction module is used to extract metric features of the target prediction software project based on the project code vector data;

[0025] A second semantic feature extraction module is used to extract semantic features of the target prediction software project based on the project code vector data;

[0026] a software defect prediction module, configured to input the metric features and semantic features of the target prediction software project into a logistic regression classifier, so as to predict the software defects of the target prediction software project according to the metric features and semantic features of the target prediction software project through the logistic regression classifier;

[0027] The logistic regression classifier is trained using the software defect prediction model training method described in the first aspect.

[0028] According to another aspect of the present invention, an electronic device is provided, comprising:

[0029] at least one processor; and

[0030] a memory communicatively connected to the at least one processor; wherein,

[0031] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the software defect prediction model training method or the software defect prediction method described in any embodiment of the present invention.

[0032] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the software defect prediction model training method or the software defect prediction method described in any embodiment of the present invention when executed.

[0033] According to another aspect of the present invention, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the software defect prediction model training method or the software defect prediction method described in any embodiment of the present invention.

[0034] The embodiment of the present invention obtains the associated project code vector sample data of the target sample software project, extracts the metric features and semantic features of the target sample software project based on the associated project code vector sample data, and then inputs the metric features and semantic features of the target sample software project into a logistic regression classifier to train the overall model and obtain a software defect prediction model. After the software defect prediction model training is completed, the project code vector data of the target prediction software project can be obtained, and the metric features and semantic features of the target prediction software project can be extracted based on the project code vector data, and then the metric features and semantic features of the target prediction software project can be input into a logistic regression classifier to predict the software defects of the target prediction software project based on the metric features and semantic features of the target prediction software project through the logistic regression classifier. The logistic regression classifier provided by the above technical solution can fuse metric features and semantic features to realize software prediction, solve the problem of low prediction accuracy of the existing software defect prediction model, and can improve the prediction accuracy of the software defect prediction model for software defects, thereby improving the accuracy of software defect prediction.

[0035] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present invention, nor is it intended to limit the scope of the present invention. Other features of the present invention will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0037] Figure 1 This is a flowchart of a software defect prediction model training method provided by an embodiment of the present invention;

[0038] Figure 2 is a flowchart of another software defect prediction model training method provided by an embodiment of the present invention;

[0039] Figure 3 This is a schematic diagram of a training process of a software defect prediction model provided by an embodiment of the present invention;

[0040] Figure 4 This is a flowchart of a software defect prediction method provided by an embodiment of the present invention;

[0041] Figure 5 is a schematic diagram of a software defect prediction model training device provided by an embodiment of the present invention;

[0042] Figure 6 is a schematic diagram of a software defect prediction device provided by an embodiment of the present invention;

[0043] Figure 7 A schematic structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0044] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.

[0045] It should be noted that the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or apparatus that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units that are not explicitly listed or are inherent to these processes, methods, products or apparatus.

[0046] Figure 1 This is a flowchart of a software defect prediction model training method provided by an embodiment of the present invention. This embodiment is applicable to the case of training a software defect prediction model by integrating the metric features and semantic features of sample data. The method can be executed by a software defect prediction model training device, which can be implemented by software and / or hardware and can generally be integrated into an electronic device. The electronic device can be a terminal device or a server device. As long as it can execute the software defect prediction model training method, the embodiment of the present invention does not limit the specific device type of the electronic device. Accordingly, if Figure 1 As shown, the method includes the following operations:

[0047] S110 , obtaining sample data of project code vectors associated with the target sample software project.

[0048] The target sample software project may be a software project used as a sample to train a software defect prediction model, and the associated project code vector sample data may be sample data composed of code vectors of software projects related to the target sample software project.

[0049] Taking into account the different styles and types of software defects between different software projects, and the fact that there are fewer data samples for a single software project, in an embodiment of the present invention, a transfer learning method can be selected to train a software defect prediction model. In a machine learning scenario, the cost of directly learning the software project code from scratch is too high and the universality of application to other projects is not strong. Therefore, it is expected to use existing related models to assist in learning new software projects as quickly as possible. In layman's terms, transfer learning is to learn the ability to draw inferences from one example to another, and to transfer the knowledge learned in a field with higher data density to a field with lower data density, that is, to transfer the knowledge learned in the source field to the target field, thereby improving the accuracy of prediction in the target field, and at the same time reducing the conditions for the training set and test set in traditional machine learning to meet the independent and identically distributed conditions, thereby improving the accuracy of prediction in the target field. Its core is to find the similarity between existing knowledge and new knowledge, and to achieve the purpose of transfer learning through the transfer of this similarity.

[0050] Therefore, to enhance transfer learning capabilities, target sample software projects can be used as the target domain, while other known software projects can be selected as the source domain. Both the software projects included in the source domain (referred to as source domain sample software projects) and the target sample software projects can be mature data or projects with relevant defects already labeled. To enhance transfer learning capabilities, the source domain sample software projects can optionally have a certain relevance to the target sample software projects. For example, the source domain sample software projects and the target sample software projects may have similar software functions or application domains.

[0051] Accordingly, after determining the target sample software project and the source domain sample software project associated with the target sample software project, the project code content of the target sample software project and the source domain sample software project can be extracted, thereby generating a project code vector based on the extracted project code content as the associated project code vector sample data of the target sample software project.

[0052] S120: Extracting metric features of the target sample software project based on the associated project code vector sample data.

[0053] The metric feature may be a mathematical feature obtained by measuring or performing statistics on the code.

[0054] After obtaining the sample code vector data associated with the target sample software project, the metric features included in the sample code vector data can be extracted based on the sample code vector data, and used as the metric features of the target sample software project. The metric features can be related to the number of lines of code, complexity, coupling, cohesion, and other aspects.

[0055] S130: Extracting semantic features of the target sample software project based on the associated project code vector sample data.

[0056] Among them, semantic features can refer to the smallest semantic unit that constitutes the meaning of a word, that is, the distinctive components obtained by decomposing the meaning of a word, which are used to reveal the semantic differences between words.

[0057] After obtaining the associated project code vector sample data for the target sample software project, the semantic features included in the associated project code vector sample data can be extracted using the associated project code vector sample data as a benchmark to serve as the semantic features of the target sample software project. Compared to metric features, semantic features can contain more information relevant to defects. They generally refer to aspects of the source code that reflect the programmer's intent, functionality, and logic, including but not limited to the naming of variables, functions, classes, and methods, the presence and content of comments, and code structure. Semantic features can often represent deeper syntactic and semantic features.

[0058] S140: Input the metric features and semantic features of the target sample software project into a logistic regression classifier to train the overall model and obtain a software defect prediction model.

[0059] The logistic regression (LR) classifier is a generalized linear regression analysis model. It estimates the probability of an event based on a given dataset of independent variables. Since the result is a probability, the dependent variable ranges between 0 and 1. For example, a logistic regression classifier can explore the characteristic factors that lead to defects and predict the probability of a defect based on these factors. Taking software defect prediction as an example, two sets of software code can be selected and labeled: one set is defective and the other set is non-defective. These two sets of software code data must have different characteristics, so the dependent variable is whether the code is defective, with a value of "yes" or "no". Independent variables can include a variety of types, such as code type, data, function, class, contextual meaning, project goals, and author coding skills. Independent variables can be either continuous or categorical. Logistic regression analysis can then be used to determine the weights of the independent variables, providing a rough understanding of which features are likely to cause defects and predicting the likelihood of defects based on these weights. In an embodiment of the present invention, three different models, including a model for extracting metric features of a target sample software project, a model for extracting semantic features of a target sample software project, and a logistic regression classifier, can be constructed into an overall model, and the overall model can be used as a software defect prediction model to be trained. Accordingly, after extracting the metric features and semantic features of the target sample software project, the two feature types can be fused and the two feature types can be simultaneously input into the logistic regression classifier to implement the training process of the overall model. Since the feature types input into the logistic regression classifier include both the metric features of the target sample software project and the semantic features of the target sample software project, the quality of the input features used to train the software defect prediction model can be improved, thereby significantly improving the software defect prediction performance of the software defect prediction model.

[0060] The embodiment of the present invention obtains sample code vector data associated with a target sample software project, extracts metric and semantic features of the target sample software project based on the associated project code vector data, and then inputs the metric and semantic features of the target sample software project into a logistic regression classifier to train the overall model and obtain a software defect prediction model. The software defect prediction model trained using the above technical solution can integrate metric and semantic features to achieve software prediction, resolving the low prediction accuracy issue of existing software defect prediction models and improving the prediction accuracy of software defects, thereby increasing the accuracy of software defect prediction.

[0061] Figure 2This is a flowchart of another software defect prediction model training method provided by an embodiment of the present invention. This embodiment is specific based on the above embodiment. In this embodiment, multiple specific optional implementation methods are provided for obtaining the associated project code vector sample data of the target sample software project and extracting the metric features and semantic features of the target sample software project. Figure 2 As shown, the method of this embodiment may include:

[0062] S210: Determine a source domain sample software project associated with the target sample software project, and obtain project code sample data of the target sample software project and the source domain sample software project.

[0063] The source domain sample software project is a software project included in the source domain. The project code sample data can be the project code data of the target sample software project and the source domain sample software project.

[0064] After determining the source domain sample software project associated with the target sample software project, the project source codes of the target sample software project and the source domain sample software project can be parsed. The parsed results can be annotated with software defects through TFS (Team Foundation Server) level defects or code version changes to obtain labeled project code sample data.

[0065] S220: Convert the project code sample data of the target sample software project and the source domain sample software project into an AST sample data structure, and map the node sample vectors in the AST sample data structure into digital sample vectors.

[0066] The node sample vector may be a node vector in an AST sample data structure, and the digital sample vector may be a digital vector obtained by converting the node sample vector.

[0067] Figure 3 FIG. 1 is a schematic diagram of a training process of a software defect prediction model provided by an embodiment of the present invention. In a specific example, Figure 3As shown, after obtaining the project code sample data of the source domain and the target domain, the project code sample data can be converted into the form of an abstract syntax tree (AST) to obtain an AST sample data structure. Exemplarily, if the project code sample data is a code written in Java (Java programming language, i.e., Java programming language), the project code sample data of the target domain and the source domain can be converted into an AST sample data structure by the JAVA.lang method. Further, the AST sample data structure can be converted into a token vector. Since the converted token vector belongs to a tree node type rather than a digital vector type, it cannot be directly used as the input of a deep learning model. At this point, a dictionary can be constructed, and through the key-value correspondence in the dictionary, the node sample vector of the node type of the token vector can be mapped to a unique corresponding number, thereby realizing the conversion of the project code sample data into the form of an integer vector and obtaining the digital vector that the project code sample data ultimately corresponds to.

[0068] S230 , performing oversampling processing on the target sample class in the digital sample vector to obtain the associated item code vector sample data.

[0069] The target sample class may be a digital sample vector having a smaller amount of data in the digital sample vector.

[0070] For target sample classes with relatively small amounts of data in the digital sample vector, the Synthetic Minority Oversampling Technique (SMOTE) method can be used to increase the number of target sample classes in the minority class and balance their weights. After downsampling, the integer vector of this target sample class can be used as input to the software defect prediction model. Thus, by oversampling the target sample class in the digital sample vector, sample data for the associated project code vector can be obtained.

[0071] The above technical solution parses software projects in the source and target domains into AST sample data structures and converts them into token vectors. These are then converted into integer vectors using a dictionary. Considering that when the class distribution of different datasets is severely skewed, with the majority class (defect-free software projects) far outnumbering the minority class (defective software projects), class imbalance can occur, impacting prediction accuracy. By balancing the weight of the minority class using the SMOTE algorithm, the resulting sample data of the associated project code vectors is of higher quality, better meeting the sample data requirements of the software defect prediction model.

[0072] S240: Input the associated project code vector sample data into a TCA model, and obtain a mapping result of the associated project code vector sample data output by the TCA model as a metric feature of the target sample software project.

[0073] Among them, the Temporal Convolutional Network (TCA) model is a feature-based transfer learning method. The TCA model aims to address the distribution discrepancy between the source and target domains in domain adaptation. When the source and target domains have different data distributions, TCA maps the data from both domains into a high-dimensional reproducing kernel Hilbert space. In this space, the maximum mean discrepancy (MMD) is calculated to minimize the data distance between the source and target while maximally preserving their internal properties.

[0074] Optionally, the model used to extract the metric features of the target sample software project can adopt the TCA model. In a specific example, Figure 3 As shown in the figure, after mapping the node sample vectors in the AST sample data structure to obtain the associated project code vector sample data, the associated project code vector sample data can be input into the TCA model. The TCA model can obtain the measurement features of the migration based on the associated project code vector sample data, and calculate the MMD of the feature representations of different source domains and target domains respectively. Specifically, given M source domains and target domain D T , then the i-th source domain With target D T The maximum mean difference (MMD) metric is calculated as follows:

[0075]

[0076] in, represents the source domain, D T To represent the target domain, the set of source domain and target domain can be represented by the associated item code vector sample data. represents the i-th source domain With the target domain D T The maximum mean difference of Indicates the source domain The number of defective samples in the T Denotes the target domain D T The number of defective samples in represents the jth defect sample in the i-th source domain, Denotes the target domain D TThe kth defect sample in , H represents the Gaussian kernel function φ(·) used to map the defect sample into a high-dimensional space for measurement, and finally obtains the metric features of the source domain and the target domain after dimensionality reduction.

[0077] Specifically, the TCA model can implement the projection function using the MMD method. This function maps the sample data of the associated project code vectors to minimize the difference in feature distribution between the source and target domains. Accordingly, the mapping results of the sample data of the associated project code vectors output by the TCA model can be used as metric features to facilitate cross-domain machine learning.

[0078] The above technical solution extracts transferable metric features through transfer component analysis, measures the distance between different project features through the maximum mean difference, and transfers metric features with similar distances.

[0079] S250. Input the associated project code vector sample data into a TCN model based on an attention mechanism, and extract the semantic features of the target sample software project according to the associated project code vector sample data through the TCN model based on the attention mechanism.

[0080] The attention mechanism is inspired by the information processing mechanism of human vision. The visual system identifies focal areas within the overall environment and gives them greater attention, while suppressing the acquisition of useless information. Its core idea is to quickly select important information and eliminate useless information, thereby improving the efficiency and accuracy of information processing. TCN (Temporal Convolutional Network) is a method based on the convolutional neural network structure. TCN replaces traditional neural networks with convolutional layers. The fully convolutional network structure ensures that the network's output dimensions are consistent with the input data dimensions. Theoretically, TCN can calculate inputs of any size and produce outputs of corresponding spatial dimensions. The TCN network structure can be represented as a "one-dimensional fully convolutional network + causal convolution" and greatly increases the network depth through a stacked residual block structure, significantly improving the TCN's learning ability and preventing the problems of vanishing and exploding gradients. Therefore, TCN can accept inputs of arbitrary length and map them to output sequences of the same length by using a fully connected neural network. At the same time, the network can achieve a large receptive field with fewer layers. By dilating causal convolutions, it ensures that no information leaks from the past to the future and generates predictions. After each item is predicted, it is fed back into the network to predict the next sample value. Compared to traditional recurrent neural networks (RNNs) and long short-term memory neural networks (LSTMs), TCNs can capture long-term relationships in sequences and have advantages such as parallel computing capabilities, fewer parameters, and a gate-free structure. They have been widely used in finance, signal processing, text classification, and video classification.

[0081] In an embodiment of the present invention, the model for extracting the semantic features of the target sample software project can optionally adopt a TCN model based on the attention mechanism. That is, the semantic features of the associated project code vector sample data can be extracted by constructing a TCN model based on the attention mechanism. In a specific example, Figure 3 As shown in the figure, a TCN model based on the attention mechanism can be composed of a TCN residual layer, a weight-normalized one-dimensional convolutional layer, a fully connected layer, and a matching layer. The TCN residual layer is used to process the sequence of input vectors and accelerate the training process and improve the model's generalization ability through weight normalization. The fully connected layer is used to obtain the output of the convolutional layer and map it to a low-dimensional feature space. The matching layer is used to measure the semantic feature differences between items and is added to the network training loss calculation process.

[0082] Traditional semantic feature differences are also measured using MMD. However, since MMD only measures the marginal distribution difference between defect samples in the source and target domains, it is approximately equivalent to aligning the conditional distribution of the source and target domains. In actual software projects, the defect distributions between different source and target projects are usually very different. The MMD metric assumes that all source domains have the same weight and cannot effectively solve the scenario where there is weight deviation in different domains.

[0083] In order to solve the scenario where there is a weight deviation between the source domain and the target domain, the embodiment of the present invention uses an improved weighted maximum mean discrepancy (WMMD) to alleviate the problem that different domains may have unequal weights on the same defect category. Specifically, by using the softmax function (normalized exponential function) to calculate the domain correlation coefficient w between the source domain and the target domain, the data distribution of each source domain and the target domain can be better matched during model training, and the negative impact of the weight deviation between domain categories can be automatically reduced, thereby ultimately minimizing the distribution diversity loss. dis purpose.

[0084] In an optional embodiment of the present invention, the distribution diversity loss function adopted by the TCN model based on the attention mechanism is as follows:

[0085]

[0086] Among them, Loss dis Denotes the distribution diversity loss function, WMMD(D s ,D T ) represents the source domain D s With the target domain D T The maximum mean difference of weights between them, the source domain set is M represents the number of source domains, w i It represents the domain correlation coefficient between the source domain and the target domain, specifically the correlation between the i-th source domain and the target domain. This domain correlation coefficient will also serve as a weight to affect the learning process of the model parameters in subsequent modules. represents the i-th source domain With the target domain D T The maximum mean difference (MMD) Indicates the source domain The number of defective samples in represents the jth defect sample in the i-th source domain, n T Denotes the target domain D T The number of defective samples in Denotes the target domain D TThe kth defect sample in [ 1 ] is represented by H, where the Gaussian kernel function φ(·) is used to map the defect sample into a high-dimensional space for measurement. Alternatively, the defect sample can be determined using the code vector sample data associated with the target sample software project. That is, the defect sample can be a sample in the code vector sample data associated with the target sample software project.

[0087] It is understandable that in addition to aligning the feature distributions of the target domain and the source domain, learning the features of each source domain itself is also crucial, and its classification loss may also lead to negative transfer. Therefore, the Attentive Classification Loss (ACL) in the supervised learning attention mechanism can be further used. Optionally, the attention mechanism of the TCN model based on the attention mechanism adopts the following attention classification loss function:

[0088]

[0089] Among them, Loss att represents the attention classification loss function, Indicates the source domain The softmax cross entropy loss on .

[0090] The above technical solution, by associating the transfer learning method with the network model, adds a matching layer to the TCN network for matching transferable semantic features. The WMMD module can reduce the data distribution difference between the target domain and the high-correlation source domain by leveraging domain correlation, thereby better adapting the domain-private features in the high-correlation source domain to the target domain, thereby improving the accuracy of the CPDP model. The residual block stacking structure of TCN can greatly increase the network depth. By stacking convolutional layers and increasing the receptive field of the convolution kernel, it can effectively capture local dependencies in the data and convey contextual semantic information. It can accept inputs of arbitrary length and is suitable for large-scale data processing. It also avoids the gradient vanishing phenomenon existing in recurrent neural networks. The introduction of the attention mechanism can greatly improve the learning ability of TCN and perform attention weighting on these semantic features, effectively filtering out irrelevant information, focusing more on key information, and effectively extracting semantic features related to code defects.

[0091] S260: Input the metric features and semantic features of the target sample software project into a logistic regression classifier to train the overall model and obtain a software defect prediction model.

[0092] Finally, the transferable metric features extracted from the TCA model and the transferable semantic features extracted from the attention-based TCN model can be combined and input into the logistic regression classifier. By training the overall model composed of TCA, TCN and logistic regression classifier, parameter tuning iteration is achieved, and finally the CPDP model is constructed as a software defect prediction model.

[0093] In an optional embodiment of the present invention, the overall loss function of the software defect prediction model can be expressed as:

[0094] LOSS=minLoss c +λminLoss dis +minLoss att

[0095] Among them, LOSS represents the overall loss function of the software defect prediction model, Loss c Represents the classification loss function, Loss dis Represents the distribution diversity loss function, Loss att represents the attention classification loss function, and λ represents the regularization parameter.

[0096] By minimizing the classification loss Loss c , distribution diversity loss between different features Loss dis and attention classification loss Loss att , which can improve the accuracy and versatility of this defect prediction model in different software projects.

[0097] The above technical solution provides a training method for a software defect prediction model based on a transfer learning-based attention temporal convolutional network. Semantic features are obtained through the transfer attention TCN network, and are combined with the metric features extracted by transfer component analysis and input into a logistic regression classifier for training, thereby constructing a general and efficient software defect prediction model.

[0098] Figure 4 This is a flowchart of a software defect prediction method provided by an embodiment of the present invention. This embodiment is applicable to the case where software defects are predicted by a software defect prediction model trained by integrating the metric features and semantic features of sample data. The method can be executed by a software defect prediction device, which can be implemented by software and / or hardware and can generally be integrated into an electronic device. The electronic device can be a terminal device or a server device. As long as it can execute the software defect prediction method, the embodiment of the present invention does not limit the specific device type of the electronic device. Accordingly, if Figure 4 As shown, the method includes the following operations:

[0099] S310: Obtain project code vector data of the target prediction software project.

[0100] The target prediction software project may be a software project for which software defects need to be predicted using a software defect prediction model. The project code vector data may be data composed of code vectors of the target prediction software project.

[0101] In an embodiment of the present invention, after the software defect prediction model training is completed, the target prediction software project requiring software prediction can be determined, and the project code vector data of the target prediction software project can be obtained.

[0102] In an optional embodiment of the present invention, obtaining the project code vector data of the target prediction software project may include: obtaining the project code data of the target prediction software project; converting the project code data of the target prediction software project into an AST data structure; mapping the node vector in the AST data structure into a digital vector; and oversampling the target class in the digital vector to obtain the project code vector data.

[0103] Specifically, the project source code of the target prediction software project can be parsed to obtain the project code data of the target prediction software project, and the project code data of the target prediction software project can be converted into an AST data structure. Furthermore, the AST sample data structure can be converted into a token vector. Since the converted token vector belongs to a tree node type rather than a digital vector type, it cannot be directly used as the input of the deep learning model. At this time, a dictionary can be constructed, and through the key-value correspondence in the dictionary, the node vector of the node type of the token vector can be mapped to a unique corresponding number, thereby converting the project code vector data into the form of an integer vector and obtaining the digital vector that the project code vector data ultimately corresponds to.

[0104] S320. Extracting metric features of the target prediction software project based on the project code vector data.

[0105] Optionally, the TCA model can be used to extract metric features of the target prediction software project based on the project code vector data.

[0106] S330. Extracting semantic features of the target prediction software project based on the project code vector data.

[0107] Optionally, a TCN model based on the attention mechanism can be used to extract semantic features of the target predicted software project based on the project code vector data.

[0108] S340. Input the metric features and semantic features of the target prediction software project into a logistic regression classifier, so as to predict the software defects of the target prediction software project according to the metric features and semantic features of the target prediction software project through the logistic regression classifier.

[0109] Among them, the model for extracting the metric features, the model for extracting the semantic features and the logistic regression classifier constitute a defect prediction model, and the defect prediction model is trained using the software defect prediction model training method described in any embodiment of the present invention.

[0110] After obtaining the metric features and semantic features of the target prediction software project, the metric features and semantic features of the target prediction software project can be input into a pre-trained logistic regression classifier to predict the software defects of the target prediction software project by fusing multiple types of features such as the metric features and semantic features of the target prediction software project through the logistic regression classifier.

[0111] It can be seen that the embodiment of the present invention proposes a cross-project software defect prediction method based on transfer learning and attention mechanism temporal convolutional network, which combines traditional metric features with semantic features to predict cross-project software defects. First, an abstract syntax tree (AST) is generated based on the source code of different projects, and the AST node content is converted into an integer vector as the input of the attention mechanism TCN model. The attention mechanism captures the semantic features of the program from the code structure and context, thereby improving the attention of key information. On the other hand, the integer vector converted from the AST node content is input into the TCA model, and the transferable metric features are extracted by the TCA model. The weights of different projects are calculated by the maximum mean difference. Finally, the semantic features and metric features are combined and input into the logistic regression classifier to effectively predict software defects.

[0112] The embodiment of the present invention obtains the associated project code vector sample data of the target sample software project, extracts the metric features and semantic features of the target sample software project based on the associated project code vector sample data, and then inputs the metric features and semantic features of the target sample software project into a logistic regression classifier to train the overall model and obtain a software defect prediction model. After the software defect prediction model training is completed, the project code vector data of the target prediction software project can be obtained, and the metric features and semantic features of the target prediction software project can be extracted based on the project code vector data, and then the metric features and semantic features of the target prediction software project can be input into a logistic regression classifier to predict the software defects of the target prediction software project based on the metric features and semantic features of the target prediction software project through the logistic regression classifier. The logistic regression classifier provided by the above technical solution can fuse metric features and semantic features to realize software prediction, solve the problem of low prediction accuracy of the existing software defect prediction model, and can improve the prediction accuracy of the software defect prediction model for software defects, thereby improving the accuracy of software defect prediction.

[0113] In the technical solutions disclosed herein, the collection, storage, use, processing, transmission, provision and disclosure of user personal information are in compliance with the relevant laws and regulations and do not violate public order and good morals.

[0114] It should be noted that the relevant information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for display, data for analysis, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data comply with relevant laws, regulations and standards in the relevant regions.

[0115] It should be noted that any arrangement and combination of the technical features in the above embodiments also falls within the protection scope of the present invention.

[0116] Figure 5 Schematic diagram of a software defect prediction model training device provided by an embodiment of the present invention. Figure 5 As shown, the apparatus includes: an associated project code vector sample data acquisition module 410, a first metric feature extraction module 420, a first semantic feature extraction module 430, and a software defect prediction model training module 440, wherein:

[0117] The associated project code vector sample data acquisition module 410 is used to acquire the associated project code vector sample data of the target sample software project;

[0118] A first metric feature extraction module 420 is configured to extract metric features of the target sample software project based on the associated project code vector sample data;

[0119] A first semantic feature extraction module 430 is configured to extract semantic features of the target sample software project based on the associated project code vector sample data;

[0120] The software defect prediction model training module 440 is used to input the metric features and semantic features of the target sample software project into a logistic regression classifier to train the overall model and obtain a software defect prediction model.

[0121] The embodiment of the present invention obtains sample code vector data associated with a target sample software project, extracts metric and semantic features of the target sample software project based on the associated project code vector data, and then inputs the metric and semantic features of the target sample software project into a logistic regression classifier to train the overall model and obtain a software defect prediction model. The software defect prediction model trained using the above technical solution can integrate metric and semantic features to achieve software prediction, resolving the low prediction accuracy issue of existing software defect prediction models and improving the prediction accuracy of software defects, thereby increasing the accuracy of software defect prediction.

[0122] Optionally, the associated project code vector sample data acquisition module 410 is also used to: determine the source domain sample software project associated with the target sample software project; obtain the project code sample data of the target sample software project and the source domain sample software project; convert the project code sample data of the target sample software project and the source domain sample software project into an AST sample data structure; map the node sample vector in the AST sample data structure into a digital sample vector; and oversample the target sample class in the digital sample vector to obtain the associated project code vector sample data.

[0123] Optionally, the first metric feature extraction module 420 is further used to: input the associated project code vector sample data into the TCA model; obtain the mapping result of the associated project code vector sample data output by the TCA model as the metric feature of the target sample software project.

[0124] Optionally, the first semantic feature extraction module 430 is also used to: input the associated project code vector sample data into the TCN model based on the attention mechanism; and extract the semantic features of the target sample software project according to the associated project code vector sample data through the TCN model based on the attention mechanism.

[0125] Optionally, the distribution diversity loss function adopted by the attention-based TCN model is as follows:

[0126]

[0127] The attention classification loss function adopted by the attention mechanism of the TCN model based on the attention mechanism is as follows:

[0128]

[0129] Among them, Loss dis Denotes the distribution diversity loss function, WMMD(D s ,D T ) represents the source domain D s With the target domain D T The maximum mean difference of weights between them, the source domain set is M represents the number of source domains, w i represents the domain correlation coefficient between the source domain and the target domain, represents the i-th source domain With the target domain D T The maximum mean difference (MMD) Indicates the source domain The number of defective samples in represents the jth defect sample in the i-th source domain, n T Denotes the target domain D T The number of defective samples in Denotes the target domain D T The kth defect sample in the , H represents the Gaussian kernel function φ(·) used to map the defect sample into a high-dimensional space for measurement, Loss att represents the attention classification loss function, Indicates the source domain The softmax cross entropy loss on .

[0130] Optionally, the overall loss function of the software defect prediction model is expressed as:

[0131] LOSS=minLoss c +λminLoss dis +minLoss att

[0132] Among them, LOSS represents the overall loss function of the software defect prediction model, Loss c Represents the classification loss function, Loss dis Represents the distribution diversity loss function, Loss att represents the attention classification loss function, and λ represents the regularization parameter.

[0133] The above-mentioned software defect prediction model training device can execute the software defect prediction model training method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method. For technical details not fully described in this embodiment, please refer to the software defect prediction model training method provided by any embodiment of the present invention.

[0134] Figure 6 FIG. 1 is a schematic diagram of a software defect prediction device provided by an embodiment of the present invention. Figure 6 As shown, the device includes: a project code vector data acquisition module 510, a second metric feature extraction module 520, a second semantic feature extraction module 530 and a software defect prediction module 540, wherein:

[0135] A project code vector data acquisition module 510 is used to acquire project code vector data of a target prediction software project;

[0136] A second metric feature extraction module 520 is configured to extract metric features of the target prediction software project based on the project code vector data;

[0137] A second semantic feature extraction module 530 is configured to extract semantic features of the target prediction software project based on the project code vector data;

[0138] A software defect prediction module 540 is configured to input the metric features and semantic features of the target prediction software project into a logistic regression classifier, so as to predict the software defects of the target prediction software project based on the metric features and semantic features of the target prediction software project through the logistic regression classifier;

[0139] Among them, the model for extracting the metric features, the model for extracting the semantic features and the logistic regression classifier constitute a defect prediction model, and the defect prediction model is trained using the software defect prediction model training method described in any embodiment of the present invention.

[0140] The embodiment of the present invention obtains the associated project code vector sample data of the target sample software project, extracts the metric features and semantic features of the target sample software project based on the associated project code vector sample data, and then inputs the metric features and semantic features of the target sample software project into a logistic regression classifier to train the overall model and obtain a software defect prediction model. After the software defect prediction model training is completed, the project code vector data of the target prediction software project can be obtained, and the metric features and semantic features of the target prediction software project can be extracted based on the project code vector data, and then the metric features and semantic features of the target prediction software project can be input into a logistic regression classifier to predict the software defects of the target prediction software project based on the metric features and semantic features of the target prediction software project through the logistic regression classifier. The logistic regression classifier provided by the above technical solution can fuse metric features and semantic features to realize software prediction, solve the problem of low prediction accuracy of the existing software defect prediction model, and can improve the prediction accuracy of the software defect prediction model for software defects, thereby improving the accuracy of software defect prediction.

[0141] The above-mentioned software defect prediction device can execute the software defect prediction method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method. For technical details not fully described in this embodiment, please refer to the software defect prediction method provided by any embodiment of the present invention.

[0142] Figure 7 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or claimed herein.

[0143] like Figure 7As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., which is communicatively connected to the at least one processor 11. The memory stores a computer program that can be executed by the at least one processor. The processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 into the random access memory (RAM) 13. Various programs and data required for the operation of the electronic device 10 can also be stored in the RAM 13. The processor 11, ROM 12, and RAM 13 are connected to each other via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0144] Multiple components in the electronic device 10 are connected to the I / O interface 15, including an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a magnetic disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.

[0145] The processor 11 may be any general-purpose and / or specialized processing component with processing and computing capabilities. Examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various processors that run machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the software defect prediction model training method or the software defect prediction method.

[0146] Optionally, the software defect prediction model training method may include: obtaining associated project code vector sample data of the target sample software project; extracting metric features of the target sample software project based on the associated project code vector sample data; extracting semantic features of the target sample software project based on the associated project code vector sample data; and inputting the metric features and semantic features of the target sample software project into a logistic regression classifier to train the overall model and obtain a software defect prediction model.

[0147] The software defect prediction method may include: obtaining project code vector data of a target prediction software project; extracting metric features of the target prediction software project based on the project code vector data; extracting semantic features of the target prediction software project based on the project code vector data; inputting the metric features and semantic features of the target prediction software project into a logistic regression classifier, so as to predict the software defects of the target prediction software project based on the metric features and semantic features of the target prediction software project through the logistic regression classifier; wherein, the model for extracting the metric features, the model for extracting the semantic features, and the logistic regression classifier constitute a defect prediction model, and the defect prediction model is trained using the software defect prediction model training method described in any embodiment of the present invention.

[0148] In some embodiments, the software defect prediction model training method or the software defect prediction method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the software defect prediction model training method or the software defect prediction method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the software defect prediction model training method or the software defect prediction method in any other appropriate manner (for example, by means of firmware).

[0149] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0150] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the computer program is executed by the processor, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The computer program may be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0151] In the context of the present invention, computer-readable storage media can be tangible media that can contain or store a computer program for use with an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. Computer-readable storage media can include but are not limited to electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, computer-readable storage media can be machine-readable signal media. More specific examples of machine-readable storage media can include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0152] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and the input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0153] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0154] A computing system may include clients and servers. The clients and servers are typically remote from each other and typically interact via a communication network. This client-server relationship arises through computer programs running on the respective computers, creating a client-server relationship. The server may be a cloud server, also known as a cloud computing server or cloud host. This server is a hosting product within the cloud computing service ecosystem that addresses the management difficulties and limited scalability of traditional physical hosting and VPS services.

[0155] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved. This is not a limitation herein.

[0156] The above specific embodiments do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure shall be included within the scope of protection of this disclosure.

Claims

1. A software defect prediction model training method, characterized in that: include: Obtaining associated project code vector sample data of a target sample software project; Extracting the metric features of the target sample software project based on the associated project code vector sample data; Extracting semantic features of the target sample software project based on the associated project code vector sample data; The metric features and semantic features of the target sample software project are input into a logistic regression classifier to train the overall model and obtain a software defect prediction model.

2. The method according to claim 1, characterized in that The step of obtaining the associated project code vector sample data of the target sample software project includes: Determining a source domain sample software project associated with the target sample software project; Acquire project code sample data of the target sample software project and the source domain sample software project; Converting the project code sample data of the target sample software project and the source domain sample software project into an abstract syntax tree (AST) sample data structure; Mapping the node sample vectors in the AST sample data structure into digital sample vectors; Oversampling is performed on the target sample class in the digital sample vector to obtain the associated item code vector sample data.

3. The method according to claim 1, characterized in that The step of extracting the metric features of the target sample software project based on the associated project code vector sample data includes: Inputting the associated item code vector sample data into a transfer component analysis (TCA) model; A mapping result of the associated project code vector sample data output by the TCA model is obtained as a metric feature of the target sample software project.

4. The method according to claim 1, wherein The extracting the semantic features of the target sample software project based on the associated project code vector sample data includes: Input the associated project code vector sample data into a time convolutional network (TCN) model based on an attention mechanism; The semantic features of the target sample software project are extracted according to the associated project code vector sample data through the TCN model based on the attention mechanism.

5. The method according to claim 4, characterized in that The distribution diversity loss function used by the attention-based TCN model is as follows: The attention classification loss function adopted by the attention mechanism of the TCN model based on the attention mechanism is as follows: Among them, Loss dis Denotes the distribution diversity loss function, WMMD(D s ,D T ) represents the source domain D s With the target domain D T The maximum mean difference of weights between them, the source domain set is M represents the number of source domains, w i represents the domain correlation coefficient between the source domain and the target domain, represents the i-th source domain With the target domain D T Maximum mean difference MMD, n si Indicates the source domain The number of defective samples in represents the jth defect sample in the i-th source domain, n T Denotes the target domain D T The number of defective samples in Denotes the target domain D T The kth defect sample in the , H represents the Gaussian kernel function φ(·) used to map the defect sample into a high-dimensional space for measurement, Loss att represents the attention classification loss function, Indicates the source domain The softmax cross entropy loss on .

6. The method according to claim 1, characterized in that The overall loss function of the software defect prediction model is expressed as: LOSS=minLoss c +λminLoss dis +minLoss att Among them, LOSS represents the overall loss function of the software defect prediction model, Loss c Represents the classification loss function, Loss dis Represents the distribution diversity loss function, Loss att represents the attention classification loss function, and λ represents the regularization parameter.

7. A software defect prediction method, characterized in that: include: Obtain project code vector data of the target prediction software project; Extracting metric features of the target prediction software project based on the project code vector data; Extracting semantic features of the target prediction software project based on the project code vector data; Inputting the metric features and semantic features of the target prediction software project into a logistic regression classifier, so as to predict the software defects of the target prediction software project according to the metric features and semantic features of the target prediction software project through the logistic regression classifier; Among them, the model for extracting the metric features, the model for extracting the semantic features and the logistic regression classifier constitute a defect prediction model, and the defect prediction model is trained using the software defect prediction model training method described in any one of claims 1-6.

8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the software defect prediction model training method described in any one of claims 1 to 6, or execute the software defect prediction method described in claim 7.

9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, which are used to enable a processor to implement the software defect prediction model training method described in any one of claims 1 to 6, or execute the software defect prediction method described in claim 7 when executed.

10. A computer program product comprising a computer program / instructions, wherein: When the computer program / instructions are executed by a processor, the software defect prediction model training method described in any one of claims 1 to 6 is implemented, or the software defect prediction method described in claim 7 is executed.