Software defect positioning method based on feature crossing and KAN network

By adopting feature crossover and KAN network methods in software defect location, the problem of difficult feature interaction information in high-dimensional space is solved, and efficient and fast defect positioning is achieved, suitable for high-reliability and fast response software systems.

CN119576742AActive Publication Date: 2025-03-07HANGZHOU DIANZI UNIV

Patent Information

Application Number
CN202411694537.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-25
Publication Date
2025-03-07
Estimated Expiration
2044-11-25

AI Technical Summary

Technical Problem

The existing feature cross-network method is difficult to accurately capture complex high-order feature interaction information in high-dimensional space, and requires a lot of computing resources and time, making it difficult to apply to software systems that require high reliability and fast response.

Method used

The software defect positioning method based on feature crossover and KAN network is adopted, and different features are cross-correlated through the cross-layer, hidden relationships between features are mined, and the parameterized nonlinear activation function of the KAN network is used for learning to overcome the dimensional disaster problem.

Benefits of technology

It accurately captures and adapts to complex function changes in high-dimensional space, improves the performance and efficiency of defect positioning, and can quickly and accurately locate defects under a small amount of information, and is suitable for critical business application scenarios with strict time requirements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119576742A_ABST
    Figure CN119576742A_ABST
Patent Text Reader

Abstract

The invention discloses a software defect positioning method based on feature crossing and a KAN network. Firstly, different types of features are extracted from a defect report and a source code file, then cross correlation of the features is carried out through a cross layer, and a hidden relation between the features is mined; the KAN is further used for learning a parameterized nonlinear activation function, the process of fitting a polynomial function by the feature cross network is converted into the process of fitting a plurality of one-dimensional functions, dimension disasters are overcome, changes of complex functions are accurately captured and adapted, complex high-order feature interaction information in defect positioning is accurately captured, and the defect positioning accuracy is improved. Therefore, the defect positioning performance is improved. And finally, inputting a result output by the KAN network into a full connection layer, calculating a final similar score, and carrying out descending sorting according to the final similar score to obtain a defect positioning result. The method improves the defect positioning precision, has advantages in the aspect of calculation efficiency, and is especially suitable for key business application scenes with strict time requirements.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of data analysis, relates to software defect location, and specifically relates to a software defect location method based on feature intersection and KAN network. Background Art

[0002] Defects are inevitable in the software development process. As the scale and complexity of software increase, the frequency and impact of defects are also increasing. Software defects may cause a series of problems such as system crashes, data loss, and security vulnerabilities, which will not only affect the user experience, but may even cause serious security issues in key business scenarios. Therefore, timely and accurate positioning and repair of software defects has become a key task to ensure software quality and system stability.

[0003] To meet this challenge, researchers have proposed a variety of defect localization methods. Among them, defect localization technology based on information retrieval has achieved certain results. The core idea of ​​this type of technology is to quantify the similarity between defect reports and source code, and then sort them according to the similarity metric to find the files most likely to have defects. In addition, some researchers also assist in defect localization by mining the structural semantic features in defect reports and source code, and calculate the similarity by combining data features and structural semantic features to improve the localization effect.

[0004] In order to better capture the interactions and complex relationships between different features, feature crossover networks are applied to defect localization. The feature crossover network is a model that captures nonlinear relationships by constructing a combination of multiple features. Its core idea is to cross multidimensional features to generate high-order features and obtain more contextual information. The feature crossover network based on multi-layer perceptron (MLP) has shown good results in practical applications because it can automatically learn the nonlinear interaction relationship between features and does not require manual design of complex feature crossovers. This method uses the powerful learning ability of neural networks to establish high-order nonlinear relationships between different features, thereby improving the performance of the model.

[0005] However, the existing feature cross network methods still have some significant problems. First, the use of multilayer perceptrons as feature cross networks has the dimensionality curse problem, that is, in high-dimensional space, the sparsity of data and the processing complexity increase dramatically, which makes it impossible to accurately capture and adapt to the changes of complex functions in high-dimensional space, and it is difficult to capture the complex high-order feature interaction information in defect location; In addition, some advanced methods rely on mining the structural semantics of defect reports and source code, code graph structure, etc., which requires a lot of computing resources and time cost information, and is difficult to apply to software systems that require high reliability and fast response, such as financial systems, online servers, etc., so how to quickly and accurately locate defects with a small amount of information is also one of the key issues that need to be solved urgently. Summary of the invention

[0006] In view of the shortcomings of the prior art, the present invention proposes a software defect localization method based on feature cross-correlation and KAN network, which cross-correlates different features through the cross layer and explores the hidden relationship between the features; further uses the nonlinear activation function parameterized by the KAN network for learning to overcome the dimensionality curse problem and improve the performance of defect localization.

[0007] A software defect location method based on feature intersection and KAN network specifically includes the following steps:

[0008] Step 1: Get the original defect report b and source code file s, and obtain the training data set after preprocessing.

[0009] Step 2: Extract the features of each sample in the training data set, including VSM similarity rVSM(b,s), collaborative filtering score cf(b,s), stack trace score tr(b,s), cyclomatic complexity cc(s), repair frequency ff(b,s), and repair time interval fr(b,s), perform vectorization processing and splicing, and obtain the feature vector of the source code file s. .

[0010] Step 3: Based on feature intersection and KAN network, calculate the similarity score between the defect report b and the source code file s:

[0011] s3.1、The feature vector of the sample Input into the continuous N-layer cross layer, perform feature cross-pollination on different features in the vector, and explore the hidden relationship between features. The output of the n+1th cross layer for:

[0012] in, , = , Represents the output of the nth cross layer. , are the weight matrix and bias vector of the n+1th cross layer, Denotes the Hadamard product.

[0013] s3.2, the output of the last cross layer As the input of KAN network , the objective function is fitted by learning the parameterized nonlinear activation function, and L1 regularization is used to sparse the weights of the KAN network, and pruning is performed according to the sparse results.

[0014] s3.3、The output results of KAN network Input into the fully connected layer to obtain the final similarity score between the defect report b and the source code file s :

[0015] in is the weight matrix of the fully connected layer, is the bias term.

[0016] Step 4: The final similarity score calculated according to step 3 Sort the source code files from large to small. The higher the ranking, the greater the possibility that the source code file contains defects.

[0017] Compared with the prior art, the present invention has the following beneficial effects:

[0018] 1. Use the KAN network to obtain high-order feature interaction information. Based on the Kolmogorov-Arnold representation theorem, the process of fitting polynomial functions in the feature cross network is converted into the process of fitting multiple one-dimensional functions. By changing the fixed nonlinear activation function and linear parameter learning to the direct learning of the parameterized nonlinear activation function, the dimensionality curse problem is overcome, and the changes of complex functions can be captured and adapted more accurately, and the complex high-order feature interaction information in defect location can be better captured, thereby improving the performance of defect location.

[0019] 2. Using only data features can achieve similar or better results than existing technologies, which means that this method can accurately and quickly locate defects with a small amount of information, and is especially suitable for critical business application scenarios with strict time requirements. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 Schematic diagram of software defect location method based on feature intersection and KAN;

[0021] Figure 2 It is a schematic diagram of the structure of the cross layer;

[0022] Figure 3 It is a schematic diagram of the structure of the KAN network;

[0023] Figure 4 Schematic diagram of the structure of the KAN network after sparseness and pruning. DETAILED DESCRIPTION

[0024] The present invention will be further explained below with reference to the accompanying drawings;

[0025] like Figure 1 As shown, a software defect location method based on feature intersection and KAN specifically includes the following steps:

[0026] Step 1: This embodiment uses the data set tomcat as the original defect report b and the source code file s. First, preprocessing is performed, including text standardization, stop word removal, and stem extraction, to obtain a training data set:

[0027] s1.1, Text standardization: All characters in the text are processed to make the format uniform and the content simplified, including converting all uppercase letters in the text to lowercase letters, removing punctuation marks in the text, removing or replacing non-alphabetic characters, and expanding abbreviations.

[0028] s1.2. Remove stop words: Remove common words that are considered useless for analysis in text processing, such as "the", "is", and "in", reduce redundant information, and retain words that have a greater impact on semantics.

[0029] s1.3, Stemming: restore words to their basic stem form, removing affixes such as "-ing" and "-ed" so that words with the same root are considered the same word.

[0030] Step 2: Extract the features of each sample in the training data set, including VSM similarity rVSM(b,s), collaborative filtering score cf(b,s), stack trace score tr(b,s), cyclomatic complexity cc(s), repair frequency ff(b,s), and repair time interval fr(b,s), perform vectorization processing and splicing to obtain the feature vector of the sample. :

[0031] s2.1, VSM similarity rVSM(b,s): used to measure the text similarity between the defect report b and the source code file s. TF-IDF (Term Frequency-Inverse Document Frequency) is used to convert the text into a vector, and then the cosine similarity in the vector space is calculated:

[0032] in and are the vector representations of bug reports and source code files, respectively.

[0033] s2.2, collaborative filtering score cf(b,s): used to measure the text of the defect report b and all report summaries related to the source code file s before the defect report b Similarity:

[0034] s2.3, stack trace score tr(b,s): used to evaluate the correlation between the stack trace information stack trace in the defect report b and the source code file s. The stack trace records the function and method chain called when the program crashes. The stack frame is usually recorded in a specific format, such as: at package_name.class_name.method_name (file_name.java:line_number | Native Method | Unknown Source), where file_name.java represents the file name and line number where the defect occurs. These file names are checked through the file name of the project, and the stack frames that do not belong to the project code base are deleted. In this way, the wrong file name and the stack frames of the external third-party library can be filtered out. Native Method represents the method implemented by the JVM. This type of method does not belong to the source file that needs to be located, so it can be directly filtered out. UnknownSource represents the source file that lacks debugging information. Since the public class name and the source file name in Java are the same, it is possible to check whether the class name matches the project file name from the left side of the stack frame. If a match is found, the class name is used as the file name of the Unknown Source stack frame. After extracting and processing the stack frame information through regular expressions, the ranking of each source code file in the stack trace is scored. The ranking of the source code file s in the stack trace The closer it is to the front, the more likely it is to contain a defect and the higher the score should be:

[0035] s2.4, Cyclomatic complexity cc(s): It indicates the number of different execution paths caused by control flow statements in the source code file s. It is an indicator to measure the complexity and quality of the code. The higher the cyclomatic complexity cc(s), the greater the logical complexity of the code, and the higher the potential defect risk may be:

[0036] Where E is the number of edges in the code, representing the connections between different code blocks in the control flow graph, and N is the number of nodes, representing independent code blocks or branch points in the code.

[0037] s2.5, repair frequency ff(b,s): indicates the number of times the source code file s was repaired before processing the current defect report b , the more times the file is repaired, the more likely it is to have problems. Therefore, the repair frequency can be used as a reference to measure whether the source file is likely to contain defects again:

[0038] s2.6, Repair time interval fr(b,s): It indicates the reciprocal of the time between the current defect report b and the last repair time of the source code file s. The shorter the time interval, the more likely it is that the source file has been repaired recently and there may still be defects. Therefore, the longer the reciprocal of the repair time interval, the greater the possibility that the source file will have problems again:

[0039] in Indicates the submission time of defect report b. Indicates the time when the source code file s was last repaired.

[0040] s2.7. Concatenate the features calculated from s2.1 to s2.6 to get the feature vector of the source code file s :

[0041] Step 3: Based on feature intersection and KAN network, calculate the similarity score between the defect report b and the source code file s:

[0042] s3.1, such as Figure 2 As shown, the feature vector of the sample Input into the continuous N-layer cross layer, perform feature cross-pollination on different features in the vector, and explore the hidden relationship between features. The output of the n+1th cross layer for:

[0043] in, , = , Represents the output of the nth cross layer Represents the Hadamard product, which is the multiplication of elements in corresponding positions in two matrices. , are the weight matrix and bias vector of the n+1th cross layer, Initially set to zero, Use Xavier normal initialization:

[0044] in, is the number of input units, that is, the dimension of the input received by the current layer, is the number of output units, that is, the dimension of the output of the current layer.

[0045] s3.2, such as Figure 3 As shown, the output of the last cross layer is As the input of the KAN network, the target function is fitted by learning a parameterized nonlinear activation function to capture high-order feature interaction information.

[0046] The KAN network includes M KAN layers, each of which is defined as a set of one-dimensional function matrices The input dimension is , the output dimension is , , , Each are all trainable one-dimensional functions, parameterized by using B-spline curves, and each B-spline curve has learnable parameters. In the m+1th layer, the activation value of the i-th neuron is is the activation value of all neurons in the previous layer The sum calculated by the activation function:

[0047] Then the output of the m+1th KAN layer is for:

[0048] Finally, the outputs of all KAN layers are combined as the final output of the KAN network :

[0049]

[0050] By constructing a multi-layer B-spline function network to approximate complex functions, although it will increase the depth and complexity of the network, the KAN network can approximate high-dimensional functions through meticulous grid division without being affected by the curse of dimensionality.

[0051] In order to reduce the storage requirements and computational burden of the model, L1 regularization is used to promote the weight sparsity of the KAN network, push the weight value to shrink to zero, improve the generalization ability of the model, and reduce the risk of overfitting. After sparsification, pruning technology is further used to remove unnecessary connections and neurons, that is, positions with zero weights, such as Figure 4As shown in the figure, the KAN network can overcome the dimensionality curse problem in high-dimensional space, more accurately capture and adapt to the changes of complex functions, and better capture the complex high-order feature interaction information in defect location.

[0052] s3.3、The output results of KAN network Input into the fully connected layer to obtain the final similarity score between the defect report b and the source code file s :

[0053] in is the weight matrix of the fully connected layer, is the bias term.

[0054] Step 4: The final similarity score calculated according to step 3 Sort the source code files from large to small. The higher the ranking, the greater the possibility that the source code file contains defects.

[0055] In order to verify the effectiveness of this method, we selected convolutional neural network CNN and feature cross network DCN and ResNet, which have excellent performance in the field of feature cross, to conduct comparative experiments with this method on the tomcat dataset. Top-N, MAP and MRR were selected as evaluation indicators for the experimental results. Among them, Top-N represents the proportion of defective files that the model can correctly predict in the defect location task and rank in the top N. The higher the proportion, the better the effect of the model; MAP represents the average accuracy of the model in prediction, reflecting the accuracy of the model in the entire ranking list; MRR represents the reciprocal average ranking of the first related file predicted by the model on the test set, reflecting the accuracy of the model in locating the most likely defective file. The results are shown in Table 1:

[0056] Table 1

[0057] The results show that the results of DCN and ResNet in Top-N, MAP and MRR are much higher than those of CNN, proving that the feature cross network can indeed significantly improve the defect location effect. Compared with DCN and ResNet, two typical feature cross defect location methods, this method has further improved in various indicators, indicating that this method can more accurately capture and adapt to the changes of complex functions in high-dimensional space, so as to find relevant defect files more accurately and quickly.

[0058] The method is also compared with methods that use different features for defect localization on the Tomcat dataset. The results are shown in Table 2. LR and BRTracer only use data features, while LR+WR, DeepLoc, DreamLoc, and BugRadar additionally use structural semantic features:

[0059] Table 2

[0060] Experiments show that this method performs well in defect location and is superior to most existing methods. Compared with DreamLoc, which has the best results, the iterative training time of the two methods is shown in Table 3:

[0061] Table 3 method Training time per iteration (min) DreamLoc 21 Methods 1.7

[0062] Since this method only uses data features, while DreamLoc also calculates the structural semantic relevance between the defect report and the source code, its location time is greatly increased. Therefore, compared with DreamLoc, this method has similar location performance, but has a significant advantage in computational efficiency. It can accurately and quickly locate defects with a small amount of information, which is especially suitable for critical business application scenarios with strict time requirements.

Claims

1. A software defect location method based on feature intersection and KAN, characterized by: The specific steps include: Step 1: Obtain the original defect report b and source code file s, perform preprocessing, and obtain a training data set; Step 2: Extract multiple data features of each sample in the training data set, perform vectorization processing and splicing, and obtain the feature vector of the source code file s ; Step 3: The feature vector of the sample Input into N consecutive cross layers, and then the output of the last cross layer As the input of KAN network Finally, the output of the KAN network is input into the fully connected layer to obtain the final similarity score between the defect report b and the source code file s. ; Step 4: The final similarity score calculated according to step 3 Sort the source code files from large to small. The higher the ranking, the greater the possibility that the source code file contains defects.

2. The software defect location method based on feature intersection and KAN as claimed in claim 1, characterized in that: The preprocessing in step 1 includes text normalization, stop word removal, and stemming.

3. The software defect location method based on feature intersection and KAN as claimed in claim 1, characterized in that: The data features of the sample include VSM similarity rVSM(b,s), collaborative filtering score cf(b,s), stack trace score tr(b,s), cyclomatic complexity cc(s), repair frequency ff(b,s), and repair time interval fr(b,s).

4. A software defect location method based on feature intersection and KAN as claimed in claim 3, characterized in that: s2.1, VSM similarity ,in and They are the vector representations of the bug report and source code file, respectively; s2.

2. Collaborative filtering score , represents the summary of all reports related to source code file s before defect report b; s2.3, stack trace score , where stack trace represents stack trace information, Indicates the rank of source code file s in the stack trace; s2.4, Cyclomatic Complexity , where E is the number of edges in the code and N is the number of nodes; s2.5, Repair frequency , Indicates the number of times the source code file s was fixed before processing the current defect report b; s2.6, Repair time interval ,in Indicates the submission time of defect report b. Indicates the time when the source code file s was last repaired.

5. The software defect location method based on feature intersection and KAN as claimed in claim 3, characterized in that: The feature vector of the source code file s .

6. The software defect location method based on feature intersection and KAN as claimed in claim 1, characterized in that: The cross layer includes N layers for processing the feature vector The different features in the cross layer are cross-linked to explore the hidden relationship between the features. The output of the n+1 cross layer for: ; in, , = , Represents the output of the nth cross layer; , are the weight matrix and bias vector of the n+1th cross layer, Denotes the Hadamard product.

7. The software defect location method based on feature intersection and KAN as claimed in claim 6, characterized in that: Will Initially set to zero, Use Xavier normal initialization: ; in, is the number of input units, that is, the dimension of the input received by the current layer, is the number of output units, that is, the dimension of the output of the current layer.

8. The software defect location method based on feature intersection and KAN as claimed in claim 1, characterized in that: The KAN network includes M KAN layers, each of which is defined as a set of one-dimensional function matrices The input dimension is , the output dimension is , , , Each are all trainable one-dimensional functions; in the m+1th layer, the activation value of the i-th neuron is the activation value of all neurons in the previous layer The sum calculated by the activation function: ; The output of the m+1th KAN layer for: ; Combine the outputs of all KAN layers as the final output of the KAN network : 。 9. A software defect location method based on feature intersection and KAN as claimed in claim 1 or 8, characterized in that: L1 regularization is used to sparse the weights of the KAN network, pushing the weight values ​​toward zero, and then pruning techniques are used to further remove connections or neurons with zero weights.

Citation Information

Patent Citations

  • Software defect positioning method based on deep neural network

    CN110109835A

  • Software defect positioning method combining sentence embedding and particle swarm optimization algorithm

    CN112286799A

  • Supervised multi-view software defect prediction method and system based on auto-encoder

    CN114371987A

  • Software defect positioning method based on CNN model and domain features

    CN115617689A

  • Software defect positioning method based on feature crossing and structural semantic information matching

    CN117851216A

Cited By

  • Defect fault positioning method for ship navigation detection system

    CN122009431A

  • A defect fault locating method for a ship navigation detection system

    CN122009431B