A software quality self-adaptive measurement method based on information geometry and reinforcement learning
By combining information geometry and reinforcement learning, low-dimensional manifold coordinates of software class graphs are extracted, composite fuzzy matter-element is constructed and adaptively optimized, overcoming the limitations of traditional software quality measurement methods and achieving efficient and accurate evaluation of complex software systems.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- JIANGXI UNIVERSITY OF FINANCE AND ECONOMICS
- Filing Date
- 2025-12-11
- Publication Date
- 2026-07-03
AI Technical Summary
Existing software quality measurement methods cannot adapt to the dynamic and uncertain nature of software quality evaluation. They lack geometric modeling of high-dimensional manifold spaces, traditional methods cannot accurately characterize the intrinsic structure of quality features, and they fail to fully utilize machine learning, especially reinforcement learning techniques, to achieve adaptive optimization of the evaluation process.
A method combining information geometry and reinforcement learning is adopted. Low-dimensional manifold coordinates are extracted through information geometric mapping and sparse representation to construct composite fuzzy matter-element, and the initial weights are calculated using the entropy weight method. Multiple rounds of iterative optimization are carried out through the adaptive feedback mechanism of reinforcement learning, and finally the MARCOS method is used to calculate the comprehensive evaluation value.
It enables dynamic and adaptive evaluation of software quality, improves the accuracy and discriminative power of measurement results, overcomes the limitations of traditional methods, and adapts to the nonlinear and high-dimensional quality data of complex software systems.
Smart Images

Figure CN121579322B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of computer software quality analysis and measurement technology, and involves the cross-application of information geometry, machine learning and multi-criteria decision making, especially an adaptive measurement method for software quality based on information geometry and reinforcement learning. Background Technology
[0002] Software metrics are an important and long-standing research area in software engineering. They are a crucial measure and effective method for evaluating and predicting software development activities, with the fundamental purpose of providing guidance for developing high-quality software.
[0003] Since Rubey RJ and Hartwick RD proposed the concept of software metrics in 1968, research and application of software metrics have been conducted for over fifty years, mainly focusing on two aspects: software quality metrics based on internal software attributes and software quality metrics based on external software attributes. Research has found that many scholars tend to start with the intrinsic elements of the software itself, seeking key or important software quality measurement factors for direct or indirect measurement or specific statistics, and constructing corresponding measurement models.
[0004] Early research on structured program metrics, represented by theoretical achievements such as Lines of Code (LOC), McCabe coloring graphs, and Function Point Analysis (FPA), all belong to this type of software quality metric research. Subsequently, regarding research on object-oriented software quality metrics, Chidamber S. and Kemerer C. proposed a set of CK metrics in 1994, including: weighted number of methods per class, number of subclasses, depth of inheritance tree, coupling between classes, lack of class cohesion, and number of response sets per class—six metrics in total—laying the cornerstone of object-oriented software quality metrics.
[0005] In research on software quality metrics based on external software attributes, the software quality characteristics that developers and researchers focus on are broadly defined. This includes not only the software quality characteristics encompassed by the narrowly defined ISO / IEC 25010 software quality model, but also other software quality characteristics related to software development and application. A typical example is Gosain A. and Sharma G., who defined dynamic software quality characteristics such as robustness, explicitness, dynamism, discriminativeness, and machine independence, and evaluated relevant Java software examples.
[0006] Class diagrams, as a crucial software model, describe the classes in a system and their various relationships. Their scientific construction significantly impacts software complexity. Currently, methods for measuring class diagram complexity include: Marchesi M. using seven metrics to measure complexity from different perspectives; Genero M. using 14 metrics to further differentiate relationships between classes; Dr. Zhou Yuming using a single metric to evaluate class diagram complexity, transforming class diagrams that only consider inter-class relationships into weighted class dependency graphs, and using information entropy to measure the complexity; and Dr. Yi Tong arguing that not only inter-class relationships affect class diagram complexity, but also attributes and methods within classes, proposing a UML class diagram complexity measurement method based on dependency analysis.
[0007] However, existing research has the following shortcomings: (1) Traditional methods mostly use static weights, which cannot adapt to the dynamics and uncertainties of software quality evaluation; (2) Classical multi-criteria decision-making methods such as TOPSIS have been around for more than 40 years and lack theoretical innovation and method updates; (3) There is a lack of research on geometric modeling of software quality from the perspective of high-dimensional manifold space, and traditional Euclidean space measures are difficult to accurately characterize the intrinsic structure of quality features; (4) Machine learning, especially reinforcement learning techniques, have not been fully utilized to achieve adaptive optimization and dynamic adjustment of the evaluation process. Summary of the Invention
[0008] To address the aforementioned technical problems, this invention proposes an adaptive software quality measurement method based on information geometry and reinforcement learning, thereby resolving the issues present in the prior art.
[0009] To achieve the above objectives, this invention provides an adaptive software quality measurement method based on information geometry and reinforcement learning, comprising:
[0010] Obtain the raw quality feature data of multiple software class diagrams;
[0011] Based on the original quality feature data, the low-dimensional manifold coordinates of each software class graph are extracted through information geometric mapping and sparse representation;
[0012] Based on the low-dimensional manifold coordinates, the values of each software class graph on each quality evaluation index are reconstructed, and a composite fuzzy matter element is constructed based on the values of all software class graphs.
[0013] The composite fuzzy matter-element is dimensionless to obtain the preferred membership matrix;
[0014] Based on the values obtained from the reconstruction, the initial weights of each evaluation index are calculated using the entropy weight method.
[0015] Starting with the initial weights, multiple rounds of iterative optimization are performed through a reinforcement learning adaptive feedback mechanism to obtain optimized weights;
[0016] Based on the optimized weights and the preferred membership matrix, the MARCOS method is used to calculate the comprehensive evaluation value of each software class diagram;
[0017] The software quality measurement results are output based on the comprehensive evaluation value.
[0018] Optionally, based on the original quality feature data, the process of extracting the low-dimensional manifold coordinates of each software class graph through information geometric mapping and sparse representation includes:
[0019] The original quality feature data is mapped to a statistical manifold composed of a family of probability distributions, and the Fisher information metric tensor is calculated based on the statistical manifold to establish the Riemannian geometric structure.
[0020] On the Riemannian manifold space, an overcomplete dictionary is constructed using the K-SVD dictionary learning algorithm, and the LARS algorithm is used to solve for the sparse representation coefficients of each software class graph;
[0021] Non-zero elements are extracted from the sparse representation coefficients, and the projection matrix is learned through principal component analysis. The projection matrix is then used to map the non-zero sparse coefficients to a low-dimensional space to obtain the low-dimensional manifold coordinates.
[0022] Optionally, the process of reconstructing the values of each software class graph on each quality evaluation index based on the low-dimensional manifold coordinates, and constructing a composite fuzzy matter element based on the values of all software class graphs includes:
[0023] Based on the statistical characteristics of each evaluation index in the training set, a mapping relationship from manifold coordinates to evaluation index values is established. Based on this mapping relationship, the correspondence between each evaluation index and manifold coordinate components is determined through correlation analysis. Based on this correspondence, the low-dimensional manifold coordinates of each software class graph are reconstructed into the values of each evaluation index. Based on the reconstructed values of each evaluation index, a composite fuzzy matter element is constructed.
[0024] Optionally, the process of performing dimensionless processing on the composite fuzzy matter-element to obtain the preferred membership matrix includes:
[0025] The eigenvalues in the composite fuzzy matter element are dimensionless. The inverse index is obtained by calculating the ratio of the difference between the maximum value and the current value of the index to the difference between the maximum value and the minimum value of the index. The positive index is obtained by calculating the ratio of the difference between the current value and the minimum value of the index to the difference between the maximum value and the minimum value of the index. When the maximum value of the index is equal to the minimum value, the corresponding optimal membership degree is set to a predetermined value. An optimal membership degree matrix is constructed based on all the optimal membership degrees.
[0026] Optionally, the process of calculating the initial weights of each evaluation index using the entropy weight method based on the reconstructed values includes:
[0027] An original data matrix is constructed based on the reconstructed values. The original data matrix is then standardized to obtain a standardized matrix. The information entropy of each evaluation indicator is calculated based on the standardized matrix. The information utility coefficient of each evaluation indicator is calculated based on the information entropy. The initial weights are determined based on the information utility coefficients.
[0028] Optionally, multiple rounds of iterative optimization can be performed using a reinforcement learning adaptive feedback mechanism to obtain optimization weights, including the following iterative process:
[0029] Calculate the weighted decision matrix based on the current weight vector and the preferred membership matrix; calculate the measurement result bias based on the weighted decision matrix;
[0030] A state vector is constructed based on the deviation of the measurement results; a reward signal is calculated based on the deviation of the measurement results from adjacent iterations.
[0031] The current weight vector is adjusted for the first time based on a dynamic inertia weighting strategy; the weight vector after the first adjustment is adjusted for the second time based on a near-end strategy optimization algorithm.
[0032] A multi-dimensional convergence judgment mechanism is used to determine whether to output the optimized weight vector.
[0033] Optionally, the multi-dimensional convergence judgment mechanism includes:
[0034] Determine whether the standard deviation of the measurement results from multiple consecutive iterations is less than a first threshold;
[0035] Determine whether the ratio of the standard deviation to the mean of the reward signal over multiple consecutive iterations is less than a second threshold;
[0036] Determine whether the Euclidean distance between the weight vectors of two adjacent iterations is less than the third threshold;
[0037] When all the judgment conditions are met at the same time, the current weight vector is output as the optimized weight vector.
[0038] Optionally, the process of calculating the comprehensive evaluation value for each software class diagram using the MARCOS method includes:
[0039] The optimized membership matrix is weighted using the optimized weights to obtain a weighted decision matrix; the ideal solution vector and the anti-ideal solution vector are determined from the weighted decision matrix; based on the weighted decision matrix, the ideal solution vector, and the anti-ideal solution vector, the relevant parameters of each software class graph with respect to the ideal solution and the anti-ideal solution are calculated; based on the relevant parameters, the comprehensive evaluation value of each software class graph is calculated by weighted fusion.
[0040] Optionally, calculate the relevant parameters for each software class diagram and the ideal and antiideal solutions, including performing the following calculations for each software class diagram:
[0041] Calculate the first Euclidean distance between the weighted vector in the weighted decision matrix and the ideal solution vector; calculate the second Euclidean distance between the weighted vector and the anti-ideal solution vector; calculate the sum of all weighted values in the weighted decision matrix as the weighted attribute sum; calculate the first utility based on the sum of the weighted attribute sum and the sum of the ideal solution vector; calculate the second utility based on the sum of the weighted attribute sum and the sum of the anti-ideal solution vector.
[0042] Optionally, based on the relevant parameters, a comprehensive evaluation value for each software class diagram is calculated through weighted fusion, including:
[0043] For each software class graph, based on its first utility and second utility, the first uncertainty weight and the second uncertainty weight are calculated using the binary entropy function; based on the first uncertainty weight, the second uncertainty weight, the first Euclidean distance, and the second Euclidean distance, a weighted fusion is performed to obtain the comprehensive evaluation value of the software class graph.
[0044] Compared with the prior art, the present invention has the following advantages and technical effects:
[0045] By introducing information geometry theory to construct a statistical manifold model, this invention overcomes the fundamental limitations of traditional Euclidean space metrics. Utilizing the Fisher information metric tensor, it accurately characterizes the intrinsic correlations and nonlinear structures between software quality features, ensuring that quality similarity measurements follow the inherent probability distribution geometry of the data rather than simple linear distances. This innovation significantly improves the accuracy and rationality of quality feature representation from a mathematical foundational level, making it particularly suitable for handling the nonlinear, high-dimensional quality data commonly found in complex software systems.
[0046] By employing sparse representation theory combined with K-SVD and LARS algorithms, this invention achieves efficient reduction from high-dimensional redundant features (n-dimensional) to low-dimensional essential features (d-dimensional, d=n / 2). This technique can automatically identify and extract key feature patterns that contribute most to quality judgment, while filtering redundant information and noise interference. This not only significantly reduces the complexity of subsequent calculations and improves measurement efficiency, but also effectively enhances the discriminative power and accuracy of measurement results by focusing on core quality indicators.
[0047] This invention innovatively proposes an RLAF mechanism that breaks through the rigid framework of traditional static weight allocation. By constructing a complete reinforcement learning loop that includes state evaluation, reward feedback, dynamic inertia weight adjustment, and proximal policy optimization, dynamic and adaptive iterative optimization of the weight vector is achieved. This mechanism enables the metric system to adjust the importance of indicators in real time according to the characteristics of the current evaluation task and feedback signals, and ensures the stability and reliability of the optimization process through multi-dimensional convergence judgment. This significantly enhances the method's adaptability to complex and ever-changing software project environments, realizing a fundamental shift from "static configuration" to "dynamic intelligence."
[0048] By employing the novel MARCOS multi-criteria decision-making method, this invention overcomes the limitation of the traditional TOPSIS method, which relies solely on a single perspective of relative distance. The MARCOS method simultaneously calculates the weighted attribute sum ratio of the class graph to be evaluated, the ideal solution, and the anti-ideal solution using a utility function. Compared to the distance metric used in TOPSIS, this method better reflects the intrinsic value of the solution. Furthermore, the uncertainty weights are calculated using a binary entropy function. and This design achieves an adaptive balance between the proximity to the ideal solution and the distance from the anti-ideal solution. This allows the final evaluation value to reflect the overall performance level of the evaluated object while automatically adjusting the contributions of different evaluation dimensions through an entropy-weighted mechanism, thus outputting more robust and decision-supporting evaluation results. Compared to TOPSIS's fixed distance ratio calculation method, MARCOS's utility and entropy-weighted fusion mechanism can more accurately distinguish software class graphs with similar quality levels, improving the discriminative power of the measurement results. Attached Figure Description
[0049] 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:
[0050] Figure 1 This is a flowchart of a method according to an embodiment of the present invention. Detailed Implementation
[0051] 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.
[0052] 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.
[0053] Example 1
[0054] like Figure 1 As shown, this embodiment provides an adaptive software quality measurement method based on information geometry and reinforcement learning, including:
[0055] Obtain the raw quality feature data of multiple software class diagrams;
[0056] Based on the original quality feature data, the low-dimensional manifold coordinates of each software class graph are extracted through information geometric mapping and sparse representation;
[0057] Based on the low-dimensional manifold coordinates, the values of each software class graph on each quality evaluation index are reconstructed, and a composite fuzzy matter element is constructed based on the values of all software class graphs.
[0058] The composite fuzzy matter-element is dimensionless to obtain the preferred membership matrix;
[0059] Based on the values obtained from the reconstruction, the initial weights of each evaluation index are calculated using the entropy weight method.
[0060] Starting with the initial weights, multiple rounds of iterative optimization are performed through a reinforcement learning adaptive feedback mechanism to obtain the optimized weights.
[0061] Based on the optimized weight and preferred membership matrix, the MARCOS method is used to calculate the comprehensive evaluation value of each software class diagram;
[0062] The software quality measurement results are output based on the comprehensive evaluation value.
[0063] (a) Information geometric manifold space modeling and sparse representation;
[0064] The process of extracting low-dimensional manifold coordinates for each software class graph based on the original quality feature data through information geometric mapping and sparse representation includes:
[0065] The original quality feature data is mapped to a statistical manifold composed of a family of probability distributions, and the Fisher information metric tensor is calculated based on the statistical manifold to establish the Riemannian geometric structure.
[0066] On the Riemannian manifold space, an overcomplete dictionary is constructed using the K-SVD dictionary learning algorithm, and the LARS algorithm is used to solve the sparse representation coefficients of each software class graph.
[0067] Non-zero elements are extracted from the sparse representation coefficients, and the projection matrix is learned through principal component analysis. The projection matrix is then used to map the non-zero sparse coefficients to a low-dimensional space to obtain the low-dimensional manifold coordinates.
[0068] The process of reconstructing the values of each software class graph on various quality evaluation indicators based on the low-dimensional manifold coordinates, and constructing composite fuzzy matter elements based on the values of all software class graphs, includes:
[0069] Based on the statistical characteristics of each evaluation index in the training set, a mapping relationship from manifold coordinates to evaluation index values is established. Based on this mapping relationship, the correspondence between each evaluation index and manifold coordinate components is determined through correlation analysis. Based on this correspondence, the low-dimensional manifold coordinates of each software class graph are reconstructed into the values of each evaluation index. Based on the reconstructed values of each evaluation index, a composite fuzzy matter element is constructed.
[0070] (1) Construction of the information geometric manifold space;
[0071] Information geometry theory views the probability distribution space as a Riemannian manifold, providing a novel mathematical framework for software quality measurement. The quality characteristics of software class graphs often exhibit nonlinear manifold structures in high-dimensional spaces, making it difficult for traditional Euclidean space-based measurement methods to accurately characterize their intrinsic geometric properties.
[0072] Let the software class diagram set be ,in This indicates the total number of class diagrams to be evaluated. Each class diagram... ( )Include Quality evaluation indicators These metrics can include characteristics that reflect software quality, such as the weighted number of methods in a class, the depth of the inheritance tree, the degree of coupling between classes, the degree of lack of cohesion within a class, the number of response sets, the number of attributes, and the complexity of methods.
[0073] Within the information geometry framework, the quality features of each class graph are mapped to a statistical manifold composed of a family of probability distributions. Above. A statistical manifold is defined as:
[0074]
[0075] in, Let be the coordinate parameter vector on the manifold. For parameter space, Let be the manifold dimension. To achieve dimension reduction while preserving key information, it is usually taken as . That is, the manifold dimension is about half of the original feature dimension. Indicates in the parameter The probability density function under the following conditions For observational data.
[0076] In manifold Define Fisher information metric tensor As a Riemannian metric, it takes the form:
[0077]
[0078] in, Represents the probability distribution Expectation operation This is the index of the manifold coordinates. This metric tensor characterizes the local geometry on the manifold, making the similarity measurement of software quality features more consistent with its inherent probability distribution characteristics. Specifically, the Fisher information metric tensor... element Parameters were measured and The higher the correlation value, the stronger the statistical correlation between the two parameters.
[0079] The specific calculation method of Fisher's information metric tensor is as follows: It is assumed that the quality feature vector of each class graph follows a multivariate Gaussian distribution. ,in It is the mean vector. This is the covariance matrix. Parameter vector. The lower triangular elements containing the mean vector and covariance matrix, i.e. ,in This represents an operator that extracts the lower triangular elements (including the diagonal) of a matrix and stacks them column-wise into a vector.
[0080] At this time, Fisher's information matrix The The element can be calculated using the following formula:
[0081]
[0082] in, Represents the trace operation of a matrix. It is the inverse of the covariance matrix. and Let the covariance matrix and mean vector represent the parameters respectively. The partial derivatives. The first term of formula (3) reflects the contribution of changes in the covariance structure to the information measure, and the second term reflects the contribution of changes in the mean.
[0083] Geometric Interpretation of the Fisher Information Metric Tensor: On a statistical manifold, the geodesic distance between two points can be calculated by integrating the Fisher information metric along a path. Let... A curve on a manifold ( If ), then the curve length L is:
[0084]
[0085] The integral in Equation (4) gives the shortest path length between two mass feature points on the manifold, which reflects the intrinsic similarity of mass features better than the traditional Euclidean distance. In practical calculations, the Riemann gradient descent method or the geodesic algorithm can be used to solve for the optimal path on the manifold.
[0086] (2) Key feature extraction based on sparse representation;
[0087] Quality evaluation metrics for software class diagrams often exhibit high dimensionality and redundancy, and different metrics may show strong correlations. Sparse representation theory, by finding the minimum linear combination of basic elements to represent data, can effectively extract key quality features and remove redundant information.
[0088] For class diagrams The original feature vector In a complete dictionary Searching for sparse representation coefficients .here This indicates that the number of atoms in the dictionary is much greater than the original feature dimension, causing the dictionary to be overcomplete. Each column vector in the dictionary... ( A ) is called a dictionary atom, representing a basic quality characteristic pattern.
[0089] The sparse representation model is:
[0090]
[0091] in, To reconstruct the error vector, satisfying .here This is a preset error tolerance used to control reconstruction accuracy. It is recommended to set it based on the original signal energy. This means that the reconstruction error is allowed to be no more than 1% of the original signal energy. express Norm (Euclidean norm), defined as ,in For vectors The Each component.
[0092] Sparse representation coefficients By solving the following Norm-constrained optimization problem obtained:
[0093]
[0094] in, express of Norm, which is the number of non-zero elements, is defined as follows: The goal of formula (6) is to use as few dictionary atoms as possible to represent the original feature vector while satisfying the reconstruction accuracy constraint, so as to extract the most critical quality features.
[0095] because Norm optimization is an NP-hard problem, and theoretically, the global optimum cannot be found in polynomial time. Therefore, we adopt... Norm as Convex relaxation of the norm transforms the optimization problem into:
[0096]
[0097] in, for Norm. Under certain conditions (such as the dictionary satisfying the restricted isometry RIP), the solution of formula (7) is equivalent to the solution of formula (6), that is... Relaxation can restore Sparse solutions to the problem.
[0098] Sparse optimization solution algorithm: The Least Angle Regression (LARS) algorithm is used to solve formula (7). The basic idea of the LARS algorithm is to progressively select the dictionary atoms that are most correlated with the current residual and add them to the active set, and update the coefficients along the equiangular direction. The specific steps are as follows:
[0099] Step 1: Initialize residuals active group sparsity coefficient Iteration counting .
[0100] Step 2: Calculate the correlation between all dictionary atoms and the current residual. ( Select the atomic index with the highest relevance. .
[0101] Step 3: Put Join the active group Let the active dictionary matrix be denoted as .
[0102] Step 4: Calculate the isoangular direction ,in It is a vector consisting entirely of 1s.
[0103] Step 5: Calculate the step size , making along The correlation between the residual and the new atom after the directional shift is equal to the current maximum correlation.
[0104] Step 6: Update residuals Update the sparse coefficients (only for the positions corresponding to the active set).
[0105] Step 7: If If the preset maximum number of iterations is reached, then stop; otherwise, let... Return to step 2.
[0106] The computational complexity of the LARS algorithm is . ,in The number of atoms in the dictionary. The feature dimension is denoted as . This algorithm is suitable for medium-sized problems; for large-scale problems, faster algorithms such as online dictionary learning can be used.
[0107] The method for constructing an overcomplete dictionary: The K-SVD dictionary learning algorithm is used to adaptively learn the dictionary from the training samples. For training samples Learn the dictionary through the following alternating optimization steps. :
[0108] Initialization: Randomly generate a dictionary Its column vectors are normalized to unit vectors. The recommended dictionary size is [size to be specified in the original text]. The redundancy is 2, which ensures representation capability while avoiding excessive redundancy.
[0109] Iterative optimization ( ,in This represents the maximum number of iterations for dictionary learning; it is recommended to take [value]. ):
[0110] (1) Sparse coding stage: fixed dictionary For each training sample ( The sparsity coefficients are obtained by solving formula (7) using the LARS algorithm. This forms a sparse coefficient matrix. .
[0111] (2) Dictionary update phase: fix the sparse coefficient matrix Update the dictionary atoms column by column. For the first... dictionary atoms ( Defines the sample index set that uses this atom. .like If the residual of a training sample is randomly selected, it becomes the new dictionary atom; otherwise, the residual matrix is calculated. ,in The matrix consists of all training samples. for The Okay. Extract. The middle corresponds to The column is denoted as ,right Singular Value Decomposition (SVD) is performed to obtain Take the left singular vector corresponding to the maximum singular value as the updated dictionary atom. The corresponding sparsity coefficients are updated to ,in For the maximum singular value, This is the corresponding right singular vector.
[0112] (3) Convergence judgment: Calculate the reconstruction error ,in It is the Frobenius norm. If (suggestion If the condition is met, then convergence is considered complete, and the output is... Otherwise, continue iterating.
[0113] sparsity coefficient Dictionary atoms corresponding to non-zero elements That is, a class diagram Key quality characteristics. Through sparse representation, high-dimensional original features are transformed. Compress to a low-dimensional sparse space to extract the most discriminative quality patterns.
[0114] Mapping from sparse coefficients to manifold coordinates: Coordinate parameters on information geometric manifolds It can be determined by the sparsity coefficient. The non-zero part is determined. Define the mapping function:
[0115]
[0116] in, express A vector consisting of non-zero elements The number of non-zero elements. Let be the mapping function from sparse coefficients to manifold coordinates. Let be a linear projection matrix, where The average sparsity is denoted as .
[0117] Projection matrix The coefficients are learned from the non-zero sparse coefficients of the training samples through principal component analysis (PCA). The specific steps are as follows:
[0118] Step 1: Collect the non-zero sparse coefficients of all training samples and construct a matrix. Due to the sparsity of different samples Possibly different, for insufficient sparsity Zero-filling is performed on samples exceeding [a certain threshold]. The samples were truncated or the most important samples were selected. One non-zero element.
[0119] Step 2: For Center the vector and calculate the mean vector. Centralized matrix ,in for A 1-dimensional row vector.
[0120] Step 3: Calculate the covariance matrix ,right Perform eigenvalue decomposition ,in It is an eigenvalue diagonal matrix (eigenvalues arranged in descending order). This is the corresponding eigenvector matrix.
[0121] Step 4: Before selecting Construct the projection matrix from the eigenvectors corresponding to the largest eigenvalues. Ensure the mapped manifold coordinates .
[0122] By using formula (8), the sparse coefficients are mapped to the coordinates of the information geometric manifold, realizing the nonlinear dimensionality reduction from the original high-dimensional feature space to the low-dimensional manifold space, laying the foundation for subsequent fuzzy matter-element evaluation.
[0123] (3) Mapping from manifold coordinates to evaluation indicators;
[0124] In order to transfer coordinate parameters on the information geometric manifold The index values required to map back to the fuzzy matter-element evaluation system ( This requires defining a reverse mapping function. It is implemented using a combination of linear transformation and statistical normalization.
[0125]
[0126] in, and The first The mean and standard deviation of each indicator on the training set are defined as follows:
[0127]
[0128] in, For the training set The first class diagram The original values of each indicator. From the index of indicators Mapping function to manifold coordinate dimensions, , Represents the coordinate vector of the manifold The Each component.
[0129] Mapping function The correlation analysis was used to determine the specific steps:
[0130] Step 1: For each metric in the training set Calculate its relationship with all manifold coordinate components. ( Pearson correlation coefficient of )
[0131]
[0132] in, For the first The first sample manifold coordinate One portion, For the first The mean of the coordinate components of each manifold.
[0133] Step 2: For each indicator Choose the coordinate dimension of the manifold with the highest correlation as the mapping target:
[0134]
[0135] When manifold dimension In some cases, multiple metrics may map to the same manifold coordinate dimension. In such situations, a weighted average of the multiple manifold coordinate components can be used to reconstruct the metric values.
[0136]
[0137] Among them, weight The correlation coefficient is obtained by normalizing its absolute value:
[0138]
[0139] Through formulas (9)-(14), the mapping from information geometric manifold coordinates to fuzzy matter-element evaluation indices was completed, and the original data matrix was constructed. This laid the foundation for subsequent fuzzy matter-element analysis and weight optimization.
[0140] (II) Establishment of a fuzzy matter-element evaluation system;
[0141] The process of dimensionless transformation of composite fuzzy matter-element to obtain the preferred membership matrix includes:
[0142] The eigenvalues in the composite fuzzy matter element are dimensionless. The inverse index is obtained by calculating the ratio of the difference between the maximum value and the current value of the index to the difference between the maximum value and the minimum value of the index. The positive index is obtained by calculating the ratio of the difference between the current value and the minimum value of the index to the difference between the maximum value and the minimum value of the index. When the maximum value of the index is equal to the minimum value, the corresponding optimal membership degree is set to a predetermined value. An optimal membership degree matrix is constructed based on all the optimal membership degrees.
[0143] (1) The concepts of fuzzy matter-element and complex matter-element;
[0144] Matter-element analysis is an emerging discipline that studies the laws and methods for solving incompatible problems. It is an interdisciplinary field at the intersection of cognitive science, systems science, and mathematics. Fuzzy matter-element analysis combines fuzzy set theory and matter-element analysis theory, which can solve both the fuzziness of measurement indicators and the incompatibility of measurement results.
[0145] In matter-element analysis, the things being described are... (Evaluation object, i.e., software class diagram), characteristics of things (Evaluation metrics, such as coupling degree, cohesion, etc.) and the corresponding values of the eigenvalues. The specific numerical values corresponding to the evaluation indicators are combined to form a set of basic elements describing things, which are called matter elements, represented as a triplet. .
[0146] If the value corresponding to the eigenvalue A substance is called a fuzzy matter-element if it possesses fuzziness (such as fuzzy concepts like "high coupling" or "medium complexity"). Fuzziness stems from the inherent subjectivity and uncertainty in software quality evaluation, such as the difficulty in precisely quantifying certain indicators or the differing judgments of different evaluators regarding the same indicator.
[0147] If the things being described have Features Its corresponding value is Then it is called for A 3D fuzzy matter element can be represented as:
[0148]
[0149] When simultaneous evaluation is required Individual items (class diagram) At that time, a thing Dimensional elements combine together to form a thing 3D composite fuzzy matter element, denoted as Represented in matrix form:
[0150]
[0151] In formula (16), the first row is the index name row, and the first column is the class diagram identifier column. For the first ( Identifiers for a single entity (software class diagram). For the first thing ( ) characteristics (quality evaluation indicators), For things The The values corresponding to each feature. Combined with the aforementioned geometrically sparse representation of information, The manifold coordinates can be obtained from formula (9). Calculated, i.e. .
[0152] Composite fuzzy matter element It fully describes the characteristics of multiple software class diagrams across multiple quality metrics, providing a unified data representation framework for subsequent dimensionless processing, weight calculation, and comprehensive evaluation.
[0153] (2) Dimensionless processing of evaluation indicators;
[0154] In software quality evaluation, the evaluation metrics involved often have different dimensions and orders of magnitude. For example, the number of methods in a class might be an integer ranging from tens to hundreds, while the coupling degree might be a decimal between 0 and 1. If there is no unified measurement standard among the metrics, the evaluation process will be difficult, and metrics with different dimensions cannot be directly compared and synthesized. In order to synthesize and compare metrics with different dimensions, it is necessary to perform dimensionless processing on the values of these evaluation metrics. Dimensionless processing is to eliminate the influence of dimensions on physical quantities through mathematical methods, transforming all metrics to a unified dimensionless scale (usually the [0,1] interval).
[0155] There are generally two types of indicators for the results of quantitative processing:
[0156] 1) Positive Indicators (larger is better): Higher indicator values indicate better quality, such as class cohesion and maintainability scores. For positive indicators, the dimensionless formula is:
[0157]
[0158] 2) Inverse Indicators (Smaller is Better): Smaller index values generally indicate better quality, such as complexity, coupling, and defect density. In software quality evaluation, based on practical experience, most indicators fall into the "smaller is better" category. For inverse indicators, the following dimensionless formula is used:
[0159]
[0160] In formulas (17) and (18), For the first The first thing (class diagram) The dimensionless result of the value corresponding to a feature (indicator) is called the optimal membership degree. 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.
[0161] The geometric meaning of formula (18) is: for the inverse index, the original value The closer (The worse) the dimensionless result The closer to 0; the more primitive the value The closer (The better), dimensionless The closer it is to 1, the better. Thus, regardless of the original dimensions of the indicator, the dimensionless result... Both values indicate "excellent or poor" performance; the higher the value, the better the performance of that indicator.
[0162] Special case handling: When At that time, all class diagrams are in the [number]th [year]. If all values for a given indicator are exactly the same, then that indicator contributes nothing to distinguishing different categories of charts. To avoid a denominator of zero, we set:
[0163]
[0164] After the values in formula (16) are dimensionless by formula (18) (for inverse indices) or formula (17) (for positive indices), we obtain the fuzzy matter-element with superior membership. :
[0165]
[0166] The preferred membership matrix in formula (20) This serves as the foundation for subsequent weight calculations and comprehensive evaluations. By eliminating dimensions, indicators with different dimensions are unified into the [0,1] interval, eliminating the influence of dimensional differences and enabling fair comparison and weighted summation of different indicators.
[0167] (iii) Determination of initial weights based on the entropy method;
[0168] The process of calculating the initial weights of each evaluation index using the entropy weight method based on the reconstructed values includes:
[0169] The original data matrix is constructed based on the reconstructed values. The original data matrix is then standardized to obtain a standardized matrix. The information entropy of each evaluation indicator is calculated based on the standardized matrix. The information utility coefficient of each evaluation indicator is calculated based on the information entropy. The initial weights are determined based on the information utility coefficients.
[0170] In software quality evaluation, the weight of a particular indicator reflects its relative importance in the overall evaluation process. The reasonable determination of weights directly affects the accuracy and reliability of the final evaluation results. The entropy method is an objective weighting method based on information theory. It determines the weight of each indicator based on the differences in the degree of orderliness of the information contained within them, avoiding the arbitrariness of subjective weighting. This invention uses the entropy method to calculate the initial weights. This serves as the starting point for subsequent adaptive feedback optimization using the RLAF mechanism.
[0171] For the system under discussion, if we obtain Each sample class diagram Initial data matrix of each evaluation indicator Since the dimensions, orders of magnitude, and quality preferences of the various indicators differ significantly, the initial data needs to be standardized. A normalization method is used to convert the data into a probability distribution form:
[0172]
[0173] Obviously, in formula (21) That is, the first Each indicator in all The sum of the standardized values on each class graph is 1, satisfying the normalization condition of the probability distribution. This yields the standardized matrix of the data. .
[0174] Special case handling: If Then standardization is impossible. In this case, if all... This indicates that the indicator shows no difference across all samples, and can be set as follows: If negative values exist, a translation transformation must be performed first. (in (If the number is a small positive number), then standardize it.
[0175] For matrix Each row of data (i.e., the first) The standardized values of each class diagram across all indicators are reordered in descending order to obtain the decision matrix. The purpose of sorting is to enhance the stability of information entropy calculation, making data of the same size and relationship comparable across different samples.
[0176] According to the definition of information entropy, the first The formula for calculating the information entropy value of an indicator is:
[0177]
[0178] The constant in formula (22) With the number of samples in the system Related, commonly used This makes information entropy .when When, define (In the extreme sense). Information entropy The first was measured The degree of information dispersion of each indicator across all samples.
[0179] The physical meaning of information entropy: The larger the value, the higher the value. The more evenly an indicator is distributed across different samples, the weaker its discriminative power and the smaller its contribution to the overall evaluation. The smaller the value, the greater the difference in the indicator across different samples, the stronger its discriminative power, and the greater its contribution to the overall evaluation. When completely disordered (all samples have identical values for this indicator, i.e.) ), At this point, the information of this indicator has zero utility value for the overall evaluation.
[0180] Therefore, the information utility value of a certain indicator depends on 1 and the information entropy of that indicator. The difference is defined as the information utility coefficient. :
[0181]
[0182] The larger the value, the higher the information utility value of the indicator, and it should be given greater weight in the comprehensive evaluation.
[0183] The initial weights of each indicator are estimated using the entropy method, which essentially involves calculating the weights using the value coefficient of that indicator's information. The higher the value coefficient, the greater its importance in the evaluation. Therefore, the first... Initial weights of the indicators for:
[0184]
[0185] Formula (24) ensures the normalization of the weight vector, that is The initial weight vector is obtained. Satisfying the normalization constraint conditions and .
[0186] Characteristics of initial weights: The initial weights obtained by the entropy weight method are objective weights based entirely on the data distribution, reflecting the distinguishing ability of each indicator. However, static initial weights cannot adapt to dynamic changes and uncertainties in the evaluation process, therefore, adaptive optimization is required through a subsequent RLAF mechanism.
[0187] (iv) Adaptive Feedback Optimization Mechanism (RLAF) Based on Reinforcement Learning;
[0188] The optimization weights are obtained through multiple rounds of iterative optimization using a reinforcement learning adaptive feedback mechanism, including the following iterative process:
[0189] Calculate the weighted decision matrix based on the current weight vector and the preferred membership matrix; calculate the measurement result deviation based on the weighted decision matrix; construct the state vector based on the measurement result deviation; calculate the reward signal based on the measurement result deviation of adjacent iterations; perform the first adjustment on the current weight vector based on the dynamic inertia weight strategy; perform the second adjustment on the weight vector after the first adjustment based on the near-end strategy optimization algorithm; determine whether to output the optimized weight vector through a multi-dimensional convergence judgment mechanism.
[0190] The multi-dimensional convergence judgment mechanism includes:
[0191] Determine whether the standard deviation of the measurement result of multiple consecutive iterations is less than the first threshold; determine whether the ratio of the standard deviation to the mean of the reward signal of multiple consecutive iterations is less than the second threshold; determine whether the Euclidean distance between the weight vectors of two adjacent iterations is less than the third threshold; when all the judgment conditions are met at the same time, output the current weight vector as the optimized weight vector.
[0192] Traditional software quality measurement methods use fixed weights, which cannot adapt to dynamic changes, differences in sample characteristics, and uncertainties during the evaluation process. This invention innovatively proposes a reinforcement learning adaptive feedback optimization mechanism (RLAF), which achieves dynamic iterative optimization of weights through in-task feedback loops.
[0193] (1) The theoretical basis of the RLAF mechanism;
[0194] Reinforcement learning (RL) is a machine learning method that learns from feedback on performance evaluation through interaction with the environment, and is particularly suitable for optimizing sequential decision problems. Unlike supervised learning, reinforcement learning does not rely on predefined training datasets and labels, but instead guides the agent to achieve desired behavior through reward signals. The core elements of reinforcement learning include state, action, policy, reward, and value function.
[0195] In software quality measurement scenarios, the weight vector is considered as the agent's policy parameters, and the deviation of the measurement results is regarded as an observation of the environmental state. Iterative optimization of the weights is achieved by designing a reward function and employing the Proximal Policy Optimization (PPO) algorithm. The RLAF mechanism includes the following core components:
[0196] 1) State Space: Defined as... ,in Indicates the first The deviation vector of the measurement result at the next iteration. To capture the temporal trend of the deviation, Including recent The deviation history of the step, i.e. ,in For the first The deviation of the measurement result in each iteration (see formula (26) for specific calculation). Parameters For the length of the state history, it is recommended to take [value]. .
[0197] 2) Action Space: Defined as... ,in Indicates the first The weight adjustment amount in the next iteration. In this invention, the action does not directly set new weights, but adjusts the current weights through dynamic inertia weights and policy gradients to achieve smooth weight updates.
[0198] 3) Policy Function: ,in The policy parameter represents the state. Select action The probability distribution is obtained. In this invention, the strategy is implicitly implemented through dynamic inertia weight adjustment (Formula (29)-(30)) and PPO algorithm (Formula (33)-(36)), without the need to explicitly construct the probability distribution.
[0199] 4) Reward Function: Used to evaluate actions The advantages and disadvantages. The reward function designed in this invention is based on the degree of deviation improvement (formula (28)). When the deviation decreases, a positive reward is given, and when the deviation increases, a negative reward (penalty) is given.
[0200] 5) Value Function: ,in Discount factor (recommended value) ), indicating from state Start following the strategy The expected value of the cumulative rewards that can be obtained. Discount factor. It balances the importance of immediate rewards and long-term rewards.
[0201] The innovation of the RLAF mechanism lies in introducing the adaptive capability of reinforcement learning into the weight optimization process. Through in-task feedback loops (i.e., multiple iterative optimizations in a single evaluation task), the weights can dynamically adapt to the characteristics of the current evaluation object, rather than using fixed static weights.
[0202] (2) Discrete maximization and state evaluation;
[0203] In each iteration ( ,in To determine the maximum number of iterations, it is recommended to take [value]. In this process, the first step is based on the current weight vector. Perform discrete maximization calculation. Discrete maximization refers to weighting the optimal membership degree of each class graph on various indicators to obtain a weighted decision matrix, which is used to evaluate the effect of the current weight configuration.
[0204] From the perspective of superior membership degree fuzzy matter element Extracting the numerical matrix from formula (20) Calculate the weighted decision matrix :
[0205]
[0206] Formula (25) will... Weight of each indicator With the The preferred membership degree of each category diagram on this indicator Multiply to get the weighted value. Weighted decision matrix This reflects the weighted performance of each class diagram on each indicator under the current weight configuration.
[0207] To assess the rationality of the current weighting configuration, the standard deviation of the weighted decision matrix is calculated as a measure of the bias of the results:
[0208]
[0209] in, For matrix elements, This is the mean of the weighted decision matrix. It measures the degree of dispersion of all elements in the weighted decision matrix.
[0210] The physical meaning of the deviation: This reflects the uneven weighting of different class diagrams across various metrics under the current weighting configuration. Larger... This indicates that the weighted data distribution is relatively scattered, and there may be some indicators or class diagrams with abnormally high or low weight values, indicating an unbalanced weight allocation; smaller... This indicates that the weighted data distribution is relatively concentrated, and the weight configuration is relatively reasonable. The goal of the RLAF mechanism is to gradually reduce [the weight distribution] through iterative optimization. This allows the weight allocation to tend towards the optimal level.
[0211] Construct a state vector based on recent deviation history:
[0212]
[0213] in, State history length (recommended value) ).for The initial iteration, insufficient historical values are used Fill, i.e. ,when Time. State vector Includes recent The deviation information of each step provides a temporal context for subsequent reward calculations and policy updates.
[0214] (3) Reward function design;
[0215] The reward function is the core of reinforcement learning, used to guide the agent to learn in the desired direction. The reward function designed in this invention measures the improvement from the deviation during iteration. To iteration Changes in time deviation:
[0216]
[0217] in, To prevent small constants with denominators of zero, the design logic of formula (28) is as follows:
[0218] when At that time, molecules ,but This indicates a reduction in deviation, and a positive reward is given to encourage this adjustment in weight direction. At that time, molecules ,but This indicates an increase in deviation, and a negative reward (penalty) is given to inhibit this weight adjustment direction. When hour, This indicates that the deviation remains unchanged, meaning there is neither reward nor penalty. In the first iteration ( When there is no deviation from the previous iteration for comparison, the following setting is made: Denominator It serves a normalization function, making the magnitude of the reward value relatively independent of the absolute value of the deviation, and focusing more on the relative improvement rate.
[0219] To enhance the stability and comparability of reward signals, normalized rewards are adopted:
[0220]
[0221] in, and Let be the mean and standard deviation of recent reward history, respectively, and be defined as:
[0222]
[0223] in, The recommended window length for reward statistics is [length to be specified]. ).for The initial iteration, the statistical window is Normalized reward With zero mean and unit variance, it helps stabilize subsequent policy gradient calculations.
[0224] (4) Dynamic inertia weight adjustment strategy;
[0225] Inspired by the Particle Swarm Optimization (PSO) algorithm, dynamic inertia weights are introduced. This balances global exploration with local development. Inertia weights control the degree to which historical weight information influences current weight updates.
[0226] The dynamic inertia weight decreases linearly with the number of iterations.
[0227]
[0228] in, For maximum inertia weight, For minimum inertia weight, Maximum number of iterations (recommended) ), This is the current iteration number. Formula (31) ensures that... from linearly decreasing to That is, it gradually decreases from 0.9 to 0.4.
[0229] The mechanism of dynamic inertia weight: in the early stage of iteration ( (smaller) near The large inertia weights result in large weight update amplitudes, and the algorithm focuses on global exploration to avoid premature convergence to local optima; in the later stages of iteration ( near ), near The smaller inertial weights reduce the magnitude of weight updates, and the algorithm focuses on local development, finely adjusting the weights to approach the optimal solution.
[0230] Weighting adjustment factor based on state error :
[0231]
[0232] in, The learning rate (recommended value) ), Let be the hyperbolic tangent function, defined as Its range is . In formula (32), Deviation Mapped to The interval, multiplied by the learning rate Add 1 to get the adjustment factor. . when deviation When it is large, If the deviation is slightly greater than 1, the weight should be appropriately amplified; when the deviation... When smaller, When the value is close to 1, the weight adjustment range is relatively small.
[0233] The first adjustment of the weight vector (adaptive adjustment):
[0234]
[0235] in, for A dimensional vector, where all components are 1 / 2 dimensional vectors. . This represents the Hadamard product (element-by-element multiplication), i.e. The Each component is .
[0236] Formula (33) combines dynamic inertia weights and state error adjustment factors to achieve adaptive weight adjustment. Since the adjusted weights may not satisfy normalization constraints, normalization is required.
[0237]
[0238] Formula (34) ensures that the normalized weight vector satisfies .
[0239] (5) Proximity Policy Optimization (PPO) algorithm;
[0240] The Policy Optimization (PPO) algorithm is an advanced policy gradient method proposed by Schulman et al. in 2017. PPO improves training stability by limiting the magnitude of policy updates, avoiding the performance crashes caused by excessively large policy updates in traditional policy gradient methods. This invention uses the PPO algorithm for the second adjustment of weights (policy optimization).
[0241] First, calculate the advantage function:
[0242]
[0243] in, For the recent The average reward per step (it is recommended to take) ).for The initial iteration, the statistical window is Advantage function Indicates the current reward Relative to the average level The advantages. This indicates that the current action is better than average and should be improved. This indicates that the current action is below average and should be suppressed.
[0244] Calculate the policy gradient:
[0245]
[0246] in, Let be the gradient with respect to the weight vector. Equation (36) gives the advantage function. (Scalar) and State Vector Multiplying (vectors) yields the gradient vector. Due to the dimensionality of the state vector... Typically smaller than the dimension of the weight vector Dimension matching is required. The specific method is: [The text abruptly ends here, likely due to an incomplete sentence or a formatting error.] Each component is mapped to the gradient vector. One component is set to 0, and the remaining components are either set to 0 or filled by interpolation. For simplicity, a broadcast mechanism can be used:
[0247]
[0248] That is, the gradient of each weight component is the product of the advantage function and the current bias. This design ensures that all weights are adjusted in the same direction and magnitude, maintaining the relative relationship of the weight vector.
[0249] Second adjustment of the weight vector (PPO optimization):
[0250]
[0251] in, The learning rate (recommended value) (The learning rate is consistent with that in formula (32)). Formula (38) updates the weights along the policy gradient direction, when Increase weight when Decrease the weight when the time comes.
[0252] To prevent instability caused by excessively large weight updates, a clipping mechanism is used to limit the range of weight values.
[0253]
[0254] in, As the lower bound of the weight, The upper bound of the weight, For the truncation function, Limited to Within the interval. Specifically, for each component of the weight vector. ( ),implement:
[0255]
[0256] The Clip mechanism ensures that all weight components are not less than [amount missing]. (To avoid certain indicators being ignored due to their low weight) and not greater than (To avoid a single indicator having too much weight and dominating the evaluation results).
[0257] right Normalization is performed again:
[0258]
[0259] Obtain the optimized weight vector for the next iteration. ,satisfy and .
[0260] (6) Multi-dimensional convergence judgment mechanism;
[0261] To ensure the effectiveness of the RLAF mechanism and the stability of the optimization process, a multi-dimensional convergence criterion was designed. A single convergence condition (such as only judging whether the deviation is small enough) may lead to premature convergence or oscillation. The multi-dimensional convergence criterion comprehensively considers the stability of the deviation, the stability of the reward, and the changes in the weights, providing a more reliable convergence judgment.
[0262] Define the following three convergence conditions:
[0263] Condition C1 (bias threshold convergence):
[0264]
[0265] in, The deviation threshold, This represents the standard deviation. Formula (42) requires that the deviation fluctuation over five consecutive iterations be less than a threshold. This means that the recent deviation tends to stabilize. The specific calculation is as follows:
[0266]
[0267] in, This represents the average deviation over the last 5 iterations.
[0268] Condition C2 (Reward stability convergence):
[0269]
[0270] in, For the reward fluctuation threshold, This is the average reward over the last 10 iterations. To prevent small constants with a denominator of zero, formula (44) indicates that the coefficient of variation (ratio of standard deviation to mean) of recent rewards is less than 10%, meaning that the reward signal tends to be stable.
[0271] Condition C3 (Convergence of weight changes):
[0272]
[0273] in, The threshold for weight changes. express Norm (Euclidean distance), defined as Formula (45) requires that the change in the weight vector between two consecutive iterations be less than a threshold. This means that the weights have stabilized.
[0274] Overall convergence judgment:
[0275]
[0276] in, This represents a logical AND operation. The algorithm is considered convergent only when all three conditions are met simultaneously. Convergence occurs when the algorithm converges or reaches the maximum number of iterations. When the iteration stops, output the optimized weight vector. .
[0277] Advantages of multi-dimensional convergence judgment:
[0278] Condition C1 ensures the stability of the deviation, avoiding false convergence under conditions of drastic deviation fluctuations; Condition C2 ensures the stability of the reward signal, reflecting that the returns of the optimization process tend to be stable; Condition C3 ensures the stability of the weights themselves, avoiding oscillations of the weights around the optimal value; The logical AND operation of the three conditions provides a strict convergence judgment, ensuring the reliability of the optimization process.
[0279] (v) Comprehensive evaluation of software quality based on the MARCOS method;
[0280] The process of calculating the comprehensive evaluation value of each software class diagram using the MARCOS method includes:
[0281] The optimal membership matrix is weighted using optimized weights to obtain a weighted decision matrix. The ideal solution vector and the anti-ideal solution vector are determined from the weighted decision matrix. Based on the weighted decision matrix, the ideal solution vector, and the anti-ideal solution vector, the relevant parameters of each software class diagram with respect to the ideal solution and the anti-ideal solution are calculated. Based on the relevant parameters, the comprehensive evaluation value of each software class diagram is calculated by weighted fusion.
[0282] Calculate the relevant parameters for each software class diagram, the ideal solution, and the anti-ideal solution, including performing the following calculations for each software class diagram:
[0283] Calculate the first Euclidean distance between the weighted vector and the ideal solution vector in the weighted decision matrix; calculate the second Euclidean distance between the weighted vector and the anti-ideal solution vector; calculate the sum of all weighted values in the weighted decision matrix as the weighted attribute sum; calculate the first utility based on the sum of the weighted attribute sum and the sum of the ideal solution vector; calculate the second utility based on the sum of the weighted attribute sum and the sum of the anti-ideal solution vector.
[0284] Based on relevant parameters, a comprehensive evaluation value for each software class diagram is calculated through weighted fusion, including:
[0285] For each software class graph, based on its first utility and second utility, the first uncertainty weight and the second uncertainty weight are calculated using the binary entropy function; based on the first uncertainty weight, the second uncertainty weight, the first Euclidean distance, and the second Euclidean distance, a weighted fusion is performed to obtain the comprehensive evaluation value of the software class graph.
[0286] The MARCOS (Measurement of Alternatives and Ranking according to COmpromise Solution) method is a novel multi-criteria decision-making approach. Compared to the traditional TOPSIS method (proposed by Hwang and Yoon in 1981), MARCOS provides more balanced and reliable evaluation results by simultaneously considering the ideal solution (AI) and the anti-ideal solution (AAI) and introducing the concept of a utility function. The innovation of the MARCOS method lies in its use of a binary entropy function for uncertainty-weighted fusion, comprehensively considering the relative relationship between alternatives and the ideal and anti-ideal solutions.
[0287] (1) Construct a weighted decision matrix;
[0288] Weight vector optimized based on RLAF mechanism And fuzzy matter elements with superior membership Numerical matrix extracted from (Formula (20)) Construct a weighted decision matrix :
[0289]
[0290] Formula (47) will optimize the weights With preferential membership degree Multiplying them yields the elements of the weighted decision matrix. . , indicating the first The class diagram in the first... The weighted score on each indicator.
[0291] (2) Determine the ideal solution and the antiideal solution;
[0292] Define the ideal solution (Anti-Ideal, AI) vector. and the anti-ideal (AAI) vector In software quality metrics, since most indicators are inverse indicators (the smaller the better), after dimensionless processing using formula (18), The larger the value, the better the quality; therefore, the ideal solution is to take the maximum value of each indicator.
[0293]
[0294] The inverse ideal solution takes the minimum value of each index:
[0295]
[0296] Ideal solution The corresponding attributes reaching their best values in each solution represent the optimal quality level; the inverse ideal solution The corresponding attributes are the worst values among the various options, representing the worst quality level.
[0297] (3) Calculate the distances to the ideal solution and the antiideal solution;
[0298] For the Class diagram ( ), calculate its Euclidean distances to the ideal solution and the antiideal solution:
[0299]
[0300]
[0301] In formula (50), The first was measured Each class diagram and the ideal solution are in Euclidean distance in dimensional weighted space The smaller the value, the closer the image is to the ideal quality level. In formula (51), The first was measured The distance between each class graph and the anti-ideal solution. The larger the value, the further away the graph is from the worst quality level.
[0302] The geometric meaning of distance: in In the weighted decision space, the ideal solution and anti-ideal solution Two extremes of quality evaluation are defined. Each class diagram... Corresponding to a point The distance between this point and the ideal solution The distance between the sum and the antiideal solution Together, they determine its overall quality level.
[0303] (4) Calculate the utility and overall evaluation value;
[0304] The core innovation of the MARCOS method lies in introducing the concept of a utility function, which evaluates alternatives by calculating their relative relationship with the ideal and antiideal solutions, rather than simply using distance ratios.
[0305] First, calculate the weighted sum of attributes for each class diagram:
[0306]
[0307] Calculate the weighted sum of attributes for the ideal and antiideal solutions:
[0308]
[0309]
[0310] Calculate the utility of the ideal solution :
[0311]
[0312] Formula (55) represents the first The ratio of the weighted sum of attributes of each class graph to the weighted sum of attributes of the ideal solution. The closer a value is to 1, the closer the image is to the ideal quality level.
[0313] Calculate the utility of the antiideal solution :
[0314]
[0315] Formula (56) represents the first The ratio of the weighted sum of attributes of each class graph to the weighted sum of attributes of the anti-ideal solution. (because The weighted sum of all class graphs is not less than the anti-ideal solution. The larger the value, the further away the graph is from the worst quality level.
[0316] By combining two utility metrics, a binary entropy function is used to calculate the comprehensive weight, achieving uncertainty-weighted fusion. (Calculation) Uncertainty weights:
[0317]
[0318] calculate Uncertainty weights:
[0319]
[0320] Formulas (57) and (58) are based on the definition of Shannon entropy and are used to measure the uncertainty of utility. and This reflects the relative importance of the two utility measures in the overall evaluation.
[0321] Normalize the weights:
[0322]
[0323] After normalization, .
[0324] Software quality comprehensive evaluation value Through uncertainty-weighted fusion calculation:
[0325]
[0326] The design logic of formula (60) is as follows:
[0327] First item This reflects the degree of closeness to the ideal solution, where The distance to the normalized ideal solution (the smaller the value, the better), therefore we take... As a measure of proximity (the higher the value, the better); the second item This reflects the degree of deviation from the anti-ideal solution. The distance to the normalized anti-ideal solution (the larger the value, the better); two terms are weighted by uncertainty. and The weighted fusion comprehensively considers both the degree of closeness to the ideal solution and the degree of distance from the anti-ideal solution.
[0328] In formula (60), It should be noted that, according to the design of this invention, The closer the value is to 0, the less complex the evaluated object is and the closer it is to the optimal ideal level (the better the quality). The closer the value is to 1, the greater the complexity of the evaluated object and the closer it is to the worst level (the worse the quality). This is because this invention focuses on inverse indicators such as software complexity; lower complexity indicates better quality.
[0329] according to The size of the value pair By sorting the class diagrams, a comprehensive measurement and evaluation of software quality can be achieved. The sorting rules are as follows: The smaller the value, the higher the ranking, indicating better software quality.
[0330] (vi) Complete algorithm flow;
[0331] The complete process of software quality measurement methods is as follows:
[0332] Step 1: Data Acquisition and Preprocessing;
[0333] Treatment of evaluation Quality features are extracted from each software class graph to obtain the original feature vector set. ,in, Include Several quality evaluation indicators (such as the weighted number of methods in a class, the depth of the inheritance tree, the degree of coupling between classes, the degree of lack of cohesion within a class, the number of response sets, the number of attributes, the complexity of methods, etc.).
[0334] Step 2: Information geometry manifold modeling;
[0335] Based on information geometry theory, the quality characteristics of software class graphs are mapped to statistical manifolds. superior:
[0336] (2.1) Estimate the parameters of the multivariate Gaussian distribution for the training samples. Calculate the mean vector of the training set. Covariance Matrix , forming a parameter vector ;
[0337] (2.2) Calculate the Fisher information metric tensor according to formula (3). Construct the Fisher information matrix Determine the Riemannian metric structure of the manifold;
[0338] (2.3) Define the manifold dimension This achieves dimensional reduction.
[0339] Step 3: Sparse representation and key feature extraction;
[0340] Extracting key quality features using sparse representation theory:
[0341] (3.1) The K-SVD algorithm was used to learn the complete dictionary. (in (Redundancy is 2):
[0342] (3.1.1) Initialize the dictionary as a random orthogonal matrix, and normalize the column vectors to unit vectors;
[0343] (3.1.2) Sparse coding stage: For each training sample ( The sparse coefficients are obtained by solving formula (7) using the LARS algorithm. Error tolerance is taken ;
[0344] (3.1.3) Dictionary update phase: Fixed sparse coefficient matrix Update the dictionary atoms column by column. For the first... A dictionary atom, if the sample index set using this atom Calculate the residual matrix Extract the corresponding Perform SVD decomposition on the columns and take the left singular vector corresponding to the largest singular value as the updated dictionary atom;
[0345] (3.1.4) Repeat steps (3.1.2)-(3.1.3) until convergence (the relative change in reconstruction error is less than 1 / 3). (or reaching the maximum number of iterations) ;
[0346] (3.2) For each class diagram to be evaluated The LARS algorithm is used to solve formula (7) to obtain the sparsity coefficients. ;
[0347] (3.3) Extracting non-zero sparsity coefficients Learning the projection matrix via PCA (in (For average sparsity): Center the non-zero sparse coefficients of all training samples, calculate the covariance matrix and perform eigenvalue decomposition, and select the top... Construct a projection matrix from the eigenvectors corresponding to the largest eigenvalues;
[0348] (3.4) Calculate the manifold coordinates according to formula (8). .
[0349] Step 4: Mapping manifold coordinates to evaluation metrics;
[0350] According to formulas (9)-(14), the manifold coordinates Mapped to evaluation index values :
[0351] (4.1) Calculate the mean of each index from the training set. and standard deviation (Formula (10));
[0352] (4.2) Determine the mapping function through correlation analysis (Formulas (11)-(12)): Calculate the Pearson correlation coefficient between each indicator and all manifold coordinate components, and select the dimension with the highest correlation;
[0353] (4.3) If Calculate using formula (9) ;like Formulas (13)-(14) are used to calculate the weighted average of multiple manifold coordinate components. ;
[0354] (4.4) Obtain the original data matrix .
[0355] Step 5: Construct composite fuzzy matter elements;
[0356] Construct according to formula (16) Class diagrams 3D composite fuzzy matter element ,in For the first Class diagram identifier, For the first One quality evaluation indicator, This corresponds to the value.
[0357] Step 6: Dimensionless processing;
[0358] The evaluation indicators are dimensionless:
[0359] (6.1) Calculate the degree of preference based on the indicator type (positive or negative), using formula (17) or formula (18). For most negative indicators in software quality evaluation, use formula (18): ,in ;
[0360] (6.2) Handling special cases: If ,set up (Formula (19));
[0361] (6.3) Obtain the fuzzy matter element with superior membership degree (Formula (20)).
[0362] Step 7: Calculate the initial weights using the entropy weight method;
[0363] The initial weight vector is calculated using the entropy method. :
[0364] (7.1) Standardize the data according to formula (21): The standardized matrix is obtained. ;
[0365] (7.2) For the matrix Sort each row in descending order to obtain the decision matrix. ;
[0366] (7.3) Calculate the information entropy according to formula (22): ;
[0367] (7.4) Calculate the initial weights according to formulas (23)-(24): The initial weight vector is obtained. .
[0368] Step 8: RLAF iterative optimization;
[0369] Initialize RLAF mechanism parameters: maximum number of iterations Learning rate Discount factor State history length Average reward window Rewards statistics window Deviation threshold Reward fluctuation threshold Weight change threshold Maximum inertia weight Minimum inertia weight lower bound of weight Upper bound of weight small constant .
[0370] Set initial weights .
[0371] Enter the RLAF iterative optimization loop ( ):
[0372] Step 8.1: Discrete maximization calculation;
[0373] from Extracting numerical matrices The weighted decision matrix is calculated according to formula (25). ,in, ( , ).
[0374] Step 8.2: Status Assessment;
[0375] Calculate the deviation of the measurement result according to formula (26): ,in Update the state vector according to formula (27): (for Insufficient historical values filling).
[0376] Step 8.3: Reward Calculation;
[0377] Calculate the reward according to formula (28): The normalized reward is calculated according to formulas (29)-(30): , , .
[0378] Step 8.4: Dynamic inertia weight adjustment;
[0379] Calculate the dynamic inertia weight according to formula (31): The weight adjustment factor is calculated according to formula (32): .
[0380] Step 8.5: First weight adjustment (adaptive adjustment);
[0381] Perform according to formula (33): ,in for Dimensional vector. Normalized according to formula (34): .
[0382] Step 8.6: Calculate the advantage function and policy gradient;
[0383] Calculate the dominance function according to formula (35): ,in Calculate the policy gradient according to formulas (36)-(37): ( ),get ,in for A vector of all 1s.
[0384] Step 8.7: Second weight adjustment (PPO optimization);
[0385] Perform according to formula (38): Apply the Clip mechanism according to formulas (39)-(40): for each component ( ),implement ,make sure Normalization according to formula (41): This yields the weight vector for the next iteration.
[0386] Step 8.8: Convergence judgment;
[0387] According to formulas (42)-(43), condition C1 (deviation threshold convergence) is determined: If ,calculate (in If the value is less than but If true, otherwise false; but It is false.
[0388] According to formula (44), condition C2 (reward stability convergence) is judged: if ,calculate and ,like but If true, otherwise false; but It is false.
[0389] According to formula (45), condition C3 (convergence of weight changes) is determined: Calculate If the value is less than but If true, then false.
[0390] Determine the convergence condition based on formula (46): (Logical AND operation). If... If true, output the optimized weights. And exit the loop; otherwise, let ,like Then return to step 8.1; otherwise, output... And end the iteration.
[0391] Step 9: MARCOS Comprehensive Evaluation;
[0392] Using the MARCOS method for comprehensive software quality evaluation:
[0393] (9.1) Construct a weighted decision matrix according to formula (47). ,in ( , );
[0394] (9.2) Determine the ideal solution according to formulas (48)-(49). and anti-ideal solution ,in ;
[0395] (9.3) Calculate the Euclidean distance between each type of graph and the ideal and antiideal solutions according to formulas (50)-(51): ( );
[0396] (9.4) Calculate the weighted attribute sum according to formulas (52)-(54): ( ), ;
[0397] (9.5) Calculate the utility using formulas (55)-(56): ( );
[0398] (9.6) Calculate the uncertainty weights according to formulas (57)-(59): ( );
[0399] (9.7) Calculate the overall software quality evaluation value according to formula (60): ( ).
[0400] Step 10: Output and sort the results;
[0401] according to value pairs Sort the class diagrams in ascending order. Smaller values indicate lower complexity, better quality, and a higher ranking. The output includes software quality metrics and a ranking list. For each class diagram... Output its comprehensive evaluation value Ranking, weighted scores of each indicator and the optimized weight vector This provides decision support for software quality improvement.
[0402] This invention, starting from information geometry and sparse representation theory, and combining fuzzy matter-element analysis, innovatively introduces a reinforcement learning-based adaptive feedback optimization mechanism (RLAF) and replaces the traditional TOPSIS method with the latest MARCOS method to construct a dynamic software quality measurement model integrating multiple cutting-edge technologies. This model uses the Fisher information metric tensor to characterize the geometric structure of quality features on a Riemannian manifold, utilizes sparse representation techniques to extract key features and achieve dimensionality reduction, employs fuzzy matter-element theory to handle the fuzziness and incompatibility of evaluation indicators, achieves task-based iterative optimization of weights through dynamic inertia weight adjustment in the RLAF mechanism and the PPO algorithm, and finally uses the MARCOS method combined with a binary entropy function for uncertainty-weighted fusion to obtain a comprehensive evaluation value. This model can not only handle situations where the number of evaluation indicators is fuzzy or missing, but also ensures the stability of the optimization process through multi-dimensional convergence judgment, ultimately using only a single comprehensive complexity to evaluate the complexity of the UML class diagram, truly predicting software quality.
[0403] 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 software quality self-adaptive measurement method based on information geometry and reinforcement learning, characterized in that, Includes the following steps: Obtain the raw quality feature data of multiple software class diagrams; Based on the original quality feature data, the low-dimensional manifold coordinates of each software class graph are extracted through information geometric mapping and sparse representation; The process of extracting low-dimensional manifold coordinates for each software class graph based on the original quality feature data through information geometric mapping and sparse representation includes: The original quality feature data is mapped to a statistical manifold composed of a family of probability distributions, and the Fisher information metric tensor is calculated based on the statistical manifold to establish the Riemannian manifold space; wherein, the original quality feature data of each software class graph is regarded as a probability distribution that follows a multivariate Gaussian distribution, and the parameters of the probability distribution are used as coordinates on the statistical manifold to realize the mapping of the original quality feature data to the statistical manifold composed of a family of probability distributions; On the Riemannian manifold space, an overcomplete dictionary is constructed based on training samples using the K-SVD dictionary learning algorithm; the K-SVD algorithm learns the overcomplete dictionary through alternating iterations of sparse coding stage and dictionary update stage; wherein, in the sparse coding stage, the LARS algorithm is used to solve for the sparse representation coefficients of the training samples; and the sparse representation coefficients of the feature vectors of each software class graph under the overcomplete dictionary are solved using the LARS algorithm to solve for the L1 norm constraints. Non-zero elements are extracted from the sparse representation coefficients to form non-zero sparse coefficients; the projection matrix is learned through principal component analysis, and the non-zero sparse coefficients are mapped to a low-dimensional space using the projection matrix to obtain the low-dimensional manifold coordinates; Based on the low-dimensional manifold coordinates, the values of each software class graph on each quality evaluation index are reconstructed, and a composite fuzzy matter element is constructed based on the values of all software class graphs. The composite fuzzy matter-element is dimensionless to obtain the preferred membership matrix; Based on the values obtained from the reconstruction, the initial weights of each evaluation index are calculated using the entropy weight method. Starting with the initial weights, multiple rounds of iterative optimization are performed through a reinforcement learning adaptive feedback mechanism to obtain optimized weights; The optimization weights are obtained through multiple rounds of iterative optimization using a reinforcement learning adaptive feedback mechanism, including the following iterative process: Calculate the weighted decision matrix based on the current weight vector and the preferred membership matrix; calculate the measurement result bias based on the weighted decision matrix; A state vector is constructed based on the deviation of the measurement results; a reward signal is calculated based on the deviation of the measurement results from adjacent iterations. The current weight vector is adjusted for the first time based on a dynamic inertia weighting strategy; the weight vector after the first adjustment is adjusted for the second time based on a near-end strategy optimization algorithm. A multi-dimensional convergence judgment mechanism is used to determine whether to output the optimized weight vector; The multi-dimensional convergence judgment mechanism includes: Determine whether the standard deviation of the measurement results from multiple consecutive iterations is less than a first threshold; Determine whether the ratio of the standard deviation to the mean of the reward signal over multiple consecutive iterations is less than a second threshold; Determine whether the Euclidean distance between the weight vectors of two adjacent iterations is less than the third threshold; When all the judgment conditions are met at the same time, the current weight vector is output as the optimized weight vector. Based on the optimized weights and the preferred membership matrix, the MARCOS method is used to calculate the comprehensive evaluation value of each software class diagram; The software quality measurement results are output based on the comprehensive evaluation value.
2. The adaptive software quality measurement method based on information geometry and reinforcement learning according to claim 1, characterized in that, The process of reconstructing the values of each software class graph on each quality evaluation index based on the low-dimensional manifold coordinates, and constructing composite fuzzy matter elements based on the values of all software class graphs, includes: Based on the statistical characteristics of each evaluation index in the training set, a mapping relationship from manifold coordinates to evaluation index values is established. Based on this mapping relationship, the correspondence between each evaluation index and manifold coordinate components is determined through correlation analysis. Based on this correspondence, the low-dimensional manifold coordinates of each software class graph are reconstructed into the values of each evaluation index. Based on the reconstructed values of each evaluation index, a composite fuzzy matter element is constructed.
3. The adaptive software quality measurement method based on information geometry and reinforcement learning according to claim 1, characterized in that, The process of dimensionless transformation of the composite fuzzy matter-element to obtain the preferred membership matrix includes: The eigenvalues in the composite fuzzy matter element are dimensionless. The inverse index is obtained by calculating the ratio of the difference between the maximum value and the current value of the index to the difference between the maximum value and the minimum value of the index. The positive index is obtained by calculating the ratio of the difference between the current value and the minimum value of the index to the difference between the maximum value and the minimum value of the index. When the maximum value of the index is equal to the minimum value, the corresponding optimal membership degree is set to a predetermined value. An optimal membership degree matrix is constructed based on all the optimal membership degrees.
4. The adaptive software quality measurement method based on information geometry and reinforcement learning according to claim 1, characterized in that, The process of calculating the initial weights of each evaluation index using the entropy weight method based on the reconstructed values includes: An original data matrix is constructed based on the reconstructed values. The original data matrix is then standardized to obtain a standardized matrix. The information entropy of each evaluation indicator is calculated based on the standardized matrix. The information utility coefficient of each evaluation indicator is calculated based on the information entropy. The initial weights are determined based on the information utility coefficients.
5. The adaptive software quality measurement method based on information geometry and reinforcement learning according to claim 1, characterized in that, The process of calculating the comprehensive evaluation value of each software class diagram using the MARCOS method includes: The optimized membership matrix is weighted using the optimized weights to obtain a weighted decision matrix; the ideal solution vector and the anti-ideal solution vector are determined from the weighted decision matrix; based on the weighted decision matrix, the ideal solution vector, and the anti-ideal solution vector, the relevant parameters of each software class graph with respect to the ideal solution and the anti-ideal solution are calculated; based on the relevant parameters, the comprehensive evaluation value of each software class graph is calculated by weighted fusion.
6. The adaptive software quality measurement method based on information geometry and reinforcement learning according to claim 5, characterized in that, Calculate the relevant parameters for each software class diagram with respect to the ideal and antiideal solutions, including performing the following calculations for each software class diagram: Calculate the first Euclidean distance between the weighted vector in the weighted decision matrix and the ideal solution vector; calculate the second Euclidean distance between the weighted vector and the anti-ideal solution vector; The sum of all weighted values in the weighted decision matrix is calculated as the weighted attribute sum; a first utility is calculated based on the sum of the weighted attribute sum and the sum of the ideal solution vector; a second utility is calculated based on the sum of the weighted attribute sum and the sum of the anti-ideal solution vector.
7. The method according to claim 6, characterized in that, Based on the aforementioned parameters, a comprehensive evaluation value for each software class diagram is calculated through weighted fusion, including: For each software class graph, based on its first utility and second utility, the first uncertainty weight and the second uncertainty weight are calculated using the binary entropy function; based on the first uncertainty weight, the second uncertainty weight, the first Euclidean distance, and the second Euclidean distance, a weighted fusion is performed to obtain the comprehensive evaluation value of the software class graph.