## 2 Theory of the LRSC Algorithm  
### Recognition Based on Linear Regression  
Unlike common linear regression models, LRSC does not use spectral data to represent label information. Instead, it conducts linear representation using the spectral data of the training samples, based on the spectra of the prediction samples. Based on the nearest neighbor (NN) method and the linear subspace of single-class objects, it then determines the linear subspace composed of single-class objects that is nearest to the prediction sample, and then performs the recognition. As the simple three-dimensional data graph in Figure 1 shows, training sample data of the same kind can form a single-class linear subspace such as the two-dimensional plane \(X\). If a new three-dimensional prediction sample \(y\) belongs to the class \(X\), it can be ideally represented by the linear space of all samples in class \(X\), i.e., \(\overline{y}\), or its distance \(r\) from this linear space should be small. When complete training samples are used for linear representation, approximate samples are selected from the training samples for linear representation using the compressed sensing approach and the sparse mode. It analyzes the linear relationships between homogeneous data from the perspective of the samples, rather than conducting regression from a variable dimensional point of view. The data can also be regressed to the label value and recognized by the least squares method. For example, in the formula \(yl=X_{m\times m}\beta\), \(m\) rows are the number of the samples, \(n\) columns denote the dimension of the data (e.g., wavelength), and \(yl\) is the class label. However, for data in the form of a small number of samples with high dimensionality such as spectral data, the underdetermined equation often cannot obtain a unique solution. In this study, NN was used to select the approximate samples. The sample class with known prior information can be recognized for the spectral prediction data, and the prior information was included in the training samples. For a specific class of target samples of spectral data, \(X_{i}=\left[x_{i,1},x_{i,2},\ldots,x_{i,n_{i}}\right]\in\mathbb{R}^{m\times n}\), the spectral sample of a specific class in the training set is represented such that each sample \(x\) of data of class \(i\) is arranged in a matrix with \(m\) rows and \(n_{i}\) columns, where \(m\) stands for the dimensions of the spectral sample, e.g., wavelength or wavenumber, and \(n_{i}\) denotes the number of samples of class \(i\). For all classes of data, all the spectral data in \(X\) can be represented as \(X=\left[X_{1},\,X_{2},\,\ldots,\,X_{k}\right]=\left[x_{1,1},\,x_{1,2},\, \ldots,\,x_{1,n_{1}},\,x_{2,1},\,x_{2,2},\,\ldots,\,x_{2,n_{2}},\,\ldots,\,x_{ k,n_{k}}\right]\). Data of class \(k\) are ordered in columns. A specific prediction sample \(y\) can then be represented by the linear framework as:  
\[y=\alpha_{1,1}x_{1,1}+\alpha_{1,2}x_{1,2}+\ldots+\alpha_{k,n_{k}}x_{k,n_{k}} \tag{1}\]  
where \(y\) denotes a prediction sample with \(m\) rows, one column. \(X\) denotes all the complete training samples that include all the classes, and \(\alpha\) represents the regression coefficient corresponding to each training sample, which can be any real number. All samples are represented by \(X\) and all the regression coefficients are denoted by a vector \(\beta_{0}\). The above expression can then be written as:  
\[y=X\beta_{0}\in\mathbb{R}^{m} \tag{2}\]  
\(X\) refers to the spectral data of information of the implicit class, and \(\beta_{0}\) is the regression coefficients, expressed in the form of a vector. Theoretically, for the prediction samples, the training samples of the same class can perform linear regression, i.e., the prediction samples are in the same linear space of a certain class of training samples. There will then be a suitable solution to \(\beta_{0}\).