
Please generate an image: The core of combining clustering algorithms with NIPALS (linear) and KPLS (nonlinear) is to construct a three-stage architecture of "clustering stratification - model fitting - fusion prediction" to adapt to the modeling needs of heterogeneous data (including multiple subgroups, mixed linear and nonlinear features). The specific process is as follows: 1) Clustering stratification principle: Hierarchical clustering algorithm is used to group the preprocessed data set. The silhouette coefficient is used as the evaluation index, and the optimal number of clusters is automatically determined within the range of the "maximum number of clusters" set by the user. At the same time, clusters with sample sizes lower than the "minimum sample number threshold" are merged to ensure that each cluster has enough modeling samples (20-50 are recommended). 2) Intra-cluster nonlinearity detection: For each independent cluster, the model performance of linear NIPALS and nonlinear KPLS is compared through internal cross-validation (using the increase of R² as the criterion). If the R² increase of KPLS compared to NIPALS exceeds the "nonlinearity detection threshold" (default 5.0%), the cluster is determined to be a nonlinear feature and KPLS is selected for modeling; otherwise, it is determined to be a linear feature and NIPALS is selected for modeling. 3) Model fusion and prediction: When a new sample is input, it is assigned to the corresponding cluster model through the nearest neighbor matching algorithm. The system automatically calculates the weighted R² of each cluster (weighted by the cluster sample size), outputs the overall prediction result, and retains the independent modeling parameters and performance indicators of each cluster to support interactive analysis. Please draw the algorithm flow chart of CPLS with reference to the given picture and export it in mermaid form.