overlapped-peak-deconvolution-validation
Summary
Validates the deconvolution of overlapped GC-MS peaks by reconstructing the original overlapped intensity data from the predicted mass spectral matrix S and solved concentration distribution matrix C, then comparing the reconstruction against measured overlapped peak data. This post-hoc validation confirms that the least squares solution correctly decomposes the mixture.
When to use
After solving for the concentration distribution matrix C using least squares optimization (minimize ||overlapped_peaks - S·C||²), validate that the solution is physically meaningful and numerically accurate by checking whether S·C faithfully reconstructs the input overlapped peak intensities. Use this skill when you need confidence that the deconvolution workflow has correctly separated component spectra and their relative abundances.
When NOT to use
- The concentration matrix C has not yet been computed; perform least squares solve first.
- The input overlapped peaks are known to contain systematic noise or artifacts unrelated to the mixture model; residuals will be inflated and validation will be inconclusive.
- The mass spectral matrix S was not generated by the same GCMSFormer model or OPR method; mismatched peak dictionaries will cause validation to fail spuriously.
Inputs
- resolved mass spectral matrix S (m × n matrix, m mass-to-charge ratios × n components)
- solved concentration distribution matrix C (n components × p time/scan points)
- input overlapped peak intensity data (m × p matrix, same shape as S·C)
Outputs
- reconstructed overlapped peak intensity matrix (m × p, = S·C)
- residual error matrix (m × p, element-wise difference)
- scalar reconstruction error metric (e.g., mean squared error, L2 norm, or relative error)
How to apply
Reconstruct the overlapped peak intensity data by computing the matrix product S·C, where S is the resolved mass spectral matrix (output from GCMSFormer) and C is the solved concentration distribution. Compare the reconstructed overlapped peaks element-wise against the input overlapped peak intensity data. Compute residual error (e.g., mean squared error or L2 norm of the difference) to quantify reconstruction fidelity. If residual error is negligible relative to the input peak intensities, the deconvolution is validated; large residuals indicate poor fit or numerical instability in the least squares solve step. Document the residual magnitude and any systematic deviations (e.g., negative concentrations, which are unphysical).
Related tools
- PyTorch (matrix multiplication and tensor operations for computing S·C and residuals) — https://pytorch.org/
- NumPy (least squares solver (numpy.linalg.lstsq) and numerical error computation)
- GCMSFormer (predicts the mass spectral matrix S via Transformer model and orthogonal projection resolution) — https://github.com/zxguocsu/GCMSFormer
Examples
import numpy as np; S_pred = model.predict(overlapped_input); C_solved = np.linalg.lstsq(S_pred, overlapped_peaks, rcond=None)[0]; reconstructed = S_pred @ C_solved; residual = np.linalg.norm(overlapped_peaks - reconstructed) / np.linalg.norm(overlapped_peaks); print(f'Relative reconstruction error: {residual:.4f}')
Evaluation signals
- Reconstruction error (||overlapped_peaks - S·C||²) is small relative to the L2 norm of input overlapped_peaks (e.g., relative error < 5%).
- No negative or physically implausible values appear in the reconstructed peak intensity matrix.
- Residual matrix is approximately uniformly distributed around zero with no systematic bias toward over- or under-prediction.
- Reconstruction error is comparable to or smaller than the measurement noise floor of the GC-MS instrument.
- Visual overlay of reconstructed vs. input overlapped peaks shows close agreement across all mass-to-charge ratios and time points.
Limitations
- Validation only confirms that the least squares solution reproduces the input overlapped peaks; it does not verify that the predicted pure mass spectra S are correct without reference to authentic standards.
- Residual error depends critically on the quality of the GCMSFormer predictions; if S contains systematic errors (e.g., missing peaks, incorrect isotope patterns), even a perfect least squares solve will fail validation.
- Overlapped peak data containing outliers, instrumental artifacts, or baseline drift will inflate residuals and may lead to false rejection of valid solutions.
- The method assumes the linear mixture model S·C is appropriate; deviations due to non-linear detector response or ion suppression effects will not be detected by this validation.
Evidence
- [other] Validate the solution by reconstructing the overlapped peaks as S·C and comparing with the input overlapped data.: "Validate the solution by reconstructing the overlapped peaks as S·C and comparing with the input overlapped data."
- [readme] GCMSFormer can predict the pure mass spectra of all components in overlapped peaks (mass spectral matrix S), and then use the least squares method to find the concentration distribution matrix C.: "GCMSFormer can predict the pure mass spectra of all components in overlapped peaks (mass spectral matrix S), and then use the least squares method to find the concentration distribution matrix C."
- [other] minimize ||overlapped_peaks - S·C||² where C is the unknown concentration distribution.: "minimize ||overlapped_peaks - S·C||² where C is the unknown concentration distribution."
- [readme] With the aid of the orthogonal projection resolution method (OPR), GCMSFormer can predict the pure mass spectra of all components in overlapped peaks: "With the aid of the orthogonal projection resolution method (OPR), GCMSFormer can predict the pure mass spectra of all components in overlapped peaks"
1---2name: overlapped-peak-deconvolution-validation3description: Use when after solving for the concentration distribution matrix C using least squares optimization (minimize ||overlapped_peaks - S·C||²), validate that the solution is physically meaningful and numerically accurate by checking whether S·C faithfully reconstructs the input overlapped peak.4license: CC-BY-4.05---67# overlapped-peak-deconvolution-validation89## Summary1011Validates the deconvolution of overlapped GC-MS peaks by reconstructing the original overlapped intensity data from the predicted mass spectral matrix S and solved concentration distribution matrix C, then comparing the reconstruction against measured overlapped peak data. This post-hoc validation confirms that the least squares solution correctly decomposes the mixture.1213## When to use1415After solving for the concentration distribution matrix C using least squares optimization (minimize ||overlapped_peaks - S·C||²), validate that the solution is physically meaningful and numerically accurate by checking whether S·C faithfully reconstructs the input overlapped peak intensities. Use this skill when you need confidence that the deconvolution workflow has correctly separated component spectra and their relative abundances.1617## When NOT to use1819- The concentration matrix C has not yet been computed; perform least squares solve first.20- The input overlapped peaks are known to contain systematic noise or artifacts unrelated to the mixture model; residuals will be inflated and validation will be inconclusive.21- The mass spectral matrix S was not generated by the same GCMSFormer model or OPR method; mismatched peak dictionaries will cause validation to fail spuriously.2223## Inputs2425- resolved mass spectral matrix S (m × n matrix, m mass-to-charge ratios × n components)26- solved concentration distribution matrix C (n components × p time/scan points)27- input overlapped peak intensity data (m × p matrix, same shape as S·C)2829## Outputs3031- reconstructed overlapped peak intensity matrix (m × p, = S·C)32- residual error matrix (m × p, element-wise difference)33- scalar reconstruction error metric (e.g., mean squared error, L2 norm, or relative error)3435## How to apply3637Reconstruct the overlapped peak intensity data by computing the matrix product S·C, where S is the resolved mass spectral matrix (output from GCMSFormer) and C is the solved concentration distribution. Compare the reconstructed overlapped peaks element-wise against the input overlapped peak intensity data. Compute residual error (e.g., mean squared error or L2 norm of the difference) to quantify reconstruction fidelity. If residual error is negligible relative to the input peak intensities, the deconvolution is validated; large residuals indicate poor fit or numerical instability in the least squares solve step. Document the residual magnitude and any systematic deviations (e.g., negative concentrations, which are unphysical).3839## Related tools4041- **PyTorch** (matrix multiplication and tensor operations for computing S·C and residuals) — https://pytorch.org/42- **NumPy** (least squares solver (numpy.linalg.lstsq) and numerical error computation)43- **GCMSFormer** (predicts the mass spectral matrix S via Transformer model and orthogonal projection resolution) — https://github.com/zxguocsu/GCMSFormer4445## Examples4647```48import numpy as np; S_pred = model.predict(overlapped_input); C_solved = np.linalg.lstsq(S_pred, overlapped_peaks, rcond=None)[0]; reconstructed = S_pred @ C_solved; residual = np.linalg.norm(overlapped_peaks - reconstructed) / np.linalg.norm(overlapped_peaks); print(f'Relative reconstruction error: {residual:.4f}')49```5051## Evaluation signals5253- Reconstruction error (||overlapped_peaks - S·C||²) is small relative to the L2 norm of input overlapped_peaks (e.g., relative error < 5%).54- No negative or physically implausible values appear in the reconstructed peak intensity matrix.55- Residual matrix is approximately uniformly distributed around zero with no systematic bias toward over- or under-prediction.56- Reconstruction error is comparable to or smaller than the measurement noise floor of the GC-MS instrument.57- Visual overlay of reconstructed vs. input overlapped peaks shows close agreement across all mass-to-charge ratios and time points.5859## Limitations6061- Validation only confirms that the least squares solution reproduces the input overlapped peaks; it does not verify that the predicted pure mass spectra S are correct without reference to authentic standards.62- Residual error depends critically on the quality of the GCMSFormer predictions; if S contains systematic errors (e.g., missing peaks, incorrect isotope patterns), even a perfect least squares solve will fail validation.63- Overlapped peak data containing outliers, instrumental artifacts, or baseline drift will inflate residuals and may lead to false rejection of valid solutions.64- The method assumes the linear mixture model S·C is appropriate; deviations due to non-linear detector response or ion suppression effects will not be detected by this validation.6566## Evidence6768- [other] Validate the solution by reconstructing the overlapped peaks as S·C and comparing with the input overlapped data.: "Validate the solution by reconstructing the overlapped peaks as S·C and comparing with the input overlapped data."69- [readme] GCMSFormer can predict the pure mass spectra of all components in overlapped peaks (mass spectral matrix S), and then use the least squares method to find the concentration distribution matrix C.: "GCMSFormer can predict the pure mass spectra of all components in overlapped peaks (mass spectral matrix S), and then use the least squares method to find the concentration distribution matrix C."70- [other] minimize ||overlapped_peaks - S·C||² where C is the unknown concentration distribution.: "minimize ||overlapped_peaks - S·C||² where C is the unknown concentration distribution."71- [readme] With the aid of the orthogonal projection resolution method (OPR), GCMSFormer can predict the pure mass spectra of all components in overlapped peaks: "With the aid of the orthogonal projection resolution method (OPR), GCMSFormer can predict the pure mass spectra of all components in overlapped peaks"