Introduction

Traditional foods make up an important contribution to the human diet in many countries, especially in developing countries. Traditional processing methods of food products have been recognized as having some advantages (Steinkraus 2002; Gadaga et al. 1999; Cayot 2007), including (1) enrichment of the human dietary by developing a wide diversity of flavors, aromas, and textures in food; (2) preservation of substantial amounts of food when the yield exceeds the current demand; (3) improvement of the food nutrition by enriching vitamins, protein, essential amino acids, and fatty acids; and (4) a decrease in cooking times and fuel requirements.

In many East and Southeast Asian countries, such as China, Japan, Korea, Indonesia, and Vietnam, soybeans and soy-based food products have been traditionally considered as nutritional foods and are now gaining more popularity for their potential health-promoting properties (Kwon et al. 2010; Nair et al. 1997; Anderson et al. 1995; Denis et al. 1999; Wang and Murphy 1994). In Asia, tofu (bean curd), prepared by curdling soymilk with the proper coagulants, accounts for 90% of the total soybean protein consumption and is the most widely accepted soy foods (Kim et al. 2007). However, due to its high moisture and nutrient contents, fresh tofu is perishable and may have a shelf-life of only 3–4 days. Therefore, many processing methods were developed to extend the shelf-life of tofu (Champagene et al. 1991; No and Meyers 2004). One method is to make the fresh tofu into “dry” tofu with a large amount of liquid pressed out of it. Despite its name, dry tofu has not been actually dried but contains the least amount of moisture of all fresh tofu. It can then be mixed with flavors, vegetable oils, and salt to have the firmness and a rubbery feel similar to fully cooked meat. In China, flavored dry tofu with sterilization and vacuum packaging is a very popular food and accounts for a considerable amount of the total soybean food production of 25 million tons (Li and Jiang 2011).

Because the production of flavored dry tofu in China is distributed in many small-scale producers, it is very difficult to perform quality monitoring of the products on supermarket shelves. Recently, expired food products have triggered several serious food crises in China (Bai et al. 2007; Knight et al. 2008; Ni and Zeng 2009), including instant noodle, dry tofu, bread, drink, yoghurt, and milk. In China, official quality control administration concentrates mostly on the sanitary operation conditions and routine detection of reference noxious substances (Ni and Zeng 2009). The monitoring of real production date of food depends mainly on the inspection of labeled information provided by food producers. However, for financial interest, it is attractive for some food producers to falsely label the date of production. Therefore, there is an increasing demand for developing rapid and reliable methods for shelf-life analysis of food products.

Sensory evaluation (Hough et al. 2003) is a very important methodology for shelf-life prediction of microbiologically stable products. However, the use of sensory analysis for shelf-life evaluation has some disadvantages. Firstly, the subjectivity in the choice of some parameters for data collection and analysis can deeply influence the final result. Moreover, the process of training a skilled sensory expert may take years and is very expensive. Chemical and microbiological analysis methods (Argyri et al. 2011) have also been used for shelf-life evaluation, but generally, it is still difficult to find specific components or bacteria explicitly indicating the shelf-life.

Compared with traditional methods of chemical, microbiological, and sensory analysis, the combination of spectrometry and chemometric methods has provided a promising method for food quality analysis (Khan et al. 2010; Rohman and Che Man 2010; Shiroma and Rodriguez-Saona 2009; van de Voort et al. 2008). Some advantages of spectrometry analysis include: (1) no or less sample preparation; (2) reduced analysis time and cost; and (3) simultaneous characterization of multiple components for food quality evaluation. To extract useful information concerning food quality from the measured spectral data, chemometric multivariate analysis methods are required to relate the measured spectra to the sought-for quality parameters. Partial least squares (PLS) has been widely used as a standard method for its simplicity, accuracy, and its ability to tackle the “small n (sample number), large p (variable number)” problem, and multicollinearity. However, since PLS is a linear method, it is not suitable to model highly nonlinear relationship. The nonlinearity between spectral data and shelf-life is very complex and can be largely attributed to the following two reasons: (a) chemical components often have different kinetics and half lives during storage; and (b) natural nonlinearity exists between the shelf-life and component contents. Therefore, nonlinear multivariate calibration methods are required to model the relationship between spectra and shelf-life.

The aim of the present work was to establish a reliable and rapid analysis method for shelf-life of Chinese-flavored dry tofu by FTIR spectroscopy and chemometrics. To tackle the nonlinear problem, least squares support vector machines (LS-SVM) (Suykens and Vandewalle 1999) and PLS were combined with nonlinear transformation of spectral data by B-spline function (Krämer et al. 2008) and Gaussian kernel function (Salcedo-Sanz et al. 2009). Different options of data preprocessing (Xu et al. 2008) including smoothing, taking derivatives, and standard normal variate (SNV) were investigated to develop a nonlinear model with good generalization performance.

Materials and Methods

Dry Tofu Samples

A number of 151 flavored dry tofu samples were obtained from the market branch of Zhengzhou Shinji Group Co., Ltd. (Zhengzhou, Henan, China). All of the dry tofu samples retained integral packaging and the original labels indicating detailed sample information. By the time of analysis, the age of samples ranged from 29 to 161 days. Although most flavored dry tofu products have a maximum shelf-life of 180 days, shopkeepers and supermarkets would routinely withdraw the products with a shelf-life less than a month or 28 days. Consumers will also prefer products with a sufficient shelf-life. Therefore, the shelf-life range of analyzed samples covers the most important practical shelf-life interval. All of the samples are made of soybean tofu and flavored with soybean oil, salt, and spices. The detailed information concerning samples is shown in Table 1. All of the samples were stored in a cool, dark, and dry area with integral packaging before spectrometry analysis.

Table 1 Flavored dry tofu samples analyzed

Sample Preparation and FTIR Spectroscopy Analysis

Sample preparation involved finely grinding of dry tofu samples followed by preparation of KBr pellets. To make a representative sampling, for each sample, small pieces of dry tofu were sliced off from different parts of a sample and then ground into fine particles using an agate pestle and mortar. To form a KBr disk, 40 mg (1:25 w/w) of sample powders was mixed with 960 mg (24:25 w/w) of KBr (Xi'an Shiji, Xi'an, China). KBr pellets were prepared by exerting a pressure of 10 MPa for approximately 5 min in a pellet press (Tuopu Instrument., Tianjin, China). To examine whether the variation in pellet thickness cause significant interference in the measured spectra, different pellets were prepared from the same sample and their FTIR spectra were compared (Xu et al. 2011). It was found the measured FTIR spectra were nearly identical to their average spectrum used for analysis.

Transmittance FTIR spectra were reported by an Avata 360 FTIR spectrometer (Thermo Scientific, Waltham, MA) in the wavelength range of 4,000–400 cm−1. For each pellet, 128 scans were performed with a resolution of 4 cm−1 at room temperature using OMNIC software. An increase in scanning time did not significantly improve the signal. The average of the 128 scans was used as a raw spectrum for data analysis. The scanning interval was 1.929 cm−1, and each spectrum had 1,868 individual points for further analysis.

Data Preprocessing and Splitting

All the data analysis were performed on Matlab 7.0.1 (Mathworks, Sherborn, MA). When the analytical signals are contaminated with significant noises, baselines, and other undesirable factors, the performance of multivariate calibration models would be degraded. Therefore, different options were investigated to sharpen the calibration models. The S-G polynomial fitting smoothing was applied in this paper to remove part of the random noise in the raw spectra and enhance the signal-to-noise ratio (SNR) considering its simplicity and effectiveness. Second derivatives were also used to enhance spectral differences and remove baseline and background in the raw spectra. To avoid the degradation of SNR by taking derivatives, the derivative spectra were computed by S-G polynomial fitting algorithm. SNV was proved to be effective in reducing scattering effects and correcting the interference caused by variations in actual optical path and sample powder size. Therefore, SNV was performed to reduce the spectral variations caused by the local heterogeneity of KBr disks.

Representative training and test sets are crucial for developing and validating a multivariate calibration model, so the DUPLEX algorithm (Snee 1977) was performed to split the 151 measured samples into a training set and a test set. In DUPLEX algorithm, firstly, the two samples with largest Euclidean distance were selected and put in the training set, then the two samples with largest distance among the left samples were put in the test set, and so on. By alternatively selecting the two furthest samples for the calibration set and test set, DUPLEX splits the measured spectra into two data sets almost with equal distributions in multidimensional space.

Multivariate Calibration Methods

Because a calibration model with high complexity tends to give degraded prediction performance and has a higher risk of overfitting, it is important to make a proper tradeoff between model complexity and accuracy. Therefore, different models and nonlinear transformations were investigated to optimize the nonlinear model.

It has been proved that PLS and SVM can effectively balance the model accuracy and complexity by shrinkage and regularization of regression coefficients, respectively. Moreover, both PLS and SVM have been successfully used in modeling complex nonlinear relationship with certain nonlinear kernel matrix as predictor variables, e.g., the frequently used Gaussian radial basis function. Least squares support vector machine (LS-SVM) is a simplified version of the original SVM. By using an equality type of constraints, LS-SVM obtains the solution by solving a set of linear equations instead of a quadratic programming problem for classical SVM. Therefore, our first choice of nonlinear model is to combine PLS and LS-SVM models with a Gaussian kernel transformation.

A B-spline function is a unique function having minimal support with respect to a given degree, smoothness, and domain partition, which has made it a useful tool for nonlinear transformation of continuous spectral data. In this paper, the most commonly used cubic B-spline with uniform knot-vector was used. To fit the local information in the spectral data, a small number of the interpolation nodes should be preferred and it was set to be 3 in this paper. By the above cubic B-spline function transformation of spectral data, a linear model can be developed to simulate the nonlinear relationship between shelf-life and the measured spectra. Therefore, considering the simplicity of PLS, the quasi-linear PLS model based on the B-spline-function transformed spectra was adopted.

Results and Discussion

Analysis of FTIR Spectra

Some raw and preprocessed spectra of flavored dry tofu are show in Fig. 1. Seen from Fig. 1a, the raw spectra are highly overlapped and have a poor peak resolution, which makes the accurate assignments of specific peaks very difficult. The wide scope between 3,600 and 1,700 cm−1 mainly consists of the overlapping of –OH stretching (3,600–2,000 cm−1) and various –NH stretching vibrations (3,400–1,700 cm−1), where the peaks within 3,000–2,600 cm−1can be attributed to stretching vibrations of different –CH groups. Other peaks might be assigned as: C=O stretching (1,750 cm−1), O=C–O asymmetric stretching (1,570 cm−1), C–N stretching (1,330 cm−1), and C–O–C stretching (1,000 cm−1). The low spectral resolution can be attributed to the contributions of multi-components and the shifts and distortions resulted from their interactions. Therefore, chemometric methods are required to extract useful information for shelf-life analysis.

Fig. 1
figure 1

Some of the raw (a), smoothed (b), second-order derivative (c), and SNV-preprocessed (d) spectra of flavored dry tofu samples

By comparison of the raw spectra with smoothed spectra in Fig. 1b, two wavelength intervals, 400–800 and 3,600–4,000 cm−1 with much lower SNR than other wavelengths were excluded from developing calibration models. Although smoothed spectra can slightly improve the SNR, it might lose some useful high-frequency information in the raw data. Seen from Fig. 1c, the second-order derivative spectra can remove most of the baselines and provide much detailed information by enhancing peak resolution. SNV spectra in Fig. 1d can remove some spectral variations while enhancing others. The effects of data preprocessing should be tested by model performance.

Optimization of Model Parameters and Model Validation

For nonlinear LS-SVM and PLS models, model and nonlinear transformation parameters should be optimized. For LS-SVM with Gaussian kernel function, two parameters, γ and σ, need to be tuned. The kernel width parameter, σ, controls the confidence in the data and the nonlinear nature of the model. A lower means a narrower kernel and a more complex nonlinear model. The parameter γ controls the tradeoff between maximizing the margin and minimizing the training error, a too small value of γ will lead to an under-fitted model; if γ is too large, the model tends to overfit the training data and the model will have poor prediction performance. Therefore, γ should be optimized together with the kernel width parameter σ. To optimize the two parameters in LS-SVM and the model complexity (number of latent variables) of PLSDA, root mean squared error obtained by MCCV (RMSEMCCV) (Xu and Liang 2001) was performed with different combinations of regularization parameter γ and kernel width parameter σ. Compared with the traditional leave-one-out cross validation (LOOCV), MCCV can effectively reduce the risk of overfitting by multiple resampling of the training set and a higher rate of leave-out samples.

For nonlinear PLS model with kernel function, there are also two parameters to be optimized, the number of significant PLS components, A, and the kernel width parameter, σ. Retaining too few components will lead to an under-fitted model that will produce bias in the prediction, while including too many components means over-fitting and poor predictive performance on future samples. Therefore, MCCV was also used to simultaneously determine A and σ for nonlinear PLS model with kernel function.

For PLS combined with B-spline transformation, the most commonly used cubic B-spline function with uniform knot-vector was used. To fit the local information in the spectral data, a small number of the interpolation nodes were preferred and it was set to be 3 in this paper. Therefore, only selection of the number of PLS components was required and MCCV was used for this purpose.

In this paper, the resampling time of MCCV was set to be 200, and each time, 20% of training samples were left out for prediction. The parameter optimization of PLS with B-spline transformation, LS-SVM with kernel transformation, and PLS with kernel transformation is demonstrated in Fig. 2. To obtain a robust model, the parameters were determined to have a low RMSEMCCV value and lie in a local smoothing area of the RMSEMCCV surface plot as shown in Fig. 2b, c.

Fig. 2
figure 2

Parameter optimization of three nonlinear models PLS with B-spline transformation (a), LS-SVM with kernel transformation (b), and PLS with kernel transformation (c)

Comparison of Model Performance

The DUPLEX method was performed to split the 151 measured samples into a training set of 110 samples and a test set of 41 samples. Linear PLS was also performed to compare with the nonlinear models. With the raw data and differently preprocessed data, the prediction results and optimized parameters of PLS and LS-SVM models are demonstrated in Table 2.

Table 2 Prediction results of 41 flavored dry tofu samples by linear PLS, nonlinear PLS, and LS-SVM with different preprocessing methods

Seen from Table 2, preprocessing can generally reduce the complexity of PLS models and improve the prediction accuracy for both linear and nonlinear models. Linear models obtained much poorer prediction accuracy than nonlinear models, indicating their insufficiency to describe the complex nonlinear relationship between shelf-life and FTIR spectra. Compared with PLS and LS-SVM with a Gaussian kernel transformation, PLS with B-spline function obtained slightly higher root mean squared error of prediction (RMSEP) values with second derivative and SNV spectra, which might be attributed to the more flexibility obtained by Gaussian kernel transformation. However, with B-spline function, there is just one parameter, the number of PLS components to be estimated as shown in Fig. 2a, which is much easier to use. PLS with B-spline function obtained an RMSEP of 9.6 days (with second derivative spectra) and 10.1 days (with SNV spectra). The lowest RMSEP (8.8 days) was obtained by LS-SVM with Gaussian kernel and SNV preprocessing. Generally speaking, the difference among the results obtained by PLS with B-spline function, PLS with Gaussian kernel and LS-SVM with Gaussian kernel was insignificant. Therefore, the simplest method, PLS with B-spline function should be preferred considering its low complexity and good generalization performance. The training and prediction results by PLS with second derivative spectra are also shown in Fig. 3.

Fig. 3
figure 3

The training and prediction results by PLS with B-spline transformation and second-order derivative spectra

Conclusions

Rapid shelf-life analysis methods of flavored dry tofu samples were developed by FTIR spectroscopy and chemometric nonlinear multivariate calibration. The effects of different nonlinear transformations and data preprocessing on model accuracy were investigated. The analysis results indicate: (1) spectra preprocessing by taking second-order derivative and SNV is useful to improve model accuracy for both linear and nonlinear models; (2) while linear PLS model was insufficient to describe the complex nonlinear relationship between spectra and shelf-life, nonlinear models obtained an RMSEP about 10 days; (3) PLS with B-spline function just has one parameter to select and obtained comparable performance with PLS and LS-SVM based on Gaussian kernel transformation; therefore, it is recommended PLS with B-spline function should be preferred to ensure the model generalization.

This research demonstrates that FTIR spectroscopy combined with nonlinear multivariate calibration provides an accurate and reliable method to predict the shelf-life of flavored dry tofu. Although it is difficult to perform an exhaustive sampling of all types of flavored tofu samples, this study is successful in predicting the shelf-life covering a wide range (29 to 161 days) for a representative product. The proposed method would serve as an alternative method to the traditional sensory and biological analysis. However, caution should be taken when predictions are made for unknown samples of different producers or production procedures. In such cases, it is recommended that separate calibration models should be built with similar samples to reduce model complexity and the risk of prediction degradation.