Anal. Chem. 1994,66, 2047-2051
Optimal Associative Memory for Background Correction of Spectra Bus010 Wa Wabuyele and Peter de B. Harrlngton'
Clippinger Laboratories, Center for Intelligent Chemical Instrumentation, Department of Chemistv, Ohio University, Athens, Ohio 4570 1-2979 A novel artificial neural network has been devised and is evaluatedfor the background correction of single-scaninfrared (IR) spectra. An optimal associative memory (OAM) is an enhanced bidirectionalassociative memory (BAM). Factoring the weight matrix allows OAMs to be used with high-resolution data on a desktop computer. IR spectroscopy provides a rigorous and practical challenge for evaluating background correction. IR single-scan background spectra are stored in the associative memory. Single-scan sample spectra are used to retrieve the best fitting background scans. The OAM uses an internal Gram-Schmidt calculation and does not require orthogonal data. The associativeproperties of the OAM allow background scans not stored in the memory to be modeled. The memories were evaluated with 2-cm-l resolution IR spectra. Quantitative analyses of 2-octanone/toluene solutions were used to evaluate the OAM with regard to accuracy and linearity. In both cases of univariate and multivariate calibrations, the OAM-corrected spectra furnished better calibration models than those obtained from conventional IR absorbance spectra. Background correction has many applications to spectroscopy. Accurate background correction of spectra may improve signal-to-noise ratio and facilitate quantitative analysis of unseparated raw samples. Background correction is generally performed by subtracting a background spectrum from a sample spectrum. Background spectra may not be readily available for subtraction. A typical case is the spectroscopic on-line monitoring of chemical processes. In remote sensing, background fluctuations may occur between the times of collection of reference and sample spectra. These fluctuations may be caused by environmental or instrumental effects. Perhaps the most important application of background correction is the calculation of absorbance spectra. In many sampling modes of infrared (IR) spectroscopy, such as attenuated total reflectance, diffuse reflectance, and photoacoustic spectroscopy, background fluctuations may limit the precision of the measurement.' Background variations may deleteriously affect computer-assisted identification of spectra.293 When accurate background spectra are unavailable, baseline fitting methods may be used. Many techniqueshave been developed for baseline fitting of spectra. Some techniques reported are spectral derivatives: least- square^,^ least-squares (1) Griffiths, P. R.;De Hascth, J. A. Fourier Transform Infrared Spectrometry;
John Wiley: New York, 1986. (2) Harrington, P. E.; Iscnhour, T. L.Anal. Chim. Acta 1987, 197, 105. (3) Harrington, P. E.;Iscnhour, T. L.Appl. Spectrosc. 1987, 41, 1298. (4) Gerow, D. D.; Rutan, S. C . Anal. Chim. Acto 1986, 16'4, 53.
000S-2700l94l036&2047~Q4.5~l0 0 1994 American Chemical Society
with derivative spectroscopy,6 local modeling, and derivative ~pectroscopy.~ The bidirectional associative memory (BAM) is an artificial neural networkas The BAM is a new and alternative approach to baseline correction. BAMs can generate a background spectrum from a sample spectrum. An adaptive BAM neural network has been used for the ~ this application used identification of UV ~ p e c t r a .However, a very low resolution model due to the large memory requirements of BAMs and did not work very well. BAMs are content addressable memories (CAM), which use the pattern itself to address the storage location. This may appear to be an awkward method for storage because a pattern must exist before retrieval. However, this approach to storage offers several benefits. Patterns with identical contents are stored at the same location, and redundant information will not require additional memory. Pattems with similar contents are stored close together in the memory. When a novel pattern (i.e., one that differs from stored patterns) is presented to the memory, the patterns close to the address location are associated so that a similar pattern is retrieved. This same process may also estimate patterns from corrupted or incomplete input patterns. The associative properties of CAMS are ideally suited for background correction of spectra. CAMS may be used for storing a set of background spectra. An analyte spectrum may be considered as a corrupted background spectrum that can be used to predict the best fitting background spectrum. Background correction of IR spectra is routine. In many IR measurements, background (i.e., reference) spectra may not be easily obtained or may change over time. IR spectroscopy exemplifies one of the most challenging background correction problems. Water vapor and carbon dioxide absorbances are highly variable and difficult to correct. Instrumental variations such as source intensity, optical alignment, and detector sensitivity may all have a pronounced affect on the background spectra. A single-scan IR sample spectrum may be used to retrieve a background spectrum from the CAM. The predicted background scan can be used to calculate the absorbance spectrum. In this paper, a single-scan spectrum will hence be referred to as a scan. The terms spectrum or spectra will refer to background-corrected absorbance spectra. (5) Liu, J.; Kocning, J. L. Appl. Spectrosc. 1987, 41, 447. (6) Tahboub, Y. R Pardue, H. L. Anal. Chem. 1985, 57, 38. (7) Karstang, T. V.; Kvalheim. 0. M. Anal. Chem. 1991,63, 767. (8) Kosko. E. A D D ~ OD?. . 1987. 26.4947. i9j Otto, M.; Hirchncr, U. Sofkore Development in Chemistry I ; Springer: Berlin, 1990, p 377.
AnaIyticalChemktry, Vol. 66, No. 13, July I , 1994 2047
Wavenumber (cm“) Figure 1. Schematic diagram of the OAM blpdar encodlng of an IR $Ingle-scanspectrum.
BAMs work best when the input patterns are mutually orthogonal. Spectroscopicdata are seldom orthogonal, and BAMs do not work well for the background correction of spectroscopic data.I0 Approaches such as Fourier encoding or numerical differentiation have been applied to make the inputs approximately orthogonal patterns.I1 These approaches may also amplify noise in the spectra and may not minimize interference during pattern retrieval. An optimal associative memory (OAM) uses an internal orthogonalization routine to eliminate the requirement of orthogonal input data. Incorporation of the orthogonalization routine yields an optimal memory, because a retrieved pattern has a least squares error.’ I THEORY For IR data, normalization of the scans before storage in the memory is beneficial. Normalization corrects for variations in total radiation throughput and is accomplished by
for which max(x1) gives the largest intensity in a scan. Normalized and unnormalized scans are given by xi* and XI, respectively. Normalized scans will all have the same maximal values. After being preprocessed, the spectra are encoded as bipolar matrices. Scans are represented as two-dimensional patterns that are defined by a grid, as shown in Figure 1. Note the grid sizes shown in this figure are enlarged for display purposes and the actual grid sizes are much smaller. The rows (h) correspond to spectral intensity while the columns (u) correspond to the resolution elements. A grid unit is defined by the spectral resolution elements and discrete segments obtained by dividing the intensity axis by a given number. This number is referred to as the grid number. Each scan is represented as a bipolar matrix. If a resolution element has an intensity in a grid unit, then it is assigned a value of +l.
The other grid units are assigned valuesof -1. This procedure converts a vector of spectral intensities to a bipolar matrix. Therefore, a scan of u intensity values is converted into a u X h bipolar matrix. Data reduction is accomplished by removing grid units that have -1 values for all the stored patterns. This number of removed grids is designated as u. The bipolar encoded matrices are rectangular, and the scans may be considered as a curved line. Therefore, the bipolar-encoded spectra share a large quantity of negative grids. The number of grid units (k) is equal to (u X h) - u. For conceptual and computational simplification, the bipolar matrix can be represented as a vector by connecting the rows. This process is described by the arrows in Figure 1. The ith bipolarly encoded background scan is designated as yi. Each vector has k components. An OAM stores information in a weight matrix that is a cross-correlation matrix of the input-output pairs in the training set. Training an OAM is achieved by constructing this matrix. When input-output pairs aredifferent, the OAM is referred to as heteroassociative. For background correction, the input or output for each pair is a background spectrum and the memory is referred to as autoassociative. The weight matrix (W) is obtained by
for which n is the number of bipolar encoded vectors (y,) that are to be stored in the memory. The size of W is (k)2. The rank of W is the number of linearly independent background scans that have been learned. The maximum number of different background scans that can be stored may not exceed k. For high-resolution data, the size of W data may exceed the storage capacity of many computers; storing Y instead of W may reduce the amount of memory used from a size of (k)2 to n X k. During the retrieval process, W is calculated as needed. This step saves memory at the cost of extra computation. This approach is practical because the time required for the extra calculations is exceeded by the computational overhead of virtual memory. The next step involves converting the encoded patterns into an orthonormal basis. Orthonormal projection operators have been shown to facilitate the optimal associative recall process.lI Orthonormal encoding furnishes a basis for which the optimal subspace projection is obtained. In other words, interferences are removed during the retrieval process from linearly dependent data. The GramSchmidt process12 orthogonalizes the encoded patterns and is given by VI
= Yr
(IO) Wabuyele, B. W.; Harrington, P. B. Chemom. Intell. Lab. Syst., submitted for publication. ( I 1 ) Kohenen, T.SelfOrganiration and Association Memory; Springer: Berlin, 1988.
2048
Analyticai Chemistty, Voi. 66, No. 13, Ju& 1, 1994
( I 2) Strang, G. Linear Algebra and Its Application; Academic Press: New York, 1980.
for which VI is the orthogonalized encoded patterns of y~and n is the number of stored patterns. If each orthogonalized pattern (vk) is normalized to unit vector length, then the square root term may be eliminated. This step simplifies the calculation. The OAM network retrieves patterns by
zf= V(VTz,)
(4)
3*0
e
t
8
2.0 -
P 3
1.5
#!
1.0
~
3
-
for which V is the basis of the learned background scans, zi is an encoded sample scan, and zf is the encoded predicted background scan. The predicted output vector q m u s t be decoded from the bipolar representation into a single-scan spectrum. This process is the inverse of encoding. The vector components are rearranged into the original bipolar matrix. The columns and rows of the matrix correspond to resolution elements and intensity values, respectively. The largest grid value of each column (i.e., the resolution element) will correspond to the predicted intensity. When multiple grids have equal values, the average intensity is calculated. Therefore, a spectrum is obtained when this step has been completed for each resolution element, Appendix A gives the pseudocode used for developing the OAM algorithm.
2J
I
5
OS 0 0.0
5
10
15
20
21
P . r c e n l 2 ~ . n o mIn Tolmnn
Flgure 2. Calibration line with cmentlonal background correction (raw spectra). Toluene at 1603 cm-l and 2-octanone at 1717 cm-I.
and 128 Kb RAM cache for data processing. The host operating system was MS-DOS 6.2. The OAM and PLS programs were developed and debugged using Borland C 3.1 and evaluated in 32 bit protected mode using Watcom C 9.5 ver B. Microsoft Excel1 3.0 was used for the analysis of variance and the regression analysis. Calibration plots and the 95% confidence intervals were calculated by Axum 3.0.
EXPERIMENTAL SECTION SpectroscopicMeasurements. Standard solutions of 2-octanone (Eastman Kodak, Rochester, NY) were prepared by weight and diluted to 50 mL with toluene (Fisher, Fair Lawn, NJ). The relative concentrationsare reported as percent (w/ v) or g/dL. Nine design points werecollected at 2.52% 3.38% 6.43%,8.16%, 10.04%, 12.15%, 15.95%,21.01%,and 24.94%. Four replicates were obtained for each design point. Spectra were acquired from a Perkin Elmer Model 1600 FT-IR spectrophotometer equipped with a DTGS detector and a KBr beam splitter. Random block designs were used for acquiring the spectra from 450 to 4400 cm-1 at 2-cm-l resolution and signal-averaged over 64 scans. For each sample scan, a background scan was obtained. Two data sets were collected. The first set was collected with a variablepathlength cell (KBr windows 32 X 3 mm). The second data set was collected with a fixed-path length cell of 0.015 mm. The cell windows were KBr. For each data set, 36 background and 36 sample scans were obtained. For the first data set, the evaluation used the toluene aromatic ring stretch absorbance at 1603 cm-1 and the 2-octanonecarbonyl stretch at 1717 cm-l. For each peak, the maximum and three data points on each side were summed to obtain an integrated absorbance. The toluene absorbance was used as an internal standard to correct for variations in path length. For the second data set, partial least squares (PLS)13J4 with one latent variable was used as a full-spectrum method to perform multivariate calibration and prediction. The absorbance spectra were not normalized or scaled before calibration. SpectralProcessing. All spectral data were transferred to a 25-MHz Everex 80486 computer equipped with 8 MB RAM
DISCUSSION OF RESULTS Calibration combined with analysis of variance (ANOVA) furnishes a useful evaluation method for background correction. The precision of the background correction can be measured by the pure error (PE) variationsof the calibration line. The accuracy of the baseline correction (Le., obtaining a baseline of zero) is measured by the lack of fit (LOF) variations. Univariate and multivariate calibration models were built using OAM-corrected spectra or conventional absorbancespectra from standard mixtures of 2-octanoneand toluene. The conventional or raw absorbance spectra were obtained from consecutively acquired background and sample scans. The same set of background scans were stored in the OAM. The same sample scans were used with the OAM to predict corresponding background scans. The predicted background and sample scans were used to calculate an absorbance spectrum. For the first evaluation, the cell pathlength was allowed to vary so that a rigorous evaluation set could be obtained (i.e., one with a large range of absorbance values with respect to the background). The toluene peak was used as an internal standard to correct for pathlength variations. The 2-octanone carbonyl stretch and the toluene aromatic ring stretch peaks were completely resolved. The ratios of these integrated absorbances (2-octanone/toluene) were used for the calibration models. Inverse least squaresregression was used to model the ratios of the integrated absorbances from the 2-octanone/toluene mixtures from their relative concentrations. The baseline was assumed to occur at zero absorbance and was not manually corrected. Figures 2 and 3 give thecalibration curvesobtained from univariate regression of the conventional and OAM-
(13) Haaland, D. M.; Thomas, E. V. AM/. Chrm. 1988,60, 1193. (14) Gcladi, P.; Kowalski, B. R. AMI. Chim. Acta 1986. 185, 1, 19.
(15) Massart, D. L.; Vandeginste, B. G. M.; Deming, S. N.; Michotte, Y. Chcmomctrics: A Trxrbook;Elsevier: Amsterdam, 1988.
Analytlcel Chemistry, Voi. 66,No. 13, Julv 1, 1994
2049
3.0
035
2.5
0.26
8
i!
I
1717 cm-1
1603 cml
2.0
1.5
-Ep
1.0 0.5
0.0
'
4.05 5
0
10 15 20 Percent 2-Oct.none In Toluene
2000
25
Figure 3. Calibration line with OAM-predictedbackground correction. Toluene at 1603 cm-l and Poctanone at 1717 cm-l.
ratio
Fprob
I
0.06 -
;
4
1600
1500
1400
-
25
-
~
10 -
I 1717 cm-1
0.12 0.10 -
30
15
-
0.16 0.14 -
8c
1700
20
lackof fit 0.0045 0.4399 7 0.0006 0.0628 98.2 2.0 X 1V pureerror 0.0791 1.1339 27 0.0029 0.042 14.3 4.6 X l&Io 0.18
1800
Wavenumbor (cml) Flgure 5. Infrared spectrum of Poctanoneltoluene mixture. 10% Poctanone in toluene wlth raw spectra.
Table 1. Analysis of Variance Rewtls from the Callbration Une for Unlvarlate Data
mean square SOurceS of sum of squares variations OAM raw DF OAM raw
1800
5 -
1603 cm-1 0
0
5
0.08 -
10
15
20
25
Actual Conwntratlonr (g/dL)
Flgwr 6. PLS calibrationilne (withone latentvariable) for conventional background correctkin (raw spectra).
0.04 0.02 0.00
-.---*L-fi-
2
-0.02 2000
1800
1800 1700 1600 Wavenumber (cml)
1500
1400
Obaswatlon CallbrrtlonLlno Confldenw InL 85%
25
3
Figure 4. Infrared spectrum of Poctanoneltoluene mixture. 10% Poctanone in toluene (OAM background corrected).
corrected spectra, respectively. The OAM data furnishes a better fit than the raw spectra. The PE and LOF variations are compared in Table 1 for the calibration models constructed from OAM-corrected and conventional spectra. Table 1 gives the degrees of freedom (DF), sum of squares (SS),mean squareerror (MS), ratio of M S ~ ~ / M S ~and AM probabilites , that the variations from each model are the same. An F test shows that the PEvariations are statistically different between calibrations using OAM and raw spectra. The lower PE for the OAM calibration model demonstrates that the background correction is performed in a robust manner. Also, the LOF variations were statistically different. The lower LOF indicates that a more linear calibration model was obtained with the OAM-corrected spectra. This fact is also supported by larger R2 values of 0.9942 for the OAM and 0.9046 for the raw spectra. The improved linearity demonstrates that the baseline correction is accurate (i.e., close to zero) and no distortion of peak absorbance is occurring. Figures 4 and 5 give the absorbance spectra acquired from a 10% solution of 2-octanone in toluene for OAM and raw spectra, respectively. The baselines of the raw spectra deviate from zero absorbance. An example may be seen in Figure 5 . The OAM does a better job of background correction. 2050
Ana&ticalChemistry, Vol. 66,No. 13, Ju& 1, 1994
0
0
5
10
15
20
25
Actual Concentrations (g/dL) Flgwe 7. PLS calibration line (with one latent variable) for OAMpredicted background correctkin.
For multivariate calibration, the baseline cannot be manually fit for each absorbance peak. To further illustrate the need for baseline correction, PLS was used for building a calibration model of the second data set of 2-octanone/ toluene standards. This study used OAM-corrected and raw spectra obtained from a fix-pathlength cell. A single latent variable was used by PLS to ensure that only linear variations would be modeled. Figures 6 and 7 give the calibration curves obtained from multivariate regression of the raw spectra and OAM-corrected spectra, respectively. The OAM data yielded a better fit as demonstrated by ANOVA and R2 statistics of 0.9932 and 0.9717 for the OAM and raw spectra models, respectively. Table 2 gives the ANOVA results for comparison. The calibration models built with OAM-corrected
Tabk 2. Analydr of Variance Reauth from the Callbratkn Line for Multhrariate Data SOUrCCS of variations
sum of squares raw
OAM
lackof fit 4.1677 20.709 pureerror 8.8682 31.82
mean square raw
DF OAM 7 27
0.5954 0.3285
2.9585 1.1785
ratio Fprob 4.96 3.59
0.0250 0.0007
useful to any method of chemical analysis for which background correction is a problem.
ACKNOWLEOGMENT We gratefully acknowledge Nabisco for supplying the oils and the US.Army ERDEC Contract-DAADOS-92-T-8659 for providing the financial support. Galactic Industries are also thanked for their support. APPENDIX A PSEUDOCODE FOR OAM
spectra had statistically better variations with regard to PE and LOF.
STORAGE A.
CONCLUSIONS Automated background correction is important to a broad range of spectroscopic applications. The utility of OAMs for background correction of high-resolution data has been demonstrated with IR spectra. Accurate prediction of IR background scans from sample scans is a formidable task, because the experimental variations of the background scans are significant. A heuristic procedure has been presented that allows high-resolution data such as spectra to be used with associative memories on desktop computers. An OAM was devised and evaluated for background correction of high-resolution data. OAMs have the advantage over BAMs in that they do not require orthornormal patterns for storage, a condition that is difficult to satisfy with chemical data. The application of OAM as a technique for predicting background scans yields a robust method for obtaining good spectral baselines in both univariate and multivariate calibrations. It has beendemonstrated that an OAM retainslinearity and obeys Beer's law in both cases. This technique would be
B. yi = Grid (xi) from u(float) to u X h (bipolar). C. If for n training patterns (max(yiJ) = -l), then exclude y i and ~ u = u + 1. The number of unused grids is u. If u is the number of spectral resolution elements and h horizontal grids (spectral intensity), then the number of bipolar encoded elements is presented by k: k = (u X h ) - u. D. Store the n patterns. E. Orthogonalize the stored pattern using the GramSchmidt alogirithm.
RETRIEVAL F. Do steps A and B as in Storage. ; orthonormal encoded memories G. zf= ~ ( V EVIis) the in a k X n matrix. H. Set XI = d d e (zy) to obtain a spectrum. Received for review January 18, 1994. Accepted April 22, 1994.' Abstract published in Adwnce ACS Abstracts, June 1, 1994.
Analytical Chemisby, Vd. 66, Ab. 13, July 1, 1994
2051