Software quality dynamic measurement and uncertainty quantification method based on Bayesian-KAN-ODE series architecture
By using the Bayesian-KAN-ODE cascade architecture, the problems of parameter uncertainty and dynamic characteristics in software quality measurement are solved, dynamic measurement and uncertainty quantification are realized, and the robustness and interpretability of the model are improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-14
- Publication Date
- 2026-03-27
AI Technical Summary
Existing software quality measurement methods rely on deterministic models, which cannot effectively quantify parameter uncertainty and input data noise, and cannot adapt to the dynamic characteristics and complex nonlinear relationships in the software development phase.
A Bayesian-KAN-ODE concatenated architecture is adopted, and the Kolmogorov-Arnold network is used for quality feature extraction and uncertainty quantification. The continuous evolution of weights is described by a neural ordinary differential equation model, and a predicted distribution of software quality is generated.
It achieves dynamic measurement and uncertainty quantification of software quality, can adapt to changes in the software development stage, improves the robustness and interpretability of the model, and provides guidance for quality improvement.
Smart Images

Figure CN121743166A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of software quality measurement technology, and in particular relates to a method for dynamic measurement and uncertainty quantification of software quality based on a Bayesian-KAN-ODE concatenated architecture. Background Technology
[0002] Software quality metrics are a core research area in software engineering, aiming to evaluate and predict the internal and external attributes of software through quantitative indicators, providing a basis for developing high-quality software. Since the concept of software metrics was proposed, scholars at home and abroad have conducted extensive research on code size, structural complexity, and object-oriented characteristics, forming structured program measurement methods including Lines of Code (LOC), McCabe cyclomatic complexity, and Function Point Analysis (FPA). For object-oriented software, Chidamber and Kemerer proposed the CK metric set, covering six key metrics such as weighted method count, inheritance tree depth, and class coupling, laying a systematic foundation for the quality assessment of object-oriented software. At the model level, class diagrams, as important UML diagrams for depicting software structure, have also seen continuous exploration in complexity measurement methods, such as Marchesi's seven metrics based on inheritance and dependency, Genero's fourteen extended class diagram metrics, and Zhou Yuming's class diagram measurement method based on information entropy. These traditional measurement methods can reflect the quality characteristics of software, such as size, coupling, and cohesion, to a certain extent in practical applications, providing a basic framework for software quality evaluation.
[0003] However, existing software quality measurement methods still have several limitations. First, most existing methods rely on deterministic models, providing only point estimates of quality scores and lacking quantification mechanisms for parameter uncertainty, input data noise, and confidence intervals of prediction results. This results in insufficient robustness when data is scarce or measurement errors exist in the indicators. Second, existing methods are mostly static measures, typically using fixed weights for comprehensive evaluation, failing to effectively characterize the dynamic characteristics of software quality evaluation weights evolving with the development stage. Although time-series models such as recurrent neural networks can handle stage changes, their discretized time-step modeling method struggles to describe the continuous evolution trajectory of weights and cannot adapt to the uncertainty of development stage transition times and evolution rates. Furthermore, traditional methods suffer from low expressive efficiency and poor interpretability when capturing complex nonlinear relationships between indicators. For example, multilayer perceptrons rely on fixed activation functions, resulting in low parameter efficiency, and their "black box" nature makes them difficult to guide specific quality improvements. Therefore, a new software quality measurement method that can simultaneously handle uncertainty quantification, dynamic evolution modeling, and the representation of complex nonlinear relationships is urgently needed. Summary of the Invention
[0004] To address the aforementioned technical problems, this invention proposes a dynamic measurement and uncertainty quantification method for software quality based on a Bayesian-KAN-ODE concatenated architecture, thereby resolving the issues present in the prior art.
[0005] To achieve the above objectives, this invention provides a method for dynamic measurement and uncertainty quantification of software quality based on a Bayesian-KAN-ODE concatenated architecture, comprising: S1: Dimensionless processing is performed on the original values of the quality indicators of the software object to be evaluated to obtain the optimal membership data and determine the initial weight of each quality indicator. S2: Input the preferred membership data into the Kolmogorov-Arnold network, extract quality features through the network structure with learnable spline functions, and perform probabilistic modeling of the network parameters based on variational inference to quantify the uncertainty in the feature extraction process, and output the quality feature vector and its uncertainty measure. S3: Input the initial weights and the quality feature vector into the ordinary differential equation model of the God, and obtain the dynamic weight vector by solving the ordinary differential equation describing the continuous evolution of the weights over time; S4: After the model training is completed, a concatenated architecture is constructed using the Kolmogorov-Arnold network and the neural ordinary differential equation model. Forward propagation is performed based on the dynamic weight vector and the quality feature vector. The predicted distribution of software quality is generated through Monte Carlo sampling, and the predicted mean and uncertainty quantification results are output.
[0006] Preferably, in step S1, the original values of the quality indicators are dimensionless, and the values are calculated using a preferred membership function based on the maximum and minimum values of the original values of each indicator.
[0007] Preferably, in step S1, the initial weights of each quality index are determined using the entropy method.
[0008] Preferably, in step S2, the learnable spline functions in the Kolmogorov-Arnold network are expanded using B-spline basis functions.
[0009] Preferably, in step S2, probabilistic modeling of network parameters is performed based on variational inference, specifically including: setting a prior distribution for network parameters, introducing a variational distribution to approximate the posterior distribution, and optimizing by maximizing the lower bound of evidence.
[0010] Preferably, the variational distribution is approximated by a mean field, and the gradient is calculated using a reparameterization technique.
[0011] Preferably, in step S3, the ordinary differential equation describing the continuous evolution of the weights over time is defined as: ; Where w(t) is the weight vector at time t, z is the quality feature vector extracted by Bayesian KAN, and g is the weight evolution function parameterized by the neural network. represents the parameters of the ordinary differential equation network.
[0012] Preferably, the input to the evolution function includes the current weight vector, the quality feature vector, and the time code.
[0013] Preferably, step S3 further includes: performing a Softmax transformation on the weight vector obtained by solving the ordinary differential equation to obtain a normalized dynamic weight vector.
[0014] Preferably, in step S4, outputting the uncertainty quantification result includes: calculating the prediction variance and the confidence interval based on the prediction mean and prediction variance.
[0015] Compared with the prior art, the present invention has the following advantages and technical effects: This invention constructs a unified end-to-end model by organically combining a Kolmogorov-Arnold network based on learnable spline functions and variational inference, a neural ordinary differential equation model based on continuous-time modeling of ordinary differential equations, and a Monte Carlo sampling and cascade architecture capable of generating predictive distributions. In a single forward propagation, this model can quantify the uncertainty of parameters and predictions through a Bayesian framework, capture the dynamic evolution of weights through continuous dynamic equations, and characterize the complex nonlinear mapping between indicators through a highly expressive network. This systematically solves the limitations of traditional methods that isolate and process single problems.
[0016] This invention inputs initial weights and quality feature vectors into a neural ordinary differential equation model and solves the ordinary differential equation describing the continuous evolution of the weights over time. This allows the weights of evaluation metrics to change continuously, smoothly, or adaptively according to the development process, rather than remaining fixed. This method overcomes the shortcomings of static weighting methods in reflecting changes in focus at different development stages and avoids the inflexibility of discrete-time step models in dividing development stages, making the quality measurement model more closely aligned with the actual lifecycle of software projects.
[0017] In the feature extraction stage, this invention incorporates parameter uncertainty into the model itself by performing probabilistic modeling of network parameters based on variational inference. In the final prediction stage, Monte Carlo sampling is used to generate a prediction distribution, enabling the output of a complete prediction including the prediction mean and quantified uncertainty. This allows the model to automatically increase the range of prediction uncertainty when data is scarce or noisy, avoiding overconfident misjudgments, providing a quantitative basis for risk assessment, and enhancing the model's robustness.
[0018] This invention employs a Kolmogorov-Arnold network with learnable spline functions for feature extraction. The model can concretize the mapping relationship between each input quality indicator and its internal features into a visual spline function curve. This allows developers to intuitively understand the specific impact patterns of each indicator on the final quality score, thereby tracing the root causes of quality problems and overcoming the "black box" limitation of traditional deep learning models in the field of software quality measurement. Attached Figure Description
[0019] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings: Figure 1 This is a flowchart of a software quality dynamic measurement and uncertainty quantification method based on a Bayesian-KAN-ODE concatenated architecture, according to an embodiment of the present invention. Detailed Implementation
[0020] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0021] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.
[0022] Example 1 like Figure 1As shown, addressing the challenges of uncertainty quantification, dynamic evolution modeling, and nonlinear feature representation in software quality metrics, this embodiment provides a dynamic measurement and uncertainty quantification method for software quality based on a Bayesian-KAN-ODE concatenated architecture. First, a software quality evaluation system is constructed using fuzzy matter-element theory to resolve the fuzziness and incompatibility issues of evaluation indicators. Second, a Bayesian KAN network is used for nonlinear feature extraction and mapping of quality indicators, capturing the complex relationships between indicators through learnable spline functions, and variational inference is used to quantify parameter uncertainty. Then, Neural ODE is introduced to model the continuous-time evolution of weights, describing the dynamic changes of evaluation weights with the development stage through differential equations. Finally, Monte Carlo sampling is used to generate a prediction distribution, outputting the quality metric value and its confidence interval. This invention, through the Bayesian-KAN-ODE concatenated architecture, achieves interpretability of feature extraction, continuity of temporal modeling, and accurate quantification of uncertainty, providing a dynamic, robust, and interpretable solution for software quality metrics. Specifically, it includes: S1: Dimensionless processing is performed on the original values of the quality indicators of the software object to be evaluated to obtain the optimal membership data and determine the initial weight of each quality indicator. Furthermore, in step S1, the original values of the quality indicators are dimensionless, and the values are calculated using the preferred membership function based on the maximum and minimum values of the original values of each indicator.
[0023] Furthermore, in step S1, the initial weights of each quality index are determined using the entropy method.
[0024] Specifically, the establishment of a fuzzy matter-element evaluation system includes: (1) Matter-element analysis is an emerging discipline that studies the laws and methods for solving incompatible problems. In matter-element analysis, the things being described are... (Evaluation object, i.e., software class diagram), characteristics of things (Evaluation index) and the corresponding values of the feature values (Evaluation indicators and their corresponding values) are combined to form a set of basic elements describing things. Note: To avoid variable confusion, this article uses... Represents the original value. Indicates the degree of preferential membership.
[0025] If the things being described have Features Its corresponding value is Then it is called for 3D fuzzy matter element. a thing Dimensional elements combine together to form a thing 3D composite fuzzy matter element, denoted as The composite fuzzy matter-element is represented in matrix form: In formula (1), For the first One thing, among which ; For the first thing One feature, among which ; For things The The values corresponding to each feature. The first row... There are several evaluation indicators, the first column is... Software class diagram identifier, matrix elements Indicates the first The class diagram in the first... The values of each indicator.
[0026] (2) Dimensionless processing of evaluation indicators; In the process of software quality evaluation, the evaluation indicators involved often have different dimensions and orders of magnitude. In order to comprehensively compare indicators with different dimensions, it is necessary to perform dimensionless processing on the values of these evaluation indicators.
[0027] First, determine the number The maximum and minimum values of the corresponding quantities for each feature: For the inverse index (the smaller the better), the dimensionless formula is: In formula (4), For the first The first thing The dimensionless result of the corresponding values of each feature is called the preferred membership degree, and its value range is... . To evaluate the first Each feature corresponds to a value in all The maximum value in each class diagram. This corresponds to the minimum value. When hour, This indicates that the indicator has reached its optimal state; when hour, , indicating that the indicator is the worst.
[0028] After the original values are dimensionlessized using formula (4), the optimal membership fuzzy matter-element matrix is obtained. : The preferred membership matrix in formula (5) This serves as the input data for subsequent deep learning models, providing standardized input features for the Bayesian KAN quality feature extraction module. For a single class graph... Its preferred membership vector is denoted as This vector will be used as the input to the model.
[0029] (3) Determine the initial weights based on the entropy method.
[0030] In the software quality evaluation process, determining the weights is crucial and directly affects the final evaluation results. This invention uses the entropy method to calculate the initial weights. This serves as the starting point for subsequent Neural ODE dynamic optimization.
[0031] For the obtained Each sample class diagram The data matrix of each evaluation indicator is first standardized: In formula (6), For standardized data, to meet This standardization method ensures the comparability and numerical stability of the data.
[0032] According to the definition of information entropy, the first The information entropy value of the item indicator is: The constant in formula (7) With the number of samples in the system Related, commonly used This makes information entropy .
[0033] Define the information utility coefficient: No. The initial weights of the indicators are: Obtain the initial weight vector Satisfying the normalization constraint conditions and This initial weight vector is calculated using formulas (6)-(9) and will serve as the initial state of the NeuralODE weight evolution module. , used in formula (26).
[0034] S2: Input the preferred membership data into the Kolmogorov-Arnold network, extract quality features through the network structure with learnable spline functions, and perform probabilistic modeling of the network parameters based on variational inference to quantify the uncertainty in the feature extraction process, and output the quality feature vector and its uncertainty measure. Furthermore, in step S2, the learnable spline functions in the Kolmogorov-Arnold network are expanded using B-spline basis functions.
[0035] Furthermore, in step S2, probabilistic modeling of network parameters is performed based on variational inference, specifically including: setting a prior distribution for network parameters and introducing a variational distribution to approximate the posterior distribution, and optimizing by maximizing the lower bound of evidence.
[0036] Furthermore, the variational distribution is approximated by a mean field, and the gradient is calculated using a reparameterization technique.
[0037] Specifically, step S2 includes: (1) The basic principle of the Kolmogorov-Arnold network; The Kolmogorov-Arnold network is based on the Kolmogorov-Arnold representation theorem, which states that any multivariate continuous function can be represented as a superposition and combination of single-variable continuous functions. Specifically, for a function defined in... Arbitrary multivariate continuous functions on a 1D unit cube ,in Given an input vector, there exist a finite number of univariate continuous functions such that: in and All are univariate continuous functions. This theorem provides a solid theoretical foundation for the design of KAN. Note: The input vector in formula (10) The preferred membership vector (from formula (5)) is where Indicates the first The preferred membership values of each quality indicator. For a specific class diagram sample, its preferred membership vector. From the optimal membership matrix The row vector extracted from (Formula (5)) is the first row vector. element It is obtained by dimensionless processing of formula (4).
[0038] KAN replaces the fixed activation function of the traditional multilayer perceptron with a learnable spline function, moving the activation function from the nodes to the edges, where each edge is a learnable univariate function. For the input vector... (From the preferred membership vector of formula (5), the first of KAN) layer to the first The transformation of a layer is defined as follows: in For the first The first layer The output of each neuron For the first The first layer The output of each neuron A learnable univariate function that connects the two. For the first The number of neurons in the layer. For the input layer, That is, the preferred membership vector of a single class graph (from formula (5)).
[0039] Each learnable function Expand using B-spline basis functions: In formula (12), For the first One B-spline basis function, These are the learnable spline coefficients. The subscripts have the following meanings: superscript... Represents the layer index of the network (the first layer) layer to the first Layer connections), subscript Indicates the first The first layer One neuron, subscript Indicates the first The first layer One neuron, subscript Indicates the index of the B-spline basis function ( ). The order of the spline (usually taken as...) (i.e., cubic B-spline). Therefore... The only thing that was determined from the first Layer The first neuron to the second Layer On the edge of the nth neuron, the nth The coefficients of a B-spline basis function. By learning the set of spline coefficients... KAN can adaptively adjust the function shape of each edge, thereby capturing the complex nonlinear relationships between input features.
[0040] (2) Variational inference of Bayesian KAN; To quantify the uncertainty of the model, this invention introduces Bayesian inference into the parameters of KAN. Let all the learnable parameters of KAN be denoted as . Including the set of spline coefficients And other possible parameters. Within the Bayesian framework, parameters... It is no longer a definite value, but rather follows a certain probability distribution.
[0041] First, the parameters Specify prior distribution It is usually assumed that there is a Gaussian prior: in Let be the prior mean vector. Let be the prior covariance matrix. In practical applications, it is usually set to... , ,in For the prior standard deviation (e.g.) ), It is an identity matrix.
[0042] Given a training dataset ,in For the first The preferred membership vector of each class graph (from formula (5)). This corresponds to its true quality metric. According to Bayes' theorem, the posterior distribution of the parameter is: For complex neural network models, marginal likelihood The integral of the a posteriori is usually impossible to compute analytically, so variational inference is used to approximate the posterior distribution. The core idea of variational inference is to introduce a parameterized variational distribution. To approximate the true posterior distribution By maximizing the lower bound of evidence (ELBO): The first term in formula (15) is the likelihood expectation, which measures the degree of fit of the model to the training data; the second term is the KL divergence between the variational distribution and the prior distribution, which plays a regularization role and prevents the model from overfitting.
[0043] The variational distribution uses a mean field approximation, assuming that the parameters are independent and that each parameter follows a Gaussian distribution: in These are variational parameters, including the mean and standard deviation of each parameter. Indicates the total number of parameters.
[0044] To compute the gradient of the lower bound of evidence, a reparameterization technique is employed. The parameter sampling process is rewritten as follows: Among the symbols This represents element-wise multiplication. Through this reparameterization, randomness can be reduced from... Transferred to This allows the gradient to pass through and Backpropagation.
[0045] (3) Forward propagation and quality feature extraction of Bayesian KAN.
[0046] The meaning of quality feature extraction: The Bayesian KAN feature extraction module receives the preferred membership vector. (Include Dimensionless values of several quality indicators are used to extract low-dimensional representations that represent the essential quality characteristics of software class diagrams through multi-level nonlinear transformations. These features comprehensively consider the complex interactions between various quality indicators, such as the synergistic effect of coupling and inheritance depth, the correlation pattern between method complexity and response set, and the dependency between cohesion and maintainability. Extracted features This will serve as a key input for subsequent weight evolution and quality prediction.
[0047] Given the input feature matrix (From the preferred membership matrix, derived from formula (5)), the forward propagation process of Bayesian KAN is as follows: The first step is to sample parameters from the variational posterior distribution. For the ... Second sampling, : in The optimal variational parameters obtained during training are (obtained through optimization using formulas (15)-(17)).
[0048] The second step is to sample each time. , execute KAN forward propagation.
[0049] Let the input layer be (From formula (5)), the first layer to the first The propagation formula for layers is: in The total number of layers in KAN. Defined by formula (12). After... After layer propagation, the output quality feature vector is .
[0050] The third step is to calculate the predicted mean and variance of the features.
[0051] right Feature vector obtained from sampling ,calculate: in This represents element-wise product. Mean It provides point estimates of quality characteristics, variance. The uncertainty (parameter uncertainty) in the feature extraction process is quantified. Feature mean. It will be used as input to the downstream Neural ODE module in Equation (24) for weight evolution modeling.
[0052] S3: Input the initial weights and the quality feature vector into the ordinary differential equation model of the God, and obtain the dynamic weight vector by solving the ordinary differential equation describing the continuous evolution of the weights over time; Furthermore, the input to the evolution function includes the current weight vector, the quality feature vector, and the time code.
[0053] Furthermore, step S3 also includes: performing a Softmax transformation on the weight vector obtained by solving the ordinary differential equation to obtain a normalized dynamic weight vector.
[0054] Specifically, step S3 includes: (1) The basic principle of the ordinary differential equation; Neural ODE is a novel deep learning architecture that treats discrete network layers as discretized samples of a continuous dynamical system. The core idea of Neural ODE is to directly model the continuous evolutionary process, describing the continuous evolution of the hidden states through ordinary differential equations: in for The hidden state at all times For the vector field function parameterized by the neural network, For network parameters, It is a continuous-time variable. Given an initial state. The time interval can be obtained by solving ordinary differential equations. status .
[0055] Neural ODE uses the adjoint method to compute gradients, requiring only the storage of initial and final states, resulting in constant memory consumption. (Adjoint state) The following adjoint equation is satisfied: By starting from time The inverse integral of the adjoint equation to time 1 It can efficiently calculate the gradient of parameters.
[0056] (2) Dynamic modeling of weight evolution; In software quality metrics, the weights of evaluation indicators dynamically change as the software development stage progresses. This invention uses Neural ODE to model the continuous-time evolution of these weights. Let the initial weights be... The weights are calculated using the entropy method through formulas (6)-(9). The evolution of the weights is described by the following ordinary differential equations: in This is the weight evolution function for parameterizing a neural network, describing the rate of change of the weights over time. The quality feature vector extracted for Bayesian KAN (from formula (20)) This information is used as fixed context information and input into the evolution function. represents the parameters of the ordinary differential equation network.
[0057] evolution function Designed as a multilayer perceptron (MLP) to capture the complex dynamics of weight evolution: In formula (25), the symbol This represents a vector concatenation operation. The input includes: the current weights. Quality characteristics (From formula (20)), time encoding and Time coding is used to capture the characteristics of periodic development phases, where . , , , For the weights and bias parameters of the MLP, For activation functions (usually chosen) ).
[0058] Weights at time The value can be obtained by numerically solving the ordinary differential equation. In practical calculations, the fourth-order Runge-Kutta method or the Dormand-Prince method is used. For initial value problems: in The entropy method calculation results are derived from formula (9). The Bayesian KAN feature extraction results from formula (20) can be used to obtain the time step. weight , where T represents the end time of the software development cycle (or the target prediction time).
[0059] To ensure that the weights satisfy the normalization and nonnegativity constraints, the ODE is obtained after solving the ODE. Then, a softmax transform is applied: The Softmax function maps any real vector to a probability simplex, resulting in a normalized weight vector. ,satisfy and To distinguish them, use This represents the normalized weights.
[0060] S4: Construct a cascaded architecture using the Kolmogorov-Arnold network and the neural network constant differential equation model. Perform forward propagation based on the dynamic weight vector and the quality feature vector. Generate the predicted distribution of software quality through Monte Carlo sampling and output the predicted mean and uncertainty quantification results.
[0061] Further, in step S4, the output uncertainty quantification result includes: calculating the prediction variance and the confidence interval based on the prediction mean and prediction variance.
[0062] Specifically, the Bayesian-KAN-ODE concatenated architecture proposed in this embodiment organically integrates three core modules, achieving end-to-end learning of software quality metrics. The overall architecture includes the following modules: (1) Input layer: Receives the preferred membership matrix (Formula (5)), dimension is ,in For the number of class diagrams, The number of evaluation indicators.
[0063] (2) Bayesian KAN quality feature extraction module: Nonlinear feature extraction is performed through learnable spline functions (formulas (11)-(12)) to output quality feature vector. (Formula (19)) and its uncertainty (Formula (21)).
[0064] (3) Neural ODE weight evolution module: with initial weights (Formula (9)) and characteristic mean (Equation (20)) is the input, and the dynamic weights are obtained by solving the ordinary differential equations (Equations (24)-(26)). (Formula (27)).
[0065] (4) Prediction module: Calculate quality metric values by combining quality features and weights.
[0066] (5) Output layer: Generates the predicted distribution and confidence interval.
[0067] The overall forward propagation process is detailed below: Step 1: Select the preferred membership matrix (Formula (5)) is input into the Bayesian KAN feature extraction module and executed. The mean of the quality characteristics is calculated using formulas (18)-(21) after the second Monte Carlo sampling. and variance .
[0068] Step 2: Set initial weights (Formula (9)), mean of quality characteristics (Formula (20)) and time-encoded input to the Neural ODE weight evolution module. Specifically, As initial conditions for differential equations (Formula (26)), As an evolution function The input is (Formula (25)). The normalized weights are obtained by solving Formulas (24)-(26) and then performing the Softmax transformation of Formula (27). .
[0069] Step 3: Calculate the weighted eigenvector. For the ... Feature vector of the second sampling (From formula (19)), calculate: in Represents element-wise product. Indicates time The normalized weight vector (from formula (27)).
[0070] Step 4: Generate quality metric predictions through fully connected layers. For the first... Second sampling: in This is the output layer weight matrix. This is the output layer bias scalar. From formula (28). That is, the first The comprehensive software quality metric corresponding to each sample.
[0071] In this embodiment, a joint loss function is designed to train the Bayesian-KAN-ODE concatenated architecture, taking into account data fitting, uncertainty quantification, and weight stability: Formula (30) consists of three parts: The first part is the data fitting loss, which measures the difference between the predicted and actual values, using the mean squared error (MSE) loss. A prediction distribution is generated through Monte Carlo sampling. Predicted value obtained from the second sampling (From formula (29)), calculate the predicted mean: The data fitting loss is defined as: in The number of training samples. For the first The true quality measure of a sample For the model to the first The predicted mean of each sample (from formula (31)).
[0072] The second part is the KL divergence loss, derived from the variational inference of Bayesian KAN (Equation (15)). For Gaussian priors... Gaussian variational posterior The KL divergence has a closed-form solution: in and For variational parameters (from formula (16)), The prior standard deviation (from formula (13)), This represents the total number of parameters.
[0073] The third part is the regularization loss, which prevents the weights from deviating excessively from their initial weights. Regularization: Formula (34) Penalty Dynamic Weight (From the solution of formula (26) and the initial weights) (Deviation from formula (9)). Hyperparameters and The contribution used to balance out various losses typically ranges from [value range missing]. , .
[0074] In this embodiment, the model training employs mini-batch stochastic gradient descent, using the Adam optimizer to update parameters. The complete training algorithm is as follows: Initialization phase: Variational parameters of Bayesian KAN (Formula (16)) is initialized to , ; Parameters of Neural ODE (Formula (25)) is initialized using Xavier; Output layer parameters (Formula (29)) uses random initialization; The learning rate is typically set to 0.001, using a learning rate decay strategy. Training cycle: For each training round, perform the following steps: (a) Forward Propagation: For each sample in the batch, perform the complete forward propagation process (steps 1-4, formulas (18)-(29)). During the training phase, to improve computational efficiency, fewer Monte Carlo sampling times are typically used (e.g., ), calculate the predicted mean (Formula (31)) is used as the input to the loss function.
[0075] (b) Calculate the loss: Combine the three parts of the loss according to formula (30), including the data fitting loss of formula (32). KL divergence loss of formula (33) And the regularization loss of formula (34) .
[0076] (c) Backpropagation to calculate gradient: For the Bayesian KAN module: calculate the gradient of the variational parameters based on the principle of variational inference, and estimate the gradient expectation using Monte Carlo sampling; For the Neural ODE module: the gradient is calculated using the adjoint method, and the adjoint equation is defined according to formula (23); For output layer parameters: the gradient is calculated directly through automatic differentiation.
[0077] (d) Gradient clipping and parameter update: Calculate the gradient If the gradient norm exceeds a threshold (usually 5.0), gradient clipping is performed; all parameters are updated using the Adam optimizer.
[0078] Early stopping mechanism: The model is evaluated on the validation set and the validation loss is calculated every certain number of rounds. When the validation loss no longer decreases after a certain number of rounds (e.g., 10 rounds), the early stopping mechanism is triggered. The model parameters with the best performance on the validation set are saved as the final model, including the optimal variational parameters. Optimal ODE parameters and optimal output layer parameters , .
[0079] In this embodiment, Bayesian KAN employs variational inference for parameter learning, its core being the approximation of the posterior distribution through optimized evidence lower bound (ELBO). According to Bayes' theorem, the posterior distribution of the parameters... (Formula (14)) and likelihood and prior The relationship of (Formula (13)) is: Introducing variational distribution After formula (16), the log-marginal likelihood can be decomposed into: Since the KL divergence is non-negative, there is a lower bound for the evidence. (Defined in Equation (15)) is the lower bound of the logarithmic marginal likelihood. Maximize This is equivalent to minimizing the KL divergence, thereby making the variational distribution... Approaching the true posterior .
[0080] The reparameterization technique (Equation (17)) removes randomness from the parameters Transfer to auxiliary noise variable This allows the gradient to propagate back through a deterministic path. Specifically, for a Gaussian variational distribution, parameter sampling can be expressed as equation (17). Thus, the lower bound of evidence for the variational parameters... and The gradient can be efficiently calculated using automatic differentiation: This reparameterization method (combined with formula (17)) ensures low variance of gradient estimation, enabling variational inference to converge stably.
[0081] Neural ODE models weight evolution by solving ordinary differential equations (Equations (22) and (24)), and its numerical stability depends on the choice of ODE solver. This invention employs the adaptive step-size Dormand-Prince method, which combines fourth-order and fifth-order Runge-Kutta formulas to estimate the local truncation error by comparing the results of the two orders.
[0082] For ordinary differential equations (Formula (24)), the Dormand-Prince method at time step The update formula within is: in For time step, For the intermediate slope: coefficient , , Determined by the Butcher table of the Dormand-Prince method. The local truncation error is estimated as follows: in These are the coefficients of the fifth-order formula. If If the tolerance threshold is exceeded, the step size is reduced. Recalculate; otherwise, accept the current step and adjust the step size for the next step based on the error estimate.
[0083] This adaptive step-size strategy (combined with formulas (39)-(42)) ensures the accuracy of the numerical solution while avoiding the numerical instability that may result from the fixed step-size method. For rigid ordinary differential equations, the Dormand-Prince method can automatically adjust the step size to maintain stability.
[0084] Gradient flow analysis of end-to-end training End-to-end training of the Bayesian-KAN-ODE concatenated architecture involves complex gradient backpropagation. Gradient flow from the loss function... (Formula (30)) passes through the output layer, Neural ODE, Bayesian KAN, and finally reaches the input layer.
[0085] For the Neural ODE module, the gradient is calculated using the adjoint method (Equation (23)). The adjoint state is defined. It satisfies the adjoint equation (23). By starting from time... Inverse integration to time 1 The gradient of the initial weights can be obtained: parameter The gradient (from formula (25)) is: For the Bayesian KAN module, the gradient needs to be propagated through the expectation of Monte Carlo sampling. For variational parameters... and (From formula (16)), the gradient is: in For the first The loss corresponding to each sampling (from Equation (18)). These gradients can be efficiently computed using reparameterization techniques (Equations (17) and (37)-(38)).
[0086] To prevent gradient vanishing or gradient exploding, this invention employs gradient clipping techniques. Specifically, the gradient is calculated... Norm: if (usually taken) Then the gradient is scaled as follows: This ensures that the gradient norm does not exceed a preset threshold, guaranteeing the stability of training.
[0087] In this embodiment, after training is completed, for a new class graph to be evaluated, the following steps are performed to perform quality measurement and uncertainty quantification: Step 1: Feature Extraction. Extract the features from the class graph to be evaluated. Each quality indicator is used to construct the original data vector. (See formula (1)).
[0088] Step 2: Dimensionless processing. Use the normalization parameters from training (in formulas (2)-(3)). and ), calculate the preferred membership vector according to formula (4) (See formula (5)).
[0089] Step 3: Monte Carlo sampling. From the learned variational posterior... Medium sampling Next (such as) The parameter set is obtained according to formula (18). .
[0090] Step 4: Complete forward propagation. For each sample... , : The quality feature vector is calculated using Bayesian KAN: according to formulas (11)-(12) and formula (19), ; The dynamic weights are obtained by solving the Neural ODE: the differential equations are solved according to formulas (24)-(26), and then the Softmax transformation is performed according to formula (27). ; Calculate the weighted features: According to formula (28), ; Generate predicted values: According to formula (29), ; Step 5: Calculate the forecast statistic. Calculate the forecast mean according to formula (31). ; Calculate the prediction variance: Calculate the confidence interval: Assuming the prediction distribution follows a normal distribution, then The confidence interval at the confidence level is: in For standard normal distribution Quantiles. For example, for a 95% confidence interval, , .
[0091] Step 6: Output the evaluation report. Software quality metrics results include: Posterior predicted mean The overall quality score of the class diagram, typically ranging from [value range missing]. or This value takes into account the impact of parameter uncertainty; Uncertainty estimation The degree of uncertainty in the prediction. The smaller the value, the more reliable the prediction. This value quantifies the impact of model parameter uncertainty propagating to the prediction results. Confidence interval The upper and lower bounds of the predicted value provide a risk assessment, reflecting the range of the predicted distribution at a given confidence level.
[0092] In this embodiment, the weight evolution trajectory analysis includes: Neural ODE provides a trajectory of the continuous evolution of weights over time, which can be used to analyze the changes in the importance of various indicators at different development stages. For time intervals... Uniform sampling At that moment (like ), for each moment Solve the ordinary differential equations using formulas (24) and (26): Then, the normalized weights are obtained through the Softmax transformation of formula (27). .
[0093] The weight evolution trajectory is visualized as The first curve, Curve Description Indicators weight Changes over time. By analyzing these curves, we can identify: Critical development phases: Moments of dramatic weight changes correspond to transition points in the development phase; Key quality indicators: Indicators with consistently high weighting are continuously critical quality factors; Evolutionary pattern: The trend of increasing or decreasing weight reflects the changing pattern of indicator importance; For example, if the weight of a certain indicator is in the initial stage ( ) higher in the later stages ( A decrease in the weight of an indicator indicates that it was more important in the early stages of development, such as demand-related indicators; conversely, if the weight of an indicator increases in the later stages, it indicates that it is more critical in the later stages of maintenance, such as maintainability-related indicators.
[0094] In this embodiment, feature importance analysis specifically includes: The spline functions of Bayesian KAN provide interpretability of features. For the th Input metrics (From formulas (4)-(5)), its corresponding spline function (Defined in Equation (12)) describes how this metric affects feature extraction. Visualization is used to illustrate this. The shape can be understood as follows: Nonlinear relationship: if It is non-linear, indicating that the relationship between the indicator and quality is non-linear; Sensitive range: A range of drastic changes indicates the area within which the indicator has a significant impact on quality; Threshold effect: When an inflection point exists, it indicates that the influence of the indicator changes significantly after it exceeds a certain threshold; This interpretability provides clear guidance for software quality improvement. For example, if the spline function of a coupling index is found to rise sharply in the high-value region, it indicates that reducing coupling can significantly improve software quality.
[0095] The beneficial effects of this embodiment: The proposed software quality uncertainty measurement method based on Kolmogorov-Arnold network, neural ordinary differential equations, and Bayesian deep learning has the following beneficial effects: First, by integrating three cutting-edge technologies—KAN, Neural ODE, and Bayesian deep learning—an innovative Bayesian-KAN-ODE cascade architecture was constructed, achieving the organic unity of feature extraction (Formula (19)-(21)), weight evolution (Formula (24)-(27)), and uncertainty quantification (Formula (49)-(50)), providing a brand-new technical path for software quality measurement.
[0096] Second, the learnable spline function of KAN (Formula (12)) is used for quality feature extraction. Compared with the traditional MLP, it has higher parameter efficiency and stronger nonlinear expression ability. At the same time, the visualization characteristics of the spline function provide intuitive interpretability, which helps to understand the influence mechanism of quality indicators.
[0097] Third, the continuous time evolution of the weights in Neural ODE modeling (formulas (24)-(27) and (37)) is introduced, which breaks through the limitations of the traditional static weight method. It can describe the dynamic change of the evaluation weights with the software development stage, quantify the uncertainty of time evolution, and is more in line with the actual characteristics of the software development process.
[0098] Fourth, Bayesian deep learning is used to quantify uncertainty (Formulas (14)-(21)). By learning the posterior distribution of the parameters through variational inference, the confidence interval of the prediction is provided (Formula (32)). The uncertainty of the parameters is quantified, and good robustness can still be maintained in the case of scarce data or missing indicators.
[0099] Fifth, the algorithm process is complete and clear, forming a closed loop from data preprocessing (formulas (1)-(9)), model training (formulas (18)-(51)) to quality evaluation (formulas (30)-(37)), which has good implementability and scalability and is suitable for software projects of different sizes and types.
[0100] Sixth, the method has a solid theoretical foundation, based on the Kolmogorov-Arnold representation theorem (formula (10)), the theory of ordinary differential equations (formulas (22)-(27)) and Bayesian statistical theory (formulas (13)-(21)), forming a complete technical framework that provides scientific basis and decision support for software quality assessment and improvement.
[0101] This invention provides a more comprehensive and technologically advanced innovative solution for the field of software quality measurement, and has significant theoretical and practical value.
[0102] Example 2 Based on the same inventive concept, the complete algorithm flow of the software quality measurement method based on Bayesian-KAN-ODE in this embodiment is summarized as follows: The entire method is executed sequentially in four stages: The first stage is data preparation and preprocessing (steps 1-3), constructing standardized input data and initial weights; the second stage is model building and training (steps 4-6), obtaining optimal model parameters through end-to-end learning; the third stage is quality measurement and prediction (steps 7-10), evaluating the new class graph using the trained model; the fourth stage is result output and analysis (steps 11-13), providing an interpretable evaluation report. It is important to note that model training in the second stage is a prerequisite for quality evaluation in the third stage; only after model training converges can the actual quality measurement stage begin. The detailed process is as follows: Phase 1: Data preparation and preprocessing; Step 1: Data Collection A software class diagram One quality evaluation index is used to construct the original data matrix. As shown in formula (1). The first row of the matrix There are several evaluation indicators, the first column is... Software class diagram identifier.
[0103] Step 2: Perform dimensionless processing on the raw data. First, calculate the maximum value of each indicator according to formulas (2) and (3). and minimum value Then, calculate the preferred membership degree according to formula (4). The optimal membership matrix is obtained. As shown in formula (5).
[0104] Step 3: Calculate the initial weight vector using the entropy method. First, the data is standardized according to formula (6) to obtain... Then, calculate the information entropy according to formula (7). , where constant Next, the information utility coefficient is calculated according to formula (8). Finally, the initial weights are calculated according to formula (9). This yields an initial weight vector that satisfies the normalization condition. .
[0105] Phase Two: Model Building and Training; Step 4: Initialize model parameters. Variational parameters of Bayesian KAN. (Formula (16)) is initialized to , Parameters of Neural ODE (Formula (25)) uses Xavier initialization; output layer parameters (Formula (29)) uses random initialization.
[0106] Step 5: For each training epoch, perform mini-batch gradient descent: (a) Perform forward propagation for each sample in the batch: Quality features are extracted using Bayesian KAN: First, based on the theoretical foundation of the Kolmogorov-Arnold representation theorem (Formula (10)), KAN interlayer transformation is performed according to Formula (11), and the learnable function of each edge is expanded using B-spline basis functions according to Formula (12); parameter sampling is performed using the reparameterization technique (Formula (17)), and samples are taken from the variational posterior distribution according to Formula (18). Next, perform forward propagation of formula (19) for each sample; finally, calculate the mean of the quality characteristics according to formulas (20) and (21). and variance .
[0107] Evolving weights via Neural ODE: with initial weights (From formula (9)) and mean of quality characteristics (From formula (20)) as input, based on the Neural ODE basic equation defined in formula (22) and the weight evolution equation in formula (24), the MLP parameterized evolution function defined in formula (25) is used. Solving the initial value problem of formula (26) yields... Finally, the normalized weights are obtained through Softmax transformation according to formula (27). .
[0108] Calculate the predicted value: Calculate the weighted eigenvector according to formula (28). According to formula (29), the prediction is generated through the output layer. (i.e., comprehensive software quality metric); calculate the predicted mean according to formula (31). (Final quality metric).
[0109] (b) Calculate the joint loss function: Combine the three losses according to formula (30), including the data fitting loss of formula (32). KL divergence loss of formula (33) And the regularization loss of formula (34) .
[0110] (c) Backpropagation to calculate gradient: For the Bayesian KAN module: the gradient of the variational parameters is calculated according to the variational inference principle (Equations (35)-(38)), and estimated by Monte Carlo sampling using Equations (45) and (46). and .
[0111] For the Neural ODE module: the gradient is calculated using the adjoint method, and the adjoint equation is defined according to formula (23); the initial weight gradient is calculated according to formula (43). ; Calculate the gradient of the ODE parameters according to formula (44) .
[0112] For output layer parameters: directly calculated via automatic differentiation. and .
[0113] (d) Gradient clipping and parameter update: Calculate the gradient according to formula (47). norm If the gradient norm exceeds the threshold, perform gradient clipping according to formula (48); update all parameters, including variational parameters, using the Adam optimizer. ODE parameters and output layer parameters.
[0114] Step 6: Monitor validation set performance. Evaluate the model on the validation set every few rounds and calculate the validation loss. Trigger an early stopping mechanism when the validation loss stops decreasing for several consecutive rounds. Save the model parameters with the best validation set performance as the final model, including the optimal variational parameters. Optimal ODE parameters and optimal output layer parameters , .
[0115] Phase Three: Quality Measurement and Prediction; Step 7: For the new class graph to be evaluated, extract quality features and construct a superior membership vector. Dimensionless processing is performed according to formulas (2)-(5) of the first stage.
[0116] Step 8: Perform Monte Carlo sampling. Sample from the learned variational posterior distribution. The next (reasoning stage) is usually taken To obtain a more accurate estimate of uncertainty, the specific sampling method is shown in formula (18).
[0117] Step 9: For each sample Perform a complete forward propagation: The quality feature vector is calculated using Bayesian KAN based on formulas (11) and (12). Each layer is transformed according to formula (19); Solving the Neural ODE: Based on the weighted evolution equation of formula (24) and the evolution function of formula (25), the initial value problem of formula (26) is numerically solved using the Dormand-Prince method (formulas (39)-(42)), yielding the results. Then, the normalized weights are obtained through Softmax transformation according to formula (27). ; Calculate the weighted features according to formula (28) ; The predicted value is generated according to formula (29). (Comprehensive metrics for software quality).
[0118] Step 10: Calculate the prediction statistic. Calculate the posterior prediction mean according to formula (31). (The final quality metric represents the expected value of the predicted distribution); the prediction variance is calculated according to formula (49). (Quantifying the uncertainty of forecasting); Calculate the confidence interval according to formula (50). For the 95% confidence interval, .
[0119] Phase 4: Results Output and Analysis.
[0120] Step 11: Output software quality metric results: posterior prediction mean (From formula (31)) As the comprehensive quality score, this value is the expected value after integrating the parameter uncertainty; uncertainty estimation (From formula (49)) reflects the prediction confidence and quantifies the impact of parameter uncertainty on the prediction results; confidence interval (From Equation (50)) provides the probability range of the predicted distribution for risk assessment and decision support.
[0121] Step 12: Generate the weight evolution trajectory. For the time interval Uniform sampling At that moment For each moment Numerical solution of ordinary differential equations (from 0 to ... ) to obtain weights (As shown in formula (51)), Then, the normalized weights are obtained through the Softmax transformation of formula (27). Visualization The curves show the weights of each indicator. Analyze key development stages, important quality indicators, and evolution patterns over time.
[0122] Step 13: Perform feature importance analysis. For the first... Each input index is used to visualize its corresponding spline function according to formula (12). It analyzes nonlinear relationships, sensitive intervals, and threshold effects to generate feature importance reports, providing guidance for quality improvement.
[0123] The above are merely preferred embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for dynamic measurement and uncertainty quantification of software quality based on a Bayesian-KAN-ODE concatenated architecture, characterized in that, Includes the following steps: S1: Dimensionless processing is performed on the original values of the quality indicators of the software object to be evaluated to obtain the optimal membership data and determine the initial weight of each quality indicator. S2: Input the preferred membership data into the Kolmogorov-Arnold network, extract quality features through the network structure with learnable spline functions, and perform probabilistic modeling of the network parameters based on variational inference to quantify the uncertainty in the feature extraction process, and output the quality feature vector and its uncertainty measure. S3: Input the initial weights and the quality feature vector into the ordinary differential equation model of the God, and obtain the dynamic weight vector by solving the ordinary differential equation describing the continuous evolution of the weights over time; S4: Construct a cascaded architecture using the Kolmogorov-Arnold network and the neural network constant differential equation model. Perform forward propagation based on the dynamic weight vector and the quality feature vector. Generate the predicted distribution of software quality through Monte Carlo sampling and output the predicted mean and uncertainty quantification results.
2. The method according to claim 1, characterized in that, In step S1, the original values of the quality indicators are dimensionless, and the optimal membership function is used to calculate the values based on the maximum and minimum values of the original values of each indicator.
3. The method according to claim 1 or 2, characterized in that, In step S1, the initial weights of each quality index are determined using the entropy method.
4. The method according to claim 1, characterized in that, In step S2, the learnable spline functions in the Kolmogorov-Arnold network are expanded using B-spline basis functions.
5. The method according to claim 1, characterized in that, In step S2, probabilistic modeling of network parameters is performed based on variational inference. Specifically, this includes setting a prior distribution for the network parameters, introducing a variational distribution to approximate the posterior distribution, and optimizing by maximizing the lower bound of evidence.
6. The method according to claim 5, characterized in that, The variational distribution is approximated by a mean field, and gradient calculation is performed using reparameterization techniques.
7. The method according to claim 1, characterized in that, In step S3, the ordinary differential equation describing the continuous evolution of the weights over time is defined as: ; Where w(t) is the weight vector at time t, z is the quality feature vector extracted by Bayesian KAN, and g is the weight evolution function parameterized by the neural network. represents the parameters of the ordinary differential equation network.
8. The method according to claim 7, characterized in that, The inputs to the evolution function include the current weight vector, the quality feature vector, and the time code.
9. The method according to claim 1, characterized in that, Step S3 further includes: performing a Softmax transformation on the weight vector obtained by solving the ordinary differential equation to obtain a normalized dynamic weight vector.
10. The method according to claim 1, characterized in that, In step S4, the output uncertainty quantification results include: calculating the prediction variance and the confidence interval based on the prediction mean and prediction variance.