Transformer chromatogram baseline anomaly identification method based on similarity and wasserstein distance
By combining similarity and Wasserstein distance methods, the problem of identifying anomalies such as baseline drift in transformer oil chromatograms was solved, achieving efficient and reliable anomaly detection and improving the accuracy and robustness of identification.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- CHINA YANGTZE POWER
- Filing Date
- 2025-10-30
- Publication Date
- 2026-05-21
AI Technical Summary
Existing methods for identifying anomalies in transformer oil chromatograms are unable to accurately capture minute changes in the baseline portion, and the identification results are greatly affected by the threshold setting, resulting in poor robustness.
A method based on similarity and Wasserstein distance is adopted. The overall similarity is evaluated by Pearson correlation coefficient, and small changes in the baseline are detected by combining Wasserstein distance. Data preprocessing is performed by combining filter to remove noise and baseline correction algorithm, and a threshold is set to judge anomalies.
It improves the accuracy and robustness of anomaly identification in transformer oil chromatograms, enabling timely detection of anomalies such as baseline drift, ghost peaks, or stray peaks, thus avoiding misjudgment or missed detection.
Smart Images

Figure CN2025131090_21052026_PF_FP_ABST
Abstract
Description
A method for identifying transformer spectrum baseline anomalies based on similarity and Wasserstein distance Technical Field
[0001] This invention belongs to the field of transformers, and specifically relates to a method for identifying transformer spectrum baseline anomalies based on similarity and Wasserstein distance. Background Technology
[0002] In power systems, transformers are critical equipment, and their operating status directly affects the safety and stability of the entire power grid. Transformer oil chromatography, as an important fault diagnosis method, can indirectly reflect the internal fault conditions of transformers by analyzing the composition and content of dissolved gases in the oil. However, in practical applications, chromatograms are often affected by various factors, such as equipment precision and operating conditions, leading to baseline drift, ghost peaks, or other abnormal peaks. These anomalies not only increase the difficulty of fault diagnosis but may also mislead the diagnostic results.
[0003] Traditional chromatogram anomaly identification methods largely rely on human experience and judgment, resulting in high subjectivity and low efficiency. With the development of computer technology and machine learning, some algorithm-based automatic anomaly identification methods have emerged. These methods extract characteristic parameters from chromatograms and compare them with standard spectra to achieve automatic anomaly identification. However, existing methods often focus on evaluating overall similarity, neglecting subtle changes in the baseline, leading to insufficient ability to identify anomalies such as baseline drift.
[0004] Currently, the most similar existing implementations to this invention mainly focus on chromatogram anomaly identification methods based on similarity calculations. These methods typically use indicators such as cosine similarity and Pearson correlation coefficient to calculate the similarity between the spectrum to be tested and the standard spectrum, and then determine whether an anomaly exists by setting a threshold.
[0005] However, these methods have the following shortcomings: First, similarity calculation is easily affected by the overall trend and it is difficult to accurately capture the small changes in the baseline; second, there is a lack of targeted detection methods for specific anomalies such as baseline drift; and third, the recognition results are greatly affected by the threshold setting and have poor robustness. Summary of the Invention
[0006] The technical problem this invention aims to solve is to provide a method for identifying transformer spectral baseline anomalies based on similarity and Wasserstein distance. By accurately calculating the similarity between the transformer oil chromatogram and a standard spectrum, as well as the Wasserstein distance of the baseline portion, the method automatically identifies anomalies such as baseline drift, ghost peaks, or cluttered peaks in the spectrum. This method combines the advantages of global similarity assessment and local baseline difference detection, improving the accuracy and robustness of anomaly identification and providing an efficient and reliable technical means for transformer fault diagnosis.
[0007] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is as follows:
[0008] A method for identifying transformer spectrum baseline anomalies based on similarity and Wasserstein distance, comprising the following steps:
[0009] Step 1: Use filters to remove high-frequency noise from the chromatograms, use baseline correction algorithms to remove baseline drift, and perform operations including data cleaning, data integration, data transformation, and data reduction to ensure data comparability and quality.
[0010] Step 2: Select candidate reference maps from the data source, perform preprocessing including denoising and smoothing, screen and verify the maps, organize them into a standard map library and maintain and update it;
[0011] Step 3: Calculate the overall similarity between the spectrum to be tested and the standard spectrum using the Pearson correlation coefficient method, and set a threshold to judge anomalies;
[0012] Step 4: Calculate the Wasserstein distance between the baseline of the spectrum to be tested and the standard baseline template, and set a threshold to judge baseline anomalies;
[0013] Step 5: Combine the similarity and Wasserstein distance results to determine whether the spectral baseline is abnormal;
[0014] Step 6: Identify and output abnormal results, including results such as similarity exceeding the threshold, Wasserstein distance exceeding the threshold, and abnormality type.
[0015] Preferably, in step 1, the data cleaning includes:
[0016] (1) Fill missing values: Use a prediction model to fill missing values.
[0017] (2) Remove high-frequency noise: Use filters to remove high-frequency noise.
[0018] (3) Handling outliers: Use threshold settings or statistical distribution-based methods to identify and handle them.
[0019] (4) Ensure data accuracy and consistency: Ensure this by correcting errors and inconsistencies.
[0020] The dataset is defined as follows: data from multiple data sources is merged into a unified dataset through a data integration process, which solves the problems of data redundancy and conflict, and ensures data integrity and consistency.
[0021] The data transformation includes:
[0022] (1) Scaling data: Scaling data to a specific range using proportional scaling.
[0023] (2) Adjusting the distribution: Adjust the data distribution to a standard normal distribution to achieve a mean of 0 and a standard deviation of 1.
[0024] (3) Data transformation: Continuous data is transformed into discrete categories to facilitate data analysis or mining algorithms.
[0025] The data reduction mentioned above refers to reducing the amount of data by using methods such as dimensionality reduction and aggregation to reduce the amount of data while maintaining the original information, thereby improving the efficiency of data processing and analysis.
[0026] Preferably, the sub-step of step 2 is as follows:
[0027] Sub-step 2.1: Select representative maps from the existing database as candidate reference maps, ensuring that their sources are reliable and have undergone rigorous review and verification;
[0028] Sub-step 2.2: Perform denoising and smoothing preprocessing on the candidate reference maps to improve map clarity and accuracy;
[0029] Sub-step 2.3: Standardize the spectra to ensure that different spectra are compared on the same scale and eliminate differences caused by instrument and operational factors;
[0030] Sub-step 2.4: Separate the baseline and peak portions to facilitate subsequent analysis and comparison;
[0031] Sub-step 2.5: Screen the preprocessed spectra according to the standard and exclude abnormal or non-compliant spectra;
[0032] Sub-step 2.6: Verify the selected spectra by comparing them with those of known samples and by repeating measurements to ensure their representativeness and accuracy;
[0033] Sub-step 2.7: Organize the screened and verified spectra into a standard spectra library, and then number, classify and store them;
[0034] Sub-step 2.8: Ensure the standard spectrum library is updated and maintained, add new standard spectra in a timely manner, and delete outdated or no longer used spectra.
[0035] Preferably, the sub-step of step 3 is as follows:
[0036] Sub-step 3.1: Calculate the overall similarity between the spectrum to be tested and the standard spectrum using the Pearson correlation coefficient method;
[0037] Sub-step 3.2: Set the similarity threshold;
[0038] Sub-step 3.3: If the calculated similarity is lower than the threshold, it is considered a possible anomaly.
[0039] Preferably, step 3.3 is as follows:
[0040] The Pearson correlation coefficient method was used to calculate the overall similarity between the spectrum under test and the standard spectrum; a similarity threshold was set, and those below the threshold were considered potentially abnormal.
[0041] The Pearson correlation coefficient is an indicator that measures the degree of linear correlation between two variables X and Y; the Pearson correlation coefficient r ranges from -1 to 1, where:
[0042] When r = 1, it means that X and Y are perfectly positively correlated, that is, one variable increases linearly as the other variable increases, or decreases linearly as the other variable decreases.
[0043] When r = -1, it means that X and Y are completely negatively correlated, that is, one variable decreases linearly as the other variable increases, or increases linearly as the other variable decreases.
[0044] When r = 0, it indicates that there is no linear correlation between X and Y;
[0045] The formula for calculating the Pearson correlation coefficient is:
[0046] Among them, X i and Y i These are the i-th observations of variables X and Y, respectively. and are the means of X and Y, respectively, and n is the number of observations.
[0047] Preferably, the sub-step of step 4 is as follows:
[0048] Sub-step 4.1: For the baseline part, acquire the baseline data of the spectrum to be measured and the data of the standard baseline template. These data are one-dimensional arrays representing the baseline intensity at different wavelengths or frequencies.
[0049] Sub-step 4.2: Based on the understanding of baseline drift tolerance and statistical information obtained from a large amount of experimental data, set the Wasserstein distance threshold.
[0050] Sub-step 4.3: Calculate the Wasserstein distance between the baseline of the spectrum to be tested and the standard baseline template: In Python, the Wasserstein distance between two one-dimensional arrays can be directly calculated using the scipy.stats.wasserstein_distance function in the scipy library.
[0051] Sub-step 4.4: If the calculated Wasserstein distance exceeds the threshold, it is considered a baseline anomaly. Furthermore, the Wasserstein distance can capture subtle differences between distributions, making it suitable for baseline drift detection.
[0052] Preferably, the calculation method for sub-step 4.3 is as follows:
[0053] For one-dimensional probability distributions P and Q, defined on the set of real numbers R, their p-order Wasserstein distance is defined as: W ρ (P, Q) = (inf γ∈Π(P,Q) ∫ R×R |xy| ρ d γ (x,y)) 1 / ρ ;
[0054] Where Π(P, Q) is the set of all possible joint distributions of P and Q, and the marginal distributions of the joint distributions are P and Q, respectively; |xy| ρ d represents the distance from x to y raised to the power of ρ; γ (x,y) is an integral infinitesimal element of the joint probability measure γ, representing "a weighted 'micro-level' of the probability quality near the point (x,y) according to the probability distribution of γ", where ρ≥1 is a real number, indicating that the ρ-order distance is being considered.
[0055] Based on practical applications, two sets of data were obtained: one set is the baseline data of the spectrum to be measured, and the other set is the data of the standard baseline template. These data are one-dimensional arrays representing the baseline intensity at different wavelengths or frequencies. In Python, the scipy.stats.wasserstein_distance function in the scipy library can be used directly to calculate the Wasserstein distance between the two one-dimensional arrays.
[0056] Preferably, in sub-step 4.4, setting a threshold and determining whether the baseline is abnormal requires setting a threshold for Wasserstein distance based on the specific needs of the application; this threshold should be based on an understanding of baseline drift tolerance and statistical information obtained through a large amount of experimental data.
[0057] Preferably, in step 5, a comprehensive judgment is made by combining the results of similarity and Wasserstein distance; if both indicate anomalies, it is confirmed that there is a baseline anomaly in the spectrum; if only one indicator indicates anomalies while the other indicator is within the normal range, further analysis or confirmation is required; if both are within the normal range, the baseline of the spectrum is considered normal.
[0058] Preferably, in step 6, the anomaly types include baseline drift, ghost peaks, and stray peaks; by developing a graphical user interface, users can easily upload chromatogram files, view anomaly identification results, and perform interactive operations; an anomaly alarm function is provided to promptly notify users when a baseline anomaly is detected.
[0059] The present invention can achieve the following beneficial effects:
[0060] 1. By combining the Pearson correlation coefficient and Wasserstein distance methods, this invention can comprehensively evaluate the similarity between the tested spectrum and the standard spectrum from both global and local dimensions. The Pearson correlation coefficient is used to assess the overall similarity of the spectra, while the Wasserstein distance focuses specifically on minute changes in the baseline. This dual detection mechanism significantly improves the accuracy and reliability of anomaly detection.
[0061] 2. The Wasserstein distance can capture subtle changes in the baseline, making it particularly suitable for detecting minute anomalies such as baseline drift. By setting an appropriate threshold, this invention can promptly detect baseline anomalies such as baseline drift, ghost peaks, or clutter, thereby avoiding misjudgments or missed detections caused by baseline issues.
[0062] 3. This invention employs various data preprocessing techniques, such as Gaussian filters to remove high-frequency noise, baseline correction algorithms (e.g., iterative polynomial fitting, wavelet transform, etc.) to remove baseline drift, as well as data cleaning, data integration, data transformation, and data reduction steps. These preprocessing measures effectively improve data quality and ensure the accuracy of subsequent analysis.
[0063] 4. This invention improves the robustness of the algorithm by adaptively training it on different types of chromatograms and anomalies. Threshold settings are optimized through extensive experimental data, and algorithm performance is evaluated using metrics such as accuracy, recall, and F1 score, ensuring the stability and reliability of the system under various complex environments. Attached Figure Description
[0064] The present invention will be further described below with reference to the accompanying drawings and embodiments:
[0065] Figure 1 is a flowchart of the present invention. Detailed Implementation
[0066] The preferred scheme is shown in Figure 1. A method for identifying baseline anomalies in transformer chromatograms based on similarity and Wasserstein distance identifies baseline anomalies, such as baseline drift, ghost peaks, or extraneous peaks, by calculating the similarity between the transformer oil chromatogram and a standard spectrum, as well as the Wasserstein distance of the baseline portion. Similarity is used to assess the overall similarity of the spectrum, while the Wasserstein distance focuses specifically on subtle changes in the baseline portion. Combining both allows for more comprehensive anomaly detection. The specific method is as follows:
[0067] I. Data Preprocessing:
[0068] Using filters (such as Gaussian filters) can effectively remove high-frequency noise while retaining important chromatographic peak information. This is achieved by subtracting the mean and dividing by the standard deviation, ensuring data comparability between different chromatograms. Baseline correction algorithms (such as iterative polynomial fitting, wavelet transform, etc.) are used to remove baseline drift and identify and separate peak components, facilitating subsequent analysis.
[0069] Data preprocessing mainly includes several aspects such as data cleaning, data integration, data transformation, and data reduction.
[0070] Data cleaning includes: filling in missing values using predictive models; removing high-frequency noise through filtering techniques; identifying and handling outliers by setting thresholds or using statistical distribution-based methods; and correcting errors and inconsistencies in the data to ensure accuracy and consistency.
[0071] Data integration is the process of merging data from multiple data sources into a unified dataset. During data integration, it is necessary to address issues such as data redundancy and data conflicts to ensure data integrity and consistency.
[0072] Data transformation: Scaling data proportionally to fit within a small, specific interval, such as [0,1] or [-1,1]. Adjusting the data distribution to a standard normal distribution, i.e., a mean of 0 and a standard deviation of 1. Converting continuous data into discrete categories to facilitate specific data analysis or data mining algorithms.
[0073] Data reduction is a process that reduces the amount of data and improves the efficiency of data processing and analysis by using methods such as dimensionality reduction and aggregation while preserving the original information of the data.
[0074] II. Establishment of Standard Spectra:
[0075] A series of standard chromatograms without abnormalities were selected as references. The standard chromatograms were preprocessed to extract the baseline template.
[0076] A series of representative spectra were selected from existing databases as candidate reference spectra. These spectra were ensured to originate from reliable data sources and have undergone rigorous review and verification. Preprocessing operations such as denoising and smoothing were performed on the candidate reference spectra to improve their clarity and accuracy. Standardization was applied to ensure that different spectra were compared on the same scale, eliminating differences caused by instrumentation, operation, and other factors. Baseline and peak components were separated to facilitate subsequent analysis and comparison. The preprocessed spectra were then screened according to standards, excluding abnormal or non-compliant spectra. The selected spectra were verified to ensure their representativeness and accuracy. This could be done through comparison with spectra of known samples, repeated measurements, etc. The screened and verified spectra were compiled into a standard spectra library, which was then numbered, classified, and stored. The standard spectra library was ensured to be updated and maintained, with new standard spectra added promptly and outdated or no longer used spectra removed.
[0077] III. Similarity Calculation:
[0078] The Pearson correlation coefficient method was used to calculate the overall similarity between the spectrum under test and the standard spectrum. A similarity threshold was set; spectra below the threshold were considered potentially abnormal.
[0079] The Pearson correlation coefficient is an indicator that measures the degree of linear correlation between two variables, X and Y. This coefficient was proposed by Carl Pearson in the 1880s and has been widely used in statistics. The Pearson correlation coefficient r ranges from -1 to 1, where:
[0080] When r = 1, it means that X and Y are perfectly positively correlated, that is, one variable increases linearly as the other variable increases, or decreases linearly as the other variable decreases.
[0081] When r = -1, it indicates that X and Y are completely negatively correlated, meaning that one variable decreases linearly as the other variable increases, or increases linearly as the other variable decreases.
[0082] When r = 0, it means that there is no linear correlation between X and Y, but it does not mean that there is no relationship between them. There may be other forms of relationship (such as nonlinear relationship).
[0083] The formula for calculating the Pearson correlation coefficient is:
[0084] Among them, X i and Y iThese are the i-th observations of variables X and Y, respectively. and are the means of X and Y, respectively, and n is the number of observations.
[0085] IV. Wasserstein distance calculation:
[0086] For the baseline portion, the Wasserstein distance between the baseline of the spectrum under test and the standard baseline template is calculated. The Wasserstein distance can capture small differences between distributions and is suitable for detecting baseline drift. A Wasserstein distance threshold is set; values exceeding the threshold are considered baseline anomalies.
[0087] For one-dimensional probability distributions P and Q, defined on the set of real numbers R, their p-order Wasserstein distance is defined as: W ρ (P, Q) = (inf γ∈Π(P,Q) ∫ R×R |xy| ρ d γ (x,y)) 1 / ρ ;
[0088] Where Π(P, Q) is the set of all possible joint distributions of P and Q, and the marginal distributions of the joint distributions are P and Q, respectively; |xy| ρ d represents the distance from x to y raised to the power of ρ; γ (x,y) is an integral infinitesimal element of the joint probability measure γ, representing "a weighted 'micro-level' of the probability quality near the point (x,y) according to the probability distribution of γ", where ρ≥1 is a real number, indicating that the ρ-order distance is being considered.
[0089] First, two sets of data are obtained for practical applications: one set is the baseline data of the spectrum to be measured, and the other set is the data of the standard baseline template. These data are typically one-dimensional arrays representing the baseline intensity at different wavelengths or frequencies. The calculation of the Wasserstein distance can be simplified using some readily available libraries. In Python, the `scipy.stats.wasserstein_distance` function in the `scipy` library can be directly used to calculate the Wasserstein distance between two one-dimensional arrays.
[0090] Setting a threshold and determining whether the baseline is abnormal requires setting a Wasserstein distance threshold based on the specific needs of the application. This threshold should be based on an understanding of baseline drift tolerance and statistical information obtained from a large amount of experimental data.
[0091] V. Comprehensive Judgment:
[0092] A comprehensive judgment is made by combining the results of similarity and Wasserstein distance. If both indicate anomalies, a baseline anomaly in the spectrum is confirmed; if only one indicator indicates anomaly while the other is within the normal range, further analysis or confirmation is required; if both are within the normal range, the spectrum baseline is considered normal.
[0093] VI. Anomaly Identification Result Output: Output anomaly identification results, including similarity, Wasserstein distance value, and anomaly type (e.g., baseline drift, ghost peaks, spurious peaks). Develop a graphical user interface (GUI) to facilitate users uploading chromatogram files, viewing anomaly identification results, and performing interactive operations. Provide an anomaly alarm function to promptly notify users when baseline anomalies are detected.
[0094] In this embodiment, the similarity is used to evaluate the overall consistency between the spectrum under test and the standard spectrum, quickly filtering out potentially abnormal spectra. The Wasserstein distance is specifically for the baseline portion, capturing minute distribution changes and accurately identifying anomalies such as baseline drift.
[0095] Furthermore, this invention employs programming languages such as Python and utilizes scientific computing libraries such as NumPy and SciPy for data processing and computation. It leverages similarity calculation methods and the Wasserstein distance calculation tool from machine learning libraries. Deep learning techniques, such as Convolutional Neural Networks (CNNs), are introduced to automatically extract features and calculate similarity and distance. Unsupervised learning methods are used to automatically cluster standard spectra, improving the accuracy of similarity calculations. Adaptive training for different types of spectra and anomalies is added to enhance the algorithm's robustness. Advanced methods in anomaly detection, such as the Local Anomaly Factor (LOF), are introduced and combined with existing methods.
[0096] The algorithm was trained and tested using a dataset of known anomalies and normal chromatograms. Performance was evaluated using metrics such as accuracy, recall, and F1 score. The recognition results were compared under different threshold settings to select the optimal threshold.
[0097] The above embodiments are merely preferred technical solutions of the present invention and should not be considered as limitations on the present invention. The scope of protection of the present invention should be limited to the technical solutions described in the claims, including equivalent substitutions of the technical features described in the claims. That is, equivalent substitutions and improvements within this scope are also within the scope of protection of the present invention.
Claims
1. A transformer spectrum baseline anomaly identification method based on similarity and Wasserstein distance, characterized by Includes the following steps: Step 1: Use filters to remove high-frequency noise from the chromatograms, use baseline correction algorithms to remove baseline drift, and perform operations including data cleaning, data integration, data transformation, and data reduction to ensure data comparability and quality. Step 2: Select candidate reference maps from the data source, perform preprocessing including denoising and smoothing, screen and verify the maps, organize them into a standard map library and maintain and update it; Step 3: Calculate the overall similarity between the spectrum to be tested and the standard spectrum using the Pearson correlation coefficient method, and set a threshold to judge anomalies; Step 4: Calculate the Wasserstein distance between the baseline of the spectrum to be tested and the standard baseline template, and set a threshold to judge baseline anomalies; Step 5: Combine the similarity and Wasserstein distance results to determine whether the spectral baseline is abnormal; Step 6: Identify and output abnormal results, including results such as similarity exceeding the threshold, Wasserstein distance value exceeding the threshold, and abnormality type; The sub-steps of step 2 are as follows: Sub-step 2.1: Select representative maps from the existing database as candidate reference maps, ensuring that their sources are reliable and have undergone rigorous review and verification; Sub-step 2.2: Perform denoising and smoothing preprocessing on the candidate reference maps to improve map clarity and accuracy; Sub-step 2.3: Standardize the spectra to ensure that different spectra are compared on the same scale and eliminate differences caused by instrument and operational factors; Sub-step 2.4: Separate the baseline and peak portions to facilitate subsequent analysis and comparison; Sub-step 2.5: Screen the preprocessed spectra according to the standard and exclude abnormal or non-compliant spectra; Sub-step 2.6: Verify the selected spectra by comparing them with those of known samples and by repeating measurements to ensure their representativeness and accuracy; Sub-step 2.7: Organize the screened and verified spectra into a standard spectra library, and then number, classify and store them; Sub-step 2.8: Ensure the standard spectrum library is updated and maintained, add new standard spectra in a timely manner, and delete outdated or no longer used spectra.
2. The transformer spectrum baseline anomaly identification method based on similarity and Wasserstein distance according to claim 1, characterized in that: In step 1, the data cleaning includes: (1) Filling missing values: using a prediction model to fill in missing values; (2) High-frequency noise removal: High-frequency noise is removed using a filter; (3) Handling outliers: Use threshold settings or statistical distribution-based methods to identify and handle them; (4) Ensure data accuracy and consistency: Utilize methods to correct errors and inconsistencies; The dataset is defined as follows: data from multiple data sources is merged into a unified dataset through a data integration process, which solves the problems of data redundancy and conflict, and ensures data integrity and consistency. The data transformation includes: (1) Scaling data: Scaling data to a specific range using proportional scaling; (2) Adjusting the distribution: Adjusting the data distribution to a standard normal distribution, so that the mean is 0 and the standard deviation is 1; (3) Data transformation: Utilizing the method of converting continuous data into discrete categories facilitates data analysis or mining algorithms; The data reduction mentioned above is to reduce the amount of data by using dimensionality reduction and aggregation methods to reduce the amount of data while maintaining the original information, thereby improving the efficiency of data processing and analysis.
3. The transformer spectrum baseline anomaly identification method based on similarity and Wasserstein distance according to claim 1, characterized in that: The sub-steps of step 3 are as follows: Sub-step 3.1: Calculate the overall similarity between the spectrum to be tested and the standard spectrum using the Pearson correlation coefficient method; Sub-step 3.2: Set the similarity threshold; Sub-step 3.3: If the calculated similarity is lower than the threshold, it is considered a possible anomaly.
4. The transformer spectrum baseline anomaly identification method based on similarity and Wasserstein distance according to claim 3, characterized in that: Step 3.3 is as follows: The Pearson correlation coefficient method was used to calculate the overall similarity between the spectrum under test and the standard spectrum; a similarity threshold was set, and those below the threshold were considered potentially abnormal. The Pearson correlation coefficient is an indicator that measures the degree of linear correlation between two variables X and Y; the Pearson correlation coefficient r ranges from -1 to 1, where: When r = 1, it means that X and Y are perfectly positively correlated, that is, one variable increases linearly as the other variable increases, or decreases linearly as the other variable decreases. When r = -1, it means that X and Y are completely negatively correlated, that is, one variable decreases linearly as the other variable increases, or increases linearly as the other variable decreases. When r = 0, it indicates that there is no linear correlation between X and Y; The formula for calculating the Pearson correlation coefficient is: where X i and Y i are the ith observation of variables X and Y, respectively, and are the means of X and Y, respectively, and n is the number of observations.
5. The transformer spectrum baseline anomaly identification method based on similarity and Wasserstein distance according to claim 1, characterized in that: The sub-steps of step 4 are as follows: Sub-step 4.1: For the baseline part, acquire the baseline data of the spectrum to be measured and the data of the standard baseline template. These data are one-dimensional arrays representing the baseline intensity at different wavelengths or frequencies. Sub-step 4.2: Based on the understanding of baseline drift tolerance and statistical information obtained from a large amount of experimental data, set the Wasserstein distance threshold; Sub-step 4.3: Calculate the Wasserstein distance between the baseline of the spectrum to be tested and the standard baseline template: In Python, the Wasserstein distance between two one-dimensional arrays can be directly calculated using the scipy.stats.wasserstein_distance function in the scipy library; Sub-step 4.4: If the calculated Wasserstein distance exceeds the threshold, it is considered a baseline anomaly; at the same time, the Wasserstein distance can capture small differences between distributions and is suitable for baseline drift detection.
6. The transformer spectrum baseline anomaly identification method based on similarity and Wasserstein distance according to claim 5, characterized in that: The calculation method for sub-step 4.3 is as follows: For one-dimensional probability distributions P and Q, defined on the set of real numbers R, their p-order Wasserstein distance is defined as follows: W ρ (P, Q) = (inf γ∈Π(P,Q) ∫ R×R |x-y| ρ d γ (x,y)) 1 / ρ ; Where Π(P, Q) is the set of all possible joint distributions of P and Q, and the marginal distributions of the joint distributions are P and Q, respectively; |xy| ρ d represents the ρ-th power of the distance from x to y; γ (x,y) is an integral infinitesimal element of the joint probability measure γ, representing "a weighted 'micro-level' of the probability quality near the point (x,y) according to the probability distribution of γ", where ρ≥1 is a real number, indicating that the ρ-order distance is being considered. Based on practical applications, two sets of data were obtained: one set is the baseline data of the spectrum to be measured, and the other set is the data of the standard baseline template. Both sets of data are one-dimensional arrays, representing the baseline intensity at different wavelengths or frequencies. In Python, the scipy.stats.wasserstein_distance function in the scipy library is used to directly calculate the Wasserstein distance between the two one-dimensional arrays.
7. The transformer spectrum baseline anomaly identification method based on similarity and Wasserstein distance according to claim 5, characterized in that: In sub-step 4.4, a threshold is set and the baseline is judged to be abnormal. A threshold for Wasserstein distance needs to be set according to the specific needs of the application. This threshold is based on the understanding of baseline drift tolerance and statistical information obtained through a large amount of experimental data.
8. The transformer spectrum baseline anomaly identification method based on similarity and Wasserstein distance according to claim 1, characterized in that: In step 5, a comprehensive judgment is made by combining the results of similarity and Wasserstein distance; if both indicate anomalies, the spectrum is confirmed to have a baseline anomaly; if only one indicator indicates anomalies while the other is within the normal range, further analysis or confirmation is required; if both are within the normal range, the spectrum baseline is considered normal.
9. The transformer spectrum baseline anomaly identification method based on similarity and Wasserstein distance according to claim 1, characterized in that: In step 6, the abnormality types include baseline drift, ghost peaks, and stray peaks; a graphical user interface is developed to facilitate users in uploading chromatogram files, viewing abnormality identification results, and performing interactive operations; an abnormality alarm function is provided to promptly notify users when baseline abnormalities are detected.