NMF and machine learning based high throughput xrf data processing method and system
Patent Information
- Application Number
- CN202311354558.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-18
- Publication Date
- 2026-09-08
- Estimated Expiration
- 2043-10-18
AI Technical Summary
但是该算法对微量元素的识别能力较差,泛化能力有待增强
[0091](1) By introducing reconstruction error coefficient, contour coefficient and performance index, the problem of users not knowing the types of elements in advance is solved, the main parameter N of the automatic optimization algorithm is achieved, and the robustness and generalization ability of the algorithm are improved.
Smart Images

Figure CN117421624B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of automated high-throughput XRF data processing technology, specifically, to a high-throughput XRF data processing method and system based on NMF and machine learning. Wherein, NMF is a nonnegative matrix factorization algorithm, and XRF is X-ray fluorescence spectroscopy. Background Technology
[0002] The basic principle of X-ray fluorescence spectroscopy (XRF) is that when a high-energy X-ray with energy higher than the binding energy of an inner-shell electron collides with an atom, it expels an inner-shell electron, creating a hole. The energy released when an outer-shell electron jumps into the inner-shell hole is not absorbed within the atom but is emitted as radiation, producing X-ray fluorescence. The energy of this fluorescence is equal to the energy difference between the two energy levels. Therefore, the energy or wavelength of X-ray fluorescence is characteristic and has a one-to-one correspondence with the element. However, quantitative analysis of XRF is complex due to the influence of changes in the basic chemical composition and physicochemical state of the sample on the intensity of X-ray fluorescence. Currently, the basic parameter method is generally used for quantitative XRF analysis. This method calculates the theoretical intensity of elemental X-ray fluorescence using a standard or pure substance, considering the absorption and enhancement effects between elements, and then measures the intensity of the fluorescence rays. The measured intensity is compared with the theoretical intensity to determine the sensitivity coefficient of the element. When measuring unknown samples, the X-ray fluorescence intensity of the sample is measured first, and an initial concentration value is set based on the measured intensity and the sensitivity coefficient. The theoretical intensity is then calculated from this concentration value. This method requires additional standard preparation and adds considerable characterization, making it time-consuming and labor-intensive. Furthermore, high-throughput XRF data is characterized by large data volume and complex structure, necessitating efficient, simple parameter tuning, and accurate analysis methods. Therefore, this high-throughput XRF data processing method and system was developed by combining NMF and machine learning.
[0003] Patent document CN115600061A discloses a machine learning-based method for processing zero-dropout inverter data. The method includes: acquiring a current data sequence from the AC side voltage transformer circuit of the inverter; calculating the grouping length based on the maximum and minimum values in the current data sequence; grouping the current data sequence to obtain a current data matrix; performing singular value decomposition on the current data matrix to obtain multiple sub-matrices; calculating the correlation between two sub-matrices; grouping the sub-matrices according to the correlation; processing the sub-matrices within each group to obtain a diagonal element sequence; calculating a noise evaluation value; deleting diagonal element sequences whose values are less than the evaluation threshold; calculating the noise level; determining the weights; weighted summing of all diagonal element sequences according to the weights to obtain a denoised current sequence; determining whether anomalies exist; and processing the abnormal data.
[0004] The journal "Journal de Physique IV" published a method for XRF data processing based on principal component analysis in Volume 104, pp. 617-622, 2003. Although this method can obtain the characteristic fluorescence lines of elements based on mathematical decomposition, the principal component analysis algorithm does not have a non-negativity constraint, which may result in negative spectral lines under certain conditions, causing the results to violate physical laws.
[0005] The journal "Journal of Physics: Conference Series" published a method for processing XRF data based on nonnegative matrix factorization algorithm in Volume 449, pp. 1-10, 2014. Although this method provides the constraint of nonnegativity, the selection of the main parameter N depends on the user's experience and understanding of the sample. Noise and impurity elements have a significant impact on the results, and the robustness of the algorithm needs improvement.
[0006] The journal *Microchemical Journal* published a method for processing XRF data based on the Single Shape Volume Maximization (SiVM) algorithm in Volume 132, 2017, pp. 179-184. This algorithm preserves the non-negativity of the XRF dataset and has low computational resource requirements. However, its ability to identify trace elements is poor, and its generalization ability needs improvement. Summary of the Invention
[0007] To address the shortcomings of existing technologies, the purpose of this invention is to provide a high-throughput XRF data processing method and system based on NMF and machine learning.
[0008] The high-throughput XRF data processing method based on NMF and machine learning provided by the present invention includes:
[0009] Step 1: The user inputs the number of elements n, n>1, and specifies the number of loops m;
[0010] Step 2: Using n as the initial value, perform parameter optimization to determine the most suitable number of basic modes N for quantitative analysis;
[0011] Step 3: Run the NMF algorithm independently m times for each of the N base patterns to obtain N*m base patterns;
[0012] Step 4: Import the N*m base patterns obtained in Step 3 into the machine learning clustering algorithm to cluster into N classes. For each class, N average base patterns are obtained by averaging.
[0013] Step 5: Based on the least squares optimization algorithm, decompose the XRF data one by one in the N average basis modes obtained in step 4 to obtain the corresponding coefficients, which are the element percentage contents.
[0014] Step 6: Compare the N average base patterns obtained in Step 4 with the element database to determine the element type corresponding to each average base pattern.
[0015] Preferably, step 2 includes:
[0016] Step 2.1: Define the reconstruction error coefficient R, with the following expression:
[0017]
[0018] Where X is the observation matrix, W is the basic mode matrix, H is the coefficient matrix, and F is the norm;
[0019] Define the profile coefficient S as follows:
[0020]
[0021] Where a represents intra-cluster dissimilarity; b represents inter-cluster dissimilarity;
[0022] Define the performance metric P as follows:
[0023] P = A·|R| + B·(1-S)
[0024] Where A and B are weighting coefficients, which are adjusted according to user needs;
[0025] The range of the reconstruction error coefficient R and the silhouette coefficient S is [-1, 1]. The closer R is to 0, the better the fit. The closer S is to 1, the more reasonable the clustering. The performance index P measures the suitability of the fitting parameters. The closer P is to 0, the more suitable the fitting parameters are.
[0026] Preferably, step 2 includes:
[0027] Step 2.2: Using n as the number of base patterns, run the NMF algorithm independently for a preset number of times. Import the obtained base patterns into a machine learning clustering algorithm to cluster into n classes. For each class, obtain n average base patterns by averaging. Calculate the corresponding reconstruction error coefficient R based on the clustering results. n and profile coefficient S n This leads to the performance index P. n ;
[0028] Step 2.3: Using n+1 as the base pattern number, run the NMF algorithm independently for a preset number of times. Import the obtained base patterns into a machine learning clustering algorithm to cluster them into n+1 classes. For each class, obtain n+1 average base patterns by averaging. Calculate the corresponding reconstruction error coefficient R based on the clustering results. n+1 and profile coefficient S n+1 This leads to the performance index P. n+1;
[0029] Step 2.4: Using n-1 as the base pattern number, run the NMF algorithm independently for a preset number of times. Import the obtained base patterns into a machine learning clustering algorithm to cluster them into n-1 classes. For each class, obtain n-1 average base patterns by averaging. Calculate the corresponding reconstruction error coefficient R based on the clustering results. n-1 and profile coefficient S n-1 This leads to the performance index P. n-1 ;
[0030] Step 2.5: Compare P n P n+1 and P n-1 If P n If the value is closest to 0, then N = n, the process ends, and the most suitable number of base patterns N is output; if P n+1 If the value is closest to 0, then N = n + 1, step size coefficient k = 1, and the process continues; if P n-1 If the value is closest to 0 and n-1 = 1, then N = n-1, the process ends, and the most suitable number of base patterns N is output; if P n-1 If the value is closest to 0 and n-1 > 1, then N = n-1, step size coefficient k = -1, and the process continues;
[0031] Step 2.6: Using N+k as the base number, run the NMF algorithm independently for a preset number of times, and calculate the corresponding reconstruction error coefficient R. N+k and profile coefficient S N+k This leads to the performance index P. N+k ;
[0032] Step 2.7: Compare P N and P N+k If P N If the value is closer to 0, the process ends and N is output; otherwise, return to step 2.6 for execution.
[0033] Preferably, step 3 includes:
[0034] Step 3.1: Generate N vectors as base patterns based on a random seed;
[0035] Step 3.2: Regularize the high-throughput XRF data and convert it into a matrix X;
[0036] Step 3.3: Based on the NMF algorithm principle, use the multiplicative update algorithm to solve for N basis patterns, where the NMF algorithm principle is as follows:
[0037]
[0038] Among them, X n (λ) represents the nth XRF spectrum, Wk (λ) represents the k-th base pattern, H k;n Let ε be the weighting coefficient for . n (λ) represents the noise or systematic error that may exist or is unknown in the measurement, and W k (λ) and H k;n None of them are negative;
[0039] XRF signals are formed by the linear superposition of fluorescence signals of each element. Therefore, the physical meaning of the ground mode is the characteristic fluorescence spectrum of the element, and the physical meaning of the weighting coefficient is the atomic percentage of the element.
[0040] To ensure the uniqueness of the NMF numerical solution, a regularization constraint is added:
[0041]
[0042] Its physical meaning is that, under the same test parameters, the number of atoms excited by X-ray fluorescence spectroscopy is basically the same;
[0043] The multiplicative update algorithm is used in the NMF solution process, and its optimization objective is the Frobenius norm, as shown in the following formula:
[0044]
[0045] Step 3.4: Repeat steps 3.1-3.3 a total of m times to obtain N*m base patterns.
[0046] Preferably, step 4 includes: employing an improved K-means machine learning clustering algorithm, wherein the clustering process uses cosine distance to measure the similarity between patterns, and the calculation formula is as follows:
[0047]
[0048] The improvement of the K-means machine learning clustering algorithm lies in the addition of a constraint: each cluster must contain exactly m base patterns.
[0049] The high-throughput XRF data processing system based on NMF and machine learning provided by the present invention includes:
[0050] Module M1: The user inputs the number of elements n, where n > 1, and specifies the number of loops m;
[0051] Module M2: Using n as the initial value, perform parameter optimization to determine the most suitable number N of basic modes for quantitative analysis;
[0052] Module M3: Run the NMF algorithm independently m times for each of the N base patterns to obtain N*m base patterns;
[0053] Module M4: Imports the N*m base patterns obtained in Module M3 into the machine learning clustering algorithm, clusters them into N classes, and obtains N average base patterns for each class by averaging.
[0054] Module M5: Based on the least squares optimization algorithm, the XRF data is decomposed one by one in the N average basis modes obtained by module M4 to obtain the corresponding coefficients, which are the percentage contents of elements.
[0055] Module M6: Compares the N average base patterns obtained from module M4 with the element database to determine the element type corresponding to each average base pattern.
[0056] Preferably, the module M2 includes:
[0057] Module M2.1: Defines the reconstruction error coefficient R, with the following expression:
[0058]
[0059] Where X is the observation matrix, W is the basic mode matrix, H is the coefficient matrix, and F is the norm;
[0060] Define the profile coefficient S as follows:
[0061]
[0062] Where a represents intra-cluster dissimilarity; b represents inter-cluster dissimilarity;
[0063] Define the performance metric P as follows:
[0064] P = A·|R| + B·(1-S)
[0065] Where A and B are weighting coefficients, which are adjusted according to user needs;
[0066] The range of the reconstruction error coefficient R and the silhouette coefficient S is [-1, 1]. The closer R is to 0, the better the fit. The closer S is to 1, the more reasonable the clustering. The performance index P measures the suitability of the fitting parameters. The closer P is to 0, the more suitable the fitting parameters are.
[0067] Preferably, the module M2 includes:
[0068] Module M2.2: Run the NMF algorithm independently a preset number of times with n as the base pattern count. Import the obtained base patterns into a machine learning clustering algorithm, clustering them into n classes. For each class, obtain n average base patterns by averaging. Calculate the corresponding reconstruction error coefficient R based on the clustering results. n and profile coefficient S n This leads to the performance index P. n ;
[0069] Module M2.3: Using n+1 as the base pattern number, the NMF algorithm is run independently for a preset number of times. The resulting base patterns are imported into a machine learning clustering algorithm, forming n+1 classes. For each class, n+1 average base patterns are obtained by averaging. Based on the clustering results, the corresponding reconstruction error coefficient R is calculated. n+1 and profile coefficient S n+1 This leads to the performance index P. n+1 ;
[0070] Module M2.4: Using n-1 as the base pattern count, the NMF algorithm is run independently a preset number of times. The resulting base patterns are imported into a machine learning clustering algorithm, forming n-1 classes. For each class, n-1 average base patterns are obtained by averaging. Based on the clustering results, the corresponding reconstruction error coefficient R is calculated. n-1 and profile coefficient S n-1 This leads to the performance index P. n-1 ;
[0071] Module M2.5: Compare P n P n+1 and P n-1 If Pn is closest to 0, then N = n, the process ends, and the most suitable number of base patterns N is output; if P n+1 If the value is closest to 0, then N = n + 1, step size coefficient k = 1, and the process continues; if P n-1 If the value is closest to 0 and n-1 = 1, then N = n-1, the process ends, and the most suitable number of base patterns N is output; if P n-1 If the value is closest to 0 and n-1 > 1, then N = n-1, step size coefficient k = -1, and the process continues;
[0072] Module M2.6: Using N+k as the base number, independently run the NMF algorithm a preset number of times to calculate the corresponding reconstruction error coefficient R. N+k and profile coefficient S N+k This leads to the performance index P. N+k ;
[0073] Module M2.7: Comparison P N and P N+k If P N If the value is closer to 0, the process ends and N is output; otherwise, module M2.6 is triggered to execute.
[0074] Preferably, the module M3 includes:
[0075] Module M3.1: Generates N vectors as base patterns based on a random seed;
[0076] Module M3.2: Regularizes high-throughput XRF data, converting it into a matrix X;
[0077] Module M3.3: Based on the NMF algorithm principle, a multiplicative update algorithm is used to solve for N basis patterns. The NMF algorithm principle is as follows:
[0078]
[0079] Among them, X n (λ) represents the nth XRF spectrum, W k (λ) represents the k-th base pattern, H k;n Let ε be the weighting coefficient for . n (λ) represents the noise or systematic error that may exist or is unknown in the measurement, and W k (λ) and H k;n None of them are negative;
[0080] XRF signals are formed by the linear superposition of fluorescence signals of each element. Therefore, the physical meaning of the ground mode is the characteristic fluorescence spectrum of the element, and the physical meaning of the weighting coefficient is the atomic percentage of the element.
[0081] To ensure the uniqueness of the NMF numerical solution, a regularization constraint is added:
[0082]
[0083] Its physical meaning is that, under the same test parameters, the number of atoms excited by X-ray fluorescence spectroscopy is basically the same;
[0084] The multiplicative update algorithm is used in the NMF solution process, and its optimization objective is the Frobenius norm, as shown in the following formula:
[0085]
[0086] Module M3.4: Repeatedly trigger modules M3.1-M3.3 a total of m times to obtain N*m base patterns.
[0087] Preferably, module M4 includes: employing an improved K-means machine learning clustering algorithm, wherein the clustering process uses cosine distance to measure the similarity between patterns, and the calculation formula is as follows:
[0088]
[0089] The improvement of the K-means machine learning clustering algorithm lies in the addition of a constraint: each cluster must contain exactly m base patterns.
[0090] Compared with the prior art, the present invention has the following beneficial effects:
[0091] (1) By introducing reconstruction error coefficient, contour coefficient and performance index, the problem of users not knowing the types of elements in advance is solved, the main parameter N of the automatic optimization algorithm is achieved, and the robustness and generalization ability of the algorithm are improved.
[0092] (2) By adopting the non-negative matrix decomposition algorithm, the problem of the difficulty in decomposing the fluorescence signal mode of pure elements in the mixture is solved, and the effect of accurately separating the fluorescence signal mode of pure substances without the need to prepare additional standard samples is achieved.
[0093] (3) By adopting clustering algorithms in machine learning, the initial value sensitivity problem of the non-negative matrix factorization algorithm is solved, thereby improving the robustness of the non-negative matrix factorization algorithm.
[0094] (4) By combining nonnegative matrix factorization and machine learning clustering algorithms, the problems of high-throughput XRF data being difficult to analyze, difficult to reduce noise, and requiring a large number of standard samples for auxiliary analysis are solved, thus realizing automated and efficient processing of high-throughput XRF data. Attached Figure Description
[0095] Other features, objects, and advantages of the present invention will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings:
[0096] Figure 1 This is a flowchart of the data processing of the present invention. Detailed Implementation
[0097] The present invention will now be described in detail with reference to specific embodiments. These embodiments will help those skilled in the art to further understand the present invention, but do not limit the invention in any way. It should be noted that those skilled in the art can make several changes and improvements without departing from the concept of the present invention. These all fall within the protection scope of the present invention.
[0098] Example 1
[0099] like Figure 1 The core of this invention is to combine nonnegative matrix factorization and machine learning clustering algorithms, and the specific steps are as follows:
[0100] Step 1: The user inputs the number of elements n (n>1) and specifies the number of loops m;
[0101] Step 2: Using n as the initial value, perform parameter optimization to determine the most suitable number N of basic patterns for quantitative analysis;
[0102] Step 3: Run the NMF algorithm independently m times for each of the N base patterns to obtain N*m base patterns.
[0103] Step 4: Import the N*m base patterns obtained in Step 3 into the machine learning clustering algorithm to form N classes. For each class, N average base patterns are obtained by averaging.
[0104] Step 5: Based on the least squares optimization algorithm, decompose the XRF data one by one in the N average basis modes obtained in step 4 to obtain the corresponding coefficients, which are the element percentage contents.
[0105] Step 6: Compare the N average base patterns obtained in Step 4 with the element database to determine the element type corresponding to each average base pattern.
[0106] Step 2 includes the following steps:
[0107] Step 2.1: Define the reconstruction error coefficient R:
[0108]
[0109] Where X is the observation matrix, W is the basic mode matrix, H is the coefficient matrix, and F is the norm.
[0110] Define the silhouette width S:
[0111]
[0112] Where a represents intra-cluster dissimilarity; b represents inter-cluster dissimilarity;
[0113] Define performance metric P:
[0114] P = A·|R| + B·(1-S)
[0115] Among them, A and B are weighting coefficients, which can be adjusted according to user needs;
[0116] The reconstruction error coefficient R and the silhouette coefficient S both range from -1 to 1. A value closer to 0 for R indicates a better fit. A value closer to 1 for S indicates reasonable clustering. The performance index P measures the suitability of the fitting parameters; a value closer to 0 for P indicates more suitable fitting parameters.
[0117] Introduce the step size coefficient k.
[0118] Step 2.2: Using n as the number of base patterns, run the NMF algorithm independently 20 times. Import the resulting n*20 base patterns into a machine learning clustering algorithm, clustering them into n classes. For each class, calculate the average of the n base patterns. Based on the clustering results, calculate the corresponding reconstruction error coefficient R. n and profile coefficient S n This leads to the performance index P.n .
[0119] Step 2.3: Using n+1 as the base pattern number, run the NMF algorithm independently 20 times. Import the resulting (n+1)*20 base patterns into a machine learning clustering algorithm, clustering them into n+1 classes. For each class, calculate the average of n+1 base patterns. Based on the clustering results, calculate the corresponding reconstruction error coefficient R. n+1 and profile coefficient S n+1 This leads to the performance index P. n+1 .
[0120] Step 2.4: Using n-1 as the base pattern number, run the NMF algorithm independently 20 times. Import the resulting (n-1)*20 base patterns into a machine learning clustering algorithm, clustering them into n-1 classes. For each class, calculate the average of n-1 base patterns. Based on the clustering results, calculate the corresponding reconstruction error coefficient R. n-1 and profile coefficient S n-1 This leads to the performance index P. n-1 .
[0121] Step 2.5: Compare P n P n+1 and P n-1 If P n If the value is closest to 0, then N = n, the process ends, and the most suitable number of base patterns N is output; if P n+1 If the value is closest to 0, then N = n + 1, step size coefficient k = 1, and the process continues; if P n-1 If the value is closest to 0 and n-1 = 1, then N = n-1, the process ends, and the most suitable number of base patterns N is output; if P n-1 If the value is closest to 0 and n-1 > 1, then N = n-1, the step size coefficient k = -1, and the process continues.
[0122] Step 2.6: Using N+k as the base number, run the NMF algorithm independently 20 times and calculate the corresponding reconstruction error coefficient R. N+k and profile coefficient S N+k This leads to the performance index P. N+k .
[0123] Step 2.7: Compare P N and P N+k If P N If the value is closer to 0, the process ends and N is output; otherwise, it returns to step 2.6 for iterative looping.
[0124] Step 3 includes the following steps:
[0125] Step 3.1: Generate N vectors as base patterns based on random seeds.
[0126] Step 3.2: Regularize the high-throughput XRF data and convert it into a matrix X (X∈M). NM (R+)).
[0127] Step 3.3: Based on the NMF algorithm principle, use the multiplicative update algorithm to solve for the N basis patterns. The NMF algorithm principle is as follows:
[0128]
[0129] Among them, X n (λ) represents the nth XRF spectrum, W k (λ) represents the k-th base pattern, H k;n Let ε be the weighting coefficient for . n (λ) represents noise or systematic error that may exist or is unknown in the measurement. And W k (λ) and H k;n All values are negative, ensuring the solution conforms to the laws of physics. The fundamental physical principle is that the XRF signal is a linear superposition of the fluorescence signals of each element. Therefore, the physical meaning of the basis mode is the characteristic fluorescence spectrum of the element, and the physical meaning of the weighting coefficients is the atomic percentage of the element.
[0130] Since the numerical solution obtained solely from the above formula is not unique, in fact, there can be an infinite number of combinations of w and H to form the same observation data matrix X. To ensure the uniqueness of the NMF numerical solution, we add a regularization constraint:
[0131]
[0132] The physical meaning is that, under the same test parameters, the number of atoms excited by X-ray fluorescence spectroscopy is basically the same.
[0133] The multiplicative update algorithm was used in the NMF solution process, and its optimization objective was the Frobenius norm, as shown in the following formula:
[0134]
[0135] Step 3.4: Repeat steps 3.1-3.3 a total of m times to obtain N*m base patterns.
[0136] The specific steps of step 4 are as follows:
[0137] Clustering employs a modified K-means machine learning clustering algorithm. The clustering process uses cosine distance to measure the similarity between patterns, calculated as follows:
[0138]
[0139] The improvement of K-means lies in the addition of a constraint: each cluster must contain exactly m base patterns, so that the clustering results do not violate the laws of physics.
[0140] Example 2
[0141] The present invention also provides a high-throughput XRF data processing system based on NMF and machine learning. The high-throughput XRF data processing system based on NMF and machine learning can be implemented by executing the process steps of the high-throughput XRF data processing method based on NMF and machine learning. That is, those skilled in the art can understand the high-throughput XRF data processing method based on NMF and machine learning as a preferred embodiment of the high-throughput XRF data processing system based on NMF and machine learning.
[0142] The high-throughput XRF data processing system based on NMF and machine learning provided by the present invention includes:
[0143] Module M1: The user inputs the number of elements n, where n>1, and specifies the number of loops m;
[0144] Module M2: Using n as the initial value, perform parameter optimization to determine the most suitable number N of basic modes for quantitative analysis;
[0145] Module M3: Run the NMF algorithm independently m times for each of the N base patterns to obtain N*m base patterns;
[0146] Module M4: Imports the N*m base patterns obtained in Module M3 into the machine learning clustering algorithm, clusters them into N classes, and obtains N average base patterns for each class by averaging.
[0147] Module M5: Based on the least squares optimization algorithm, the XRF data is decomposed one by one in the N average basis modes obtained by module M4 to obtain the corresponding coefficients, which are the percentage contents of elements.
[0148] Module M6: Compares the N average base patterns obtained from module M4 with the element database to determine the element type corresponding to each average base pattern.
[0149] The module M2 includes:
[0150] Module M2.1: Defines the reconstruction error coefficient R, with the following expression:
[0151]
[0152] Where X is the observation matrix, w is the basic mode matrix, H is the coefficient matrix, and F is the norm;
[0153] Define the profile coefficient S as follows:
[0154]
[0155] Where a represents intra-cluster dissimilarity; b represents inter-cluster dissimilarity;
[0156] Define the performance metric P as follows:
[0157] P = A·|R| + B·(1-S)
[0158] Where A and B are weighting coefficients, which are adjusted according to user needs;
[0159] The range of the reconstruction error coefficient R and the silhouette coefficient S is [-1, 1]. The closer R is to 0, the better the fit. The closer S is to 1, the more reasonable the clustering. The performance index P measures the suitability of the fitting parameters. The closer P is to 0, the more suitable the fitting parameters are.
[0160] Module M2.2: Run the NMF algorithm independently a preset number of times with n as the base pattern count. Import the obtained base patterns into a machine learning clustering algorithm, clustering them into n classes. For each class, obtain n average base patterns by averaging. Calculate the corresponding reconstruction error coefficient R based on the clustering results. n and profile coefficient S n This leads to the performance index P. n ;
[0161] Module M2.3: Using n+1 as the base pattern number, the NMF algorithm is run independently for a preset number of times. The resulting base patterns are imported into a machine learning clustering algorithm, forming n+1 classes. For each class, n+1 average base patterns are obtained by averaging. Based on the clustering results, the corresponding reconstruction error coefficient R is calculated. n+1 and profile coefficient S n+1 This leads to the performance index P. n+1 ;
[0162] Module M2.4: Using n-1 as the base pattern count, the NMF algorithm is run independently a preset number of times. The resulting base patterns are imported into a machine learning clustering algorithm, forming n-1 classes. For each class, n-1 average base patterns are obtained by averaging. Based on the clustering results, the corresponding reconstruction error coefficient R is calculated. n-1 and profile coefficient S n-1 This leads to the performance index P. n-1 ;
[0163] Module M2.5: Compare P n P n+1 and P n-1 If P nIf the value is closest to 0, then N = n, the process ends, and the most suitable number of base patterns N is output; if P n+1 If the value is closest to 0, then N = n + 1, step size coefficient k = 1, and the process continues; if P n-1 If the value is closest to 0 and n-1 = 1, then N = n-1, the process ends, and the most suitable number of base patterns N is output; if P n-1 If the value is closest to 0 and n-1 > 1, then N = n-1, step size coefficient k = -1, and the process continues;
[0164] Module M2.6: Using N+k as the base number, independently run the NMF algorithm a preset number of times to calculate the corresponding reconstruction error coefficient R. N+k and profile coefficient S N+k This leads to the performance index P. N+k ;
[0165] Module M2.7: Comparison P N and P N+k If P N If the value is closer to 0, the process ends and N is output; otherwise, module M2.6 is triggered to execute.
[0166] The module M3 includes:
[0167] Module M3.1: Generates N vectors as base patterns based on a random seed;
[0168] Module M3.2: Regularizes high-throughput XRF data, converting it into a matrix X;
[0169] Module M3.3: Based on the NMF algorithm principle, a multiplicative update algorithm is used to solve for N basis patterns. The NMF algorithm principle is as follows:
[0170]
[0171] Among them, X n (λ) represents the nth XRF spectrum, W k (λ) represents the k-th base pattern, H k;n Let ε be the weighting coefficient for . n (λ) represents the noise or systematic error that may exist or is unknown in the measurement, and W k (λ) and H k;n None of them are negative;
[0172] XRF signals are formed by the linear superposition of fluorescence signals of each element. Therefore, the physical meaning of the ground mode is the characteristic fluorescence spectrum of the element, and the physical meaning of the weighting coefficient is the atomic percentage of the element.
[0173] To ensure the uniqueness of the NMF numerical solution, a regularization constraint is added:
[0174]
[0175] Its physical meaning is that, under the same test parameters, the number of atoms excited by X-ray fluorescence spectroscopy is basically the same;
[0176] The multiplicative update algorithm is used in the NMF solution process, and its optimization objective is the Frobenius norm, as shown in the following formula:
[0177]
[0178] Module M3.4: Repeatedly trigger modules M3.1-M3.3 a total of m times to obtain N*m base patterns.
[0179] The module M4 includes: an improved K-means machine learning clustering algorithm, in which cosine distance is used to measure the similarity between patterns during the clustering process, and the calculation formula is as follows:
[0180]
[0181] The improvement of the K-means machine learning clustering algorithm lies in the addition of a constraint: each cluster must contain exactly m base patterns.
[0182] Example 3
[0183] Application Scenarios: Amorphous alloys, also known as metallic glasses, exhibit excellent mechanical and magnetic properties due to their short-range ordered and long-range disordered atomic structure, making them a focus of attention in engineering applications. The Pd-Si-Cu ternary system is currently a relatively mature amorphous system. Our research group has fabricated a large number of Pd-Si-Cu composite material chips using ion beam sputtering with quartz glass as a substrate and performed high-throughput XRF characterization, obtaining high-throughput XRF data. Since the quartz glass substrate also contains Si, traditional XRF data analysis is difficult to perform precise quantitative analysis, and the high-throughput XRF data is massive, necessitating efficient methods. Therefore, we adopted this invention—a high-throughput XRF data processing method based on nonnegative matrix factorization and machine learning clustering.
[0184] The specific steps for application are as follows:
[0185] Step 1: Since the sample is a ternary system and the substrate contains oxygen, the number of input elements is 4. In order to make the results more robust, the number of cycles is specified as 20.
[0186] Step 2: The algorithm uses 4 as the initial value to optimize the parameters and determine the most suitable number of basic patterns N=5 for quantitative analysis;
[0187] Step 3: The algorithm is run independently 20 times with 5 base patterns each, resulting in 100 base patterns;
[0188] Step 4: The algorithm imports the 100 base patterns obtained in Step 3 into the machine learning clustering algorithm, clusters them into 5 classes, and obtains 5 average base patterns for each class by averaging.
[0189] Step 5: Based on the least squares optimization algorithm, decompose the XRF data one by one in the five average basis modes obtained in step 4 to obtain the corresponding coefficients, which are the abundance of the elements.
[0190] Step 6: Compare the five average base patterns obtained in Step 4 with the element database to determine the element type corresponding to each average base pattern.
[0191] Results Analysis: By comparing with an elemental database, the algorithm successfully identified five fundamental modes, corresponding to Pd, Si, Cu, SiO2, and impurity elements. One fundamental mode corresponds to a compound because this compound has a relatively stable elemental ratio and mainly exists as a background signal. The algorithm incorporated a setting to remove redundant fundamental modes during its design, so the two were not distinguished during parameter optimization. Secondly, due to different atomic environments, the characteristic fluorescence signals of Si in Pd-Si-Cu and Si in quartz glass are not consistent, thus allowing for effective differentiation by the algorithm. Considering the systematic errors in characterization and the presence of trace impurities in the sample, the fundamental modes also represent this interference using a single fundamental mode. After determining the physical meaning of each fundamental mode, content correction was performed: the abundance of SiO2 and impurity elements was removed, and the Pd, Si, and Cu elements were re-normalized to obtain an accurate elemental distribution.
[0192] In summary, this invention accurately and rapidly identifies the characteristic fluorescence signals of Pd, Si, and Cu elements, efficiently extracting elemental abundance distributions from massive datasets. It also effectively addresses the issue of high signal overlap between the sample and the substrate, demonstrating strong generalization ability. Furthermore, this invention exhibits high robustness in addressing characterization system errors and the presence of trace impurities in the sample.
[0193] Those skilled in the art will understand that, in addition to implementing the system, apparatus, and their modules provided by this invention in purely computer-readable program code, the same program can be implemented in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers by logically programming the method steps. Therefore, the system, apparatus, and their modules provided by this invention can be considered a hardware component, and the modules included therein for implementing various programs can also be considered structures within the hardware component; alternatively, modules for implementing various functions can be considered both software programs implementing the method and structures within the hardware component.
[0194] Specific embodiments of the present invention have been described above. It should be understood that the present invention is not limited to the specific embodiments described above, and those skilled in the art can make various changes or modifications within the scope of the claims, which do not affect the essence of the present invention. Unless otherwise specified, the embodiments and features described in this application can be arbitrarily combined with each other.
Claims
1. A high-throughput XRF data processing method based on NMF and machine learning, characterized in that, include: Step 1: The user inputs the number of elements n, n>1, and specifies the number of loops m; Step 2: Using n as the initial value, perform parameter optimization to determine the most suitable number of basic modes N for quantitative analysis; Step 3: Run the NMF algorithm independently m times for each of the N base patterns to obtain N*m base patterns; Step 4: Import the N*m base patterns obtained in Step 3 into the machine learning clustering algorithm to cluster into N classes. For each class, N average base patterns are obtained by averaging. Step 5: Based on the least squares optimization algorithm, decompose the XRF data one by one in the N average basis modes obtained in step 4 to obtain the corresponding coefficients, which are the element percentage contents. Step 6: Compare the N average base patterns obtained in Step 4 with the element database to determine the element type corresponding to each average base pattern; Step 2 includes: Step 2.1: Define the reconstruction error coefficient R, with the following expression: Where X is the observation matrix, W is the basic mode matrix, H is the coefficient matrix, and F is the norm; Define the profile coefficient S as follows: Where a represents intra-cluster dissimilarity; b represents inter-cluster dissimilarity; Define the performance metric P as follows: Where A and B are weighting coefficients, which are adjusted according to user needs; The range of the reconstruction error coefficient R and the silhouette coefficient S is [-1, 1]. The closer R is to 0, the better the fit. The closer S is to 1, the more reasonable the clustering. The performance index P measures the suitability of the fitting parameters. The closer P is to 0, the more suitable the fitting parameters are.
2. The high-throughput XRF data processing method based on NMF and machine learning according to claim 1, characterized in that, Step 2 includes: Step 2.2: Using n as the number of base patterns, run the NMF algorithm independently for a preset number of times. Import the obtained base patterns into a machine learning clustering algorithm to cluster them into n classes. For each class, obtain n average base patterns by averaging. Calculate the corresponding reconstruction error coefficient based on the clustering results. and contour coefficient Thus, performance indicators are obtained. ; Step 2.3: Using n+1 as the base pattern number, run the NMF algorithm independently for a preset number of times. Import the obtained base patterns into a machine learning clustering algorithm to cluster them into n+1 classes. For each class, obtain n+1 average base patterns by averaging. Calculate the corresponding reconstruction error coefficient based on the clustering results. and contour coefficient Thus, performance indicators are obtained. ; Step 2.4: Using n-1 as the base pattern number, run the NMF algorithm independently for a preset number of times. Import the obtained base patterns into a machine learning clustering algorithm to cluster them into n-1 classes. For each class, obtain n-1 average base patterns by averaging. Calculate the corresponding reconstruction error coefficient based on the clustering results. and contour coefficient Thus, performance indicators are obtained. ; Step 2.5: Comparison , and ,like If the value is closest to 0, then N=n, the process ends, and the most suitable number of base patterns N is output; if If the value is closest to 0, then N = n + 1, step size coefficient k = 1, and the process continues; if If the value is closest to 0 and n-1=1, then N=n-1, the process ends, and the most suitable number of base patterns N is output; if If the value is closest to 0 and n-1>1, then N=n-1, step size coefficient k=-1, and the process continues; Step 2.6: Using N+k as the base number, run the NMF algorithm independently for a preset number of times, and calculate the corresponding reconstruction error coefficient. and contour coefficient Thus, performance indicators are obtained. ; Step 2.7: Comparison and ,like If the value is closer to 0, the process ends and N is output; otherwise, return to step 2.6 for execution.
3. The high-throughput XRF data processing method based on NMF and machine learning according to claim 2, characterized in that, Step 3 includes: Step 3.1: Generate N vectors as base patterns based on a random seed; Step 3.2: Regularize the high-throughput XRF data and convert it into a matrix X; Step 3.3: Based on the NMF algorithm principle, use the multiplicative update algorithm to solve for N basis patterns, where the NMF algorithm principle is as follows: in, For the nth XRF map, For the k-th base pattern, For the weighting coefficients, This indicates potential or unknown noise or systematic error in the measurement, and and None of them are negative; XRF signals are formed by the linear superposition of fluorescence signals of each element. Therefore, the physical meaning of the ground mode is the characteristic fluorescence spectrum of the element, and the physical meaning of the weighting coefficient is the atomic percentage of the element. To ensure the uniqueness of the NMF numerical solution, a regularization constraint is added: Its physical meaning is that, under the same test parameters, the number of atoms excited by X-ray fluorescence spectroscopy is basically the same; The multiplicative update algorithm is used in the NMF solution process, and its optimization objective is the Frobenius norm, as shown in the following formula: Step 3.4: Repeat steps 3.1-3.3 a total of m times to obtain N*m base patterns.
4. The high-throughput XRF data processing method based on NMF and machine learning according to claim 3, characterized in that, Step 4 includes: employing an improved K-means machine learning clustering algorithm, in which cosine distance is used to measure the similarity between patterns during the clustering process, and the calculation formula is as follows: The improvement of the K-means machine learning clustering algorithm lies in the addition of a constraint: each cluster must contain exactly m base patterns.
5. A high-throughput XRF data processing system based on NMF and machine learning, characterized in that, include: Module M1: The user inputs the number of elements n, where n>1, and specifies the number of loops m; Module M2: Using n as the initial value, perform parameter optimization to determine the most suitable number N of basic modes for quantitative analysis; Module M3: Run the NMF algorithm independently m times for each of the N base patterns to obtain N*m base patterns; Module M4: Imports the N*m base patterns obtained in Module M3 into the machine learning clustering algorithm, clusters them into N classes, and obtains N average base patterns for each class by averaging. Module M5: Based on the least squares optimization algorithm, the XRF data is decomposed one by one in the N average basis modes obtained by module M4 to obtain the corresponding coefficients, which are the percentage contents of elements. Module M6: Compares the N average base patterns obtained from module M4 with the element database to determine the element type corresponding to each average base pattern; The module M2 includes: Module M2.1: Defines the reconstruction error coefficient R, with the following expression: Where X is the observation matrix, W is the basic mode matrix, H is the coefficient matrix, and F is the norm; Define the profile coefficient S as follows: Where a represents intra-cluster dissimilarity; b represents inter-cluster dissimilarity; Define the performance metric P as follows: Where A and B are weighting coefficients, which are adjusted according to user needs; The range of the reconstruction error coefficient R and the silhouette coefficient S is [-1, 1]. The closer R is to 0, the better the fit. The closer S is to 1, the more reasonable the clustering. The performance index P measures the suitability of the fitting parameters. The closer P is to 0, the more suitable the fitting parameters are.
6. The high-throughput XRF data processing system based on NMF and machine learning according to claim 5, characterized in that, The module M2 includes: Module M2.2: Runs the NMF algorithm independently a preset number of times with n as the base pattern count. The resulting base patterns are imported into a machine learning clustering algorithm, forming n classes. For each class, n average base patterns are obtained by averaging. The corresponding reconstruction error coefficient is calculated based on the clustering results. and contour coefficient Thus, performance indicators are obtained. ; Module M2.3: Using n+1 as the base pattern number, the NMF algorithm is run independently for a preset number of times. The resulting base patterns are imported into a machine learning clustering algorithm, forming n+1 classes. For each class, n+1 average base patterns are obtained by averaging. Based on the clustering results, the corresponding reconstruction error coefficient is calculated. and contour coefficient Thus, performance indicators are obtained. ; Module M2.4: With n-1 base patterns, the NMF algorithm is run independently a preset number of times. The resulting base patterns are imported into a machine learning clustering algorithm, forming n-1 classes. For each class, n-1 average base patterns are obtained by averaging. Based on the clustering results, the corresponding reconstruction error coefficient is calculated. and contour coefficient Thus, performance indicators are obtained. ; Module M2.5: Comparison , and ,like If the value is closest to 0, then N=n, the process ends, and the most suitable number of base patterns N is output; if If the value is closest to 0, then N = n + 1, step size coefficient k = 1, and the process continues; if If the value is closest to 0 and n-1=1, then N=n-1, the process ends, and the most suitable number of base patterns N is output; if If the value is closest to 0 and n-1>1, then N=n-1, step size coefficient k=-1, and the process continues; Module M2.6: With N+k as the base number, the NMF algorithm is run independently for a preset number of times to calculate the corresponding reconstruction error coefficient. and contour coefficient Thus, performance indicators are obtained. ; Module M2.7: Comparison and ,like If the value is closer to 0, the process ends and N is output; otherwise, module M2.6 is triggered to execute.
7. The high-throughput XRF data processing system based on NMF and machine learning according to claim 6, characterized in that, The module M3 includes: Module M3.1: Generates N vectors as base patterns based on a random seed; Module M3.2: Regularizes high-throughput XRF data, converting it into a matrix X; Module M3.3: Based on the NMF algorithm principle, a multiplicative update algorithm is used to solve for N basis patterns. The NMF algorithm principle is as follows: in, For the nth XRF map, For the k-th base pattern, For the weighting coefficients, This indicates potential or unknown noise or systematic error in the measurement, and and None of them are negative; XRF signals are formed by the linear superposition of fluorescence signals of each element. Therefore, the physical meaning of the ground mode is the characteristic fluorescence spectrum of the element, and the physical meaning of the weighting coefficient is the atomic percentage of the element. To ensure the uniqueness of the NMF numerical solution, a regularization constraint is added: Under the same test parameters, the number of atoms excited by X-ray fluorescence spectroscopy is basically the same; The multiplicative update algorithm is used in the NMF solution process, and its optimization objective is the Frobenius norm, as shown in the following formula: Module M3.4: Repeatedly trigger modules M3.1-M3.3 a total of m times to obtain N*m base patterns.
8. The high-throughput XRF data processing system based on NMF and machine learning according to claim 7, characterized in that, The module M4 includes: an improved K-means machine learning clustering algorithm, in which cosine distance is used to measure the similarity between patterns during the clustering process, and the calculation formula is as follows: The improvement of the K-means machine learning clustering algorithm lies in the addition of a constraint: each cluster must contain exactly m base patterns.
Citation Information
Patent Citations
Inverter zero voltage drop data processing method based on machine learning
CN115600061A
Self-adaptive sampling single-pixel imaging method
CN111968032A
Image representation-oriented depth map regularization non-negative matrix factorization method
CN114139603A