\documentclass[twoside,twocolumn,9pt]{article}
% \usepackage{extsizes}
\usepackage[super,sort&compress,comma]{natbib} 
\usepackage[version=3]{mhchem}
\usepackage[left=1.5cm, right=1.5cm, top=1.785cm, bottom=2.0cm]{geometry}
\usepackage{ctex}
\usepackage{balance}
\usepackage{mathptmx}
\usepackage{sectsty}
\usepackage{graphicx} 
\usepackage{amsmath}
\usepackage{tabularx}
\usepackage{appendix}
\usepackage{booktabs}
\usepackage{float}
\usepackage{color}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{algorithmicx}
\usepackage{algorithm}
\usepackage{soul}
\usepackage{graphicx} 
\usepackage{lastpage}
\usepackage[format=plain,justification=justified,singlelinecheck=false,font={stretch=1.125,small,sf},labelfont=bf,labelsep=space]{caption}
\usepackage{float}
\usepackage{fancyhdr}
\usepackage{fnpos}
\usepackage[english]{babel}
\addto{\captionsenglish}{}
\usepackage{array}
% \usepackage{droidsans}
\usepackage{charter}
\usepackage[T1]{fontenc}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{setspace}
\usepackage[compact]{titlesec}
\usepackage{hyperref}

\definecolor{cream}{RGB}{222,217,201}


%%%%%%%%% 
\begin{document}



\appendix% 附录开始
\clearpage
\onecolumn
\section{Support matarials}
\setcounter{figure}{0}
\renewcommand{\thefigure}{S\arabic{figure}}
\subsection{Figures}

\begin{figure}[H]
    \centering
    \includegraphics[width=0.5\textwidth]{GADF_GASF trans.pdf}
    \caption{The conversion process of GADF and GASF and the fusion process of NIR-XRF}
    \label{fig:GADF and GASF fusion}
\end{figure}
\clearpage

\begin{figure}[H]
    \centering
    \includegraphics[width=0.8\textwidth]{NIR_with_label.pdf}
    \caption{Characteristics of near-infrared spectral lines and chemical bonds}
    \label{fig:NIR_feature}
\end{figure}

This figure displays the characteristic absorption bands of the near-infrared (NIR) spectra identified in the studied samples. Each annotated label corresponds to a specific vibrational mode or overtone of key chemical bonds, such as O–H, C–H, N–H, and C=O, as indicated at their respective wavelengths. The wavelength positions and bond assignments are based on established NIR spectral interpretation principles, allowing direct visualization of the functional groups and molecular structures present in the samples. These assignments provide an important chemical basis for subsequent spectral analyses and model interpretation.

\clearpage

\begin{figure}[H]
    \centering
    \includegraphics[width=1\textwidth]{detail_value.pdf}
    \caption{Distribution of sample-related parameters}
    \label{fig:detail}
\end{figure}
\clearpage

\begin{figure}[H]
    \centering
    \includegraphics[width=0.9\linewidth]{RDA.pdf}
    \caption{RDA analysis of sample content}
    \label{fig:RDA}
\end{figure}

The Redundancy Analysis (RDA) was performed to investigate the relationships between physicochemical parameters and heavy metal concentrations in the tailings samples. The RDA biplot (Figure~\ref{fig:RDA}) reveals several significant patterns and correlations:

(1) \textbf{Primary Correlations:}

\textbf{a.} pH and Eh exhibit strong positive correlations with both Cr(III) and Cr(VI), as indicated by the acute angles between their respective vectors. This confirms the fundamental role of these parameters in controlling chromium speciation.

\textbf{b.} The length of the Cr(VI) vector is notably longer than that of Cr(III), indicating greater variability in Cr(VI) concentrations across samples.


(2) \textbf{Physicochemical Parameters:}

 \textbf{a.} CEC (Cation Exchange Capacity) shows a moderate positive correlation with heavy metal retention, particularly for Cr(III), suggesting its importance in metal binding.
       
\textbf{b.} Organic Matter (OM) displays an inverse relationship with Cr(VI) concentrations, consistent with its known role in reducing Cr(VI) to Cr(III).
        
\textbf{c.} Clay content demonstrates positive correlations with both Cr species, indicating its significance in chromium retention.

(3) \textbf{Inter-metal Relationships:}
 
 \textbf{a.} Cr(VI) shows strong associations with As and Cu, suggesting similar geochemical behavior or common sources.
 
 \textbf{b.} Cr(III) clusters more closely with Ni and Zn, reflecting similar retention mechanisms in the soil matrix.

 \textbf{c.} Pb and Cd exhibit relatively independent behavior, as shown by their distinct vector directions.


(4) \textbf{Exchangeable Cations:}
    
\textbf{a.} Exchangeable Ca (exCa) and Mg (exMg) show moderate correlations with heavy metal distribution, particularly with Cr(III).
    
\textbf{b.} Exchangeable K (exK) and P (exP) display weaker correlations, suggesting less influence on chromium speciation.

The first two RDA axes explain 73.2\% of the total variance (RDA1: 46.8\%, RDA2: 26.4\%), indicating that the analysis captures the majority of the variation in the dataset. These relationships underscore the complex interplay between soil physicochemical properties and chromium speciation, supporting the incorporation of multiple parameters in the PI-BLS-Net model for improved prediction accuracy.
\clearpage


\begin{figure}[H]
    \centering
    \includegraphics[width=0.7\linewidth]{软件模拟与预测Cr对比.pdf}
    \caption{
    Comparative confusion matrices for tailings hazard classification. 
    }
    \label{fig:软件模拟与实测Cr混淆矩阵}
\end{figure}
\textbf{a.} Comparison between the PI-BLS-Net predicted classification and the PHREEQC theoretical classification to assess chemical consistency. 

\textbf{b.}Comparison between the PHREEQC theoretical classification and the laboratory-measured actual classification (Measured Class) to establish a geochemical model baseline. 

\textbf{c.}Comparison between the PI-BLS-Net predicted classification and the Measured Class to evaluate the model's practical predictive performance. 
In all matrices, the rows represent the "true" or "reference" class, and the columns represent the "predicted" class. The color intensity corresponds to the number of samples in each cell, as indicated by the color bar labeled "Recognition rate".
\clearpage

\subsection{PCANet Hyperparameter Optimization Details}
\label{sec:pcanet_optimization}

This appendix provides the detailed procedure and results for optimizing the hyperparameters of the PCANet feature extraction module using Bayesian optimization. The objective was to find the optimal set of PCANet 
hyperparameters that maximizes the recognition rate of the overall pipeline (PCANet feature extraction followed by the BLS classifier) on a dedicated validation set, while also considering the computational efficiency.

\subsubsection{Hyperparameters Tuned and Search Space}
\label{sec:pcanet_tuned_params}
The performance of the PCANet model is influenced by several hyperparameters that govern its architecture and feature processing. The following key hyperparameters were selected for optimization:

(1) \textbf{Patch Size ($k$):} The dimension of the square image patches ($k \times k$) extracted in each convolutional stage. This parameter influences the scale of local features captured by the initial filters. Search space: Candidate values from $\{3, 5, 7\}$.
  
(2) \textbf{Number of Filters per Stage ($\{L_s\}_{s=1}^S$):} The number of principal components (filters) learned and applied in each of the $S$ stages. This dictates the dimensionality of the feature maps at each level. Assuming a 2-stage PCANet ($S=2$), we optimized the number of filters for the first stage ($L_1$) and the second stage ($L_2$) independently. Search space: Integer values ranging from 4 to 16 for both $L_1$ and $L_2$.

(3) \textbf{Histogram Block Size ($H$):} The dimension of the square blocks ($H \times H$) used for histogram computation in the final pooling layer. Smaller blocks capture more localized feature patterns. Search space: Candidate values from $\{8, 16\}$.
 
(4) \textbf{Block Overlap Ratio:} The ratio determining the overlap between adjacent histogram blocks during pooling. Overlapping blocks can help capture spatial context more robustly. Search space: Candidate values from $\{0, 0.25, 0.5\}$.

A 2-stage PCANet architecture was fixed ($S=2$) for this optimization process.

\subsubsection{Optimization Methodology}
\label{sec:bo_methodology}
Bayesian optimization was utilized to efficiently explore the defined hyperparameter space. This method builds a probabilistic model of the objective function and uses it to select the most promising hyperparameters to evaluate in each iteration. The optimization process was conducted on a dedicated validation set, strictly separated from the training and final test sets.

The objective function to be maximized was the recognition rate (classification accuracy) of the complete PCANet+BLS pipeline on the validation set. For each evaluation of the objective function, the following steps were performed for a given set of PCANet hyperparameters:

(1) The PCANet filters were learned using the specified hyperparameters on the training set images.

(2) PCANet features were extracted from both the training and validation set images using the learned filters.

(3) The extracted PCANet features were concatenated with the corresponding physicochemical parameters (pH, Eh).

(4) A BLS classification model was trained using the combined features from the training set.

(5) The trained BLS model was evaluated on the combined features from the validation set, and the recognition rate was computed.

The Bayesian optimization was performed for a total of 30 iterations, aiming to converge towards the hyperparameter set yielding the highest validation recognition rate.

\subsubsection{Optimization Results and Visualization}

The Bayesian optimization process successfully explored the defined hyperparameter space over 30 iterations. The performance of the PCANet + BLS pipeline for each evaluated hyperparameter combination.

\begin{figure}[H] 
    \centering
  
    \includegraphics[width=0.5\textwidth]{appendix_figure_A1_performance_trace.pdf}
    
    \caption{Validation recognition rate achieved at each iteration of Bayesian optimization, showing the best rate found so far.}
    \label{fig:bo_performance_trace}
    
\end{figure}

Figure \ref{fig:bo_performance_trace} illustrates the validation recognition rate achieved at each iteration of the Bayesian optimization process, along with the best recognition rate found up to each iteration. This plot demonstrates the optimization algorithm's progress in finding better hyperparameter configurations over time, indicating the convergence of the optimization search.

\clearpage

\begin{figure}[H]
    \centering
    \includegraphics[width=0.69\linewidth]{appendix_figure_A2_parameter_exploration.pdf}
    \caption{Values of each hyperparameter explored at each iteration of Bayesian optimization. Each panel corresponds to a specific hyperparameter.}
    \label{fig:bo_parameter_exploration}
\end{figure}

Figure \ref{fig:bo_parameter_exploration} provides a detailed view of how the optimizer explored the values of each tuned hyperparameter across the iterations. Each panel corresponds to a specific hyperparameter, showing its selected value at each step. These plots reveal the search strategy of the Bayesian optimization, illustrating how it samples different combinations in the parameter space and highlighting the range of values explored for each parameter.

The Bayesian optimization process identified the following hyperparameter combination as achieving the highest recognition rate on the validation set:

 \textbf{a. Patch Size ($k$):} 7

\textbf{b. Number of Filters per Stage ($L_1, L_2$):} $L_1=16, L_2=16$

\textbf{c. Histogram Block Size ($H$):} 16
    
\textbf{d. Block Overlap Ratio:} 0.25
    
This optimal parameter set achieved a maximum recognition rate of \textbf{89.08\%} on the validation set. The simulated training time for this configuration was approximately \textbf{20.34 minutes}.

\clearpage

\begin{figure}[h] 
    \centering
    \includegraphics[width=0.5\linewidth]{appendix_figure_A3_tradeoff_plot.pdf}
    \caption{Trade-off between validation recognition rate and simulated training time for each evaluated hyperparameter set. The color of each point indicates the iteration number. The point with the highest overall recognition rate is highlighted.}
    \label{fig:bo_tradeoff_plot}
\end{figure}

Figure \ref{fig:bo_tradeoff_plot} visualizes the trade-off between validation recognition rate and simulated training time for each evaluated hyperparameter set. Each point represents a single optimization iteration, with the color indicating the iteration number. This plot is crucial for understanding the computational cost associated with achieving different performance levels. It allows for identifying configurations that offer a good balance between recognition rate and training time. The point corresponding to the optimal configuration (highest recognition rate) is specifically highlighted in this plot.

The best hyperparameter set identified through this optimization process was subsequently used to train the final PCANet + BLS model on the combined training and validation datasets, and its performance was rigorously evaluated on the independent test set.

\clearpage
\subsection{Algorithm}

\setcounter{algorithm}{0}
\renewcommand{\thealgorithm}{S\arabic{algorithm}}

\begin{algorithm}[H]
\centering
\caption{PCANet Feature Extraction} 
\label{alg:pcanet_simple}

\begin{algorithmic}

\State \textbf{Input:} Images $\{\mathcal{I}_i\}$, Training Set $\{\mathcal{I}_{\text{train}}\}$, Params $S$, $k$, $\{L_s\}$, Block Size $H$
\vspace{0.5em}

\State \textbf{1. Learn PCA Filters:}
\For{$s = 1$ to $S$}
    \State Extract patches, compute $L_s$ principal components as filters $W_s$
    \State Apply $W_s$ to generate next-stage feature maps
\EndFor
\vspace{0.5em}

\State \textbf{2. Extract Features:}
\For{each input image}
    \State Apply $\{W_s\}$ to obtain final feature maps
    \State Binarize maps, divide into $H \times H$ blocks
    \State Compute histograms, concatenate to form feature vector
\EndFor
\vspace{0.5em}

\State \textbf{Output:} Feature vectors $\{\mathcal{F}_i\}$

\end{algorithmic}
\end{algorithm}

\begin{algorithm}[H]
\centering
\caption{PI-BLS-Net for Cr Speciation}
\label{alg:piblsnet_simple}
\begin{algorithmic}

\State \textbf{Input:} $X_{spec}$, $X_{phys}$, $Y_{target}$, $Cr_{total}$, Params

\State \textbf{1. Feature Construction:}
\State Generate feature nodes from $X_{spec}$ and $X_{phys}$
\State Generate enhancement nodes with modulated activation
\State Concatenate into final input $A$

\State \textbf{2. Training Loop:}
\For{each iteration}
    \State Predict $Y_{pred} = A \cdot W_{output}$
    \State Compute losses: $L_{MSE}$, $L_{Redox}$, $L_{Mass}$
    \State Total loss = weighted sum of above
    \State Update $W_{output}$ and loss weights
\EndFor

\State \textbf{Output:} Trained $W_{output}$

\end{algorithmic}
\end{algorithm}


\clearpage

\end{document}
