Population prediction method and system based on adaptive ridge regression and multi-model stacking

By employing an adaptive ridge regression and multi-model stacking approach to population prediction, combining multilayer perceptron, random forest, and linear regression models, and dynamically adjusting weights, the uncertainty and complexity issues in population prediction are addressed. This approach achieves high-precision, multi-dimensional population prediction, supporting government decision-making and resource allocation.

CN122114267APending Publication Date: 2026-05-29DALIAN NATIONALITIES UNIVERSITY

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
DALIAN NATIONALITIES UNIVERSITY
Filing Date
2026-02-09
Publication Date
2026-05-29

Smart Images

  • Figure FT_1
    Figure FT_1
  • Figure FT_2
    Figure FT_2
  • Figure FT_3
    Figure FT_3
Patent Text Reader

Abstract

The present application relates to the technical field of machine learning and population prediction, and particularly relates to a population prediction method and system based on adaptive ridge regression and multi-model stacking; firstly, the original population data is preprocessed by anomaly value repair, first-order difference, standardization and PCA dimension reduction to generate time series features; then, three models of multilayer perceptron, random forest and linear regression are constructed, cross-validation and grid search are used to optimize the hyperparameters and complete the training; then, through the hierarchical stacking strategy, the prediction output of the basic model is input into the ridge regression sub-model as a new feature; finally, based on the performance of each basic model in different population characteristic prediction tasks, the weight proportion is dynamically adjusted through the regularization parameter, and the accurate prediction of multi-dimensional population characteristics is realized. The present application effectively integrates the advantages of each model, improves the prediction accuracy and stability of indicators such as total population, gender structure, urban-rural flow, and provides a scientific basis for population strategy formulation, public resource planning and risk warning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of machine learning and population prediction technology, specifically to a population prediction method and system based on adaptive ridge regression and multi-model stacking. Background Technology

[0002] Demographic trends are playing an increasingly important role in global economic and social development, with significant differences in population changes across different regions. Developing countries face population growth pressures, while developed countries face the challenges of an aging population and declining birth rates. These changes have a profound impact on labor markets and resource allocation. China, in particular, as the world's most populous country, experiences significant influences on domestic policies and global resource allocation due to its aging population and declining birth rate.

[0003] Traditional population forecasting methods primarily rely on mathematical and statistical models, such as regression analysis, grey system theory, and Bayesian methods. These methods possess some predictive power when data is relatively stable or has few variables, but they have limitations when dealing with complex multi-factor interactions and long-term population change trends. To overcome these limitations, researchers have proposed various improved methods. While these methods can improve forecast accuracy, they still face issues of uncertainty and computational complexity in long-term forecasting.

[0004] Machine learning, as a crucial tool for big data processing and pattern recognition, has gradually become a hot topic in population forecasting. Compared to traditional statistical methods, machine learning can better handle complex socioeconomic data and delve deeper into the underlying patterns within the data, thus providing more accurate population change predictions. Machine learning models, such as neural networks and random forests, have been widely applied to population forecasting and have achieved some success. Nevertheless, existing machine learning methods still face challenges in processing multi-source data and capturing complex trends, particularly in areas such as data acquisition, model interpretability, and computational resources. Summary of the Invention

[0005] The purpose of this invention is to propose a population prediction method and system based on adaptive ridge regression and multi-model stacking, which aims to improve the accuracy and stability of population prediction through the weighted fusion of multiple machine learning models.

[0006] According to a first aspect of the embodiments of this disclosure, a population prediction method based on adaptive ridge regression and multi-model stacking is provided, comprising the following steps: Preprocessing of raw population data yields time-series features; Three machine learning models, namely Multilayer Perceptron (MLP), Random Forest (RF), and Linear Regression (LR), were constructed. The hyperparameters of the models were optimized by combining cross-validation and grid search. The model training was completed based on the aforementioned temporal features. A stacking strategy is adopted, in which the predicted outputs of three machine learning models are used as new feature vectors and input into the Ridge Regression model. By introducing regularization to minimize the mean squared error (MSE), the optimal combination coefficients are learned. Based on the performance of each model in different population characteristic prediction tasks, the weight ratio of each model is dynamically adjusted by the regularization parameter of ridge regression to achieve prediction of multi-dimensional population characteristics.

[0007] In one embodiment, the original population data includes total indicators and structural indicators. The total indicators are the total population at the end of the year, the number of males, the number of females, and the male-to-female ratio. The structural indicators are the urban population, the rural population, the urbanization rate, and the ruralization rate. The above data are used to construct an initial time series feature matrix, where each column represents a feature variable and each row represents a time node.

[0008] In one embodiment, the specific method for preprocessing the raw population data is as follows: Outlier identification is performed using the mean, and missing values ​​are repaired using linear interpolation. The first-order difference method is used to convert the repaired time-series population data into an incremental sequence matrix. The differential increment sequence matrix is ​​standardized to obtain the standardized increment matrix: Then, principal component analysis (PCA) is used to extract principal components whose cumulative contribution rate reaches a preset threshold, construct a loading matrix, and project the standardized incremental matrix onto a low-dimensional orthogonal subspace to generate time series features.

[0009] In one embodiment, the cross-validation adopts time series 5-fold cross-validation to ensure that the validation data is located after the training data time, strictly adhering to the principle of "using the past to predict the future". After each model determines the optimal parameters through grid search, it is retrained on all training data. After training, the prediction results are destandardized and inversely differencing to restore the data to the original dimensions.

[0010] In one embodiment, the loss function of the ridge regression model is: in The loss function value for ridge regression; Let be the weight vector to be solved; The number of samples is the total number of time points (years) involved in the training.i This is the sample index, with a value range from 1 to n; For the first i The true value of each sample; For the first i Predicted values ​​for each sample; For regularization parameters; m The dimension of the weight vector; j For weighted indexes, For the first j The weight coefficients corresponding to each machine learning model; Convert the loss function to matrix norm form: in The meta-feature matrix is ​​formed by horizontally concatenating the predicted outputs of three machine learning models; A vector of true values; For regularization parameters; Taking the gradient of the loss function and setting it to zero, we obtain the linear operator equation: Extract common factors after sorting : in It is an identity matrix.

[0011] In one embodiment, the weights of each model are dynamically adjusted using the regularization parameter of ridge regression as follows: in, The optimal weight vector corresponds to the combination coefficients of the prediction results of each machine learning model. The optimal regularization parameter that minimizes the mean squared error (MSE) is automatically selected using a cross-validation algorithm. The weight ratio is dynamically adjusted based on the relative error and root mean square error (RMSE) of each machine learning model in predicting different population characteristics, thereby suppressing the adverse effects of weak models.

[0012] In one embodiment, the prediction method for multi-dimensional demographic characteristics is as follows: in, The optimal weight vector, The meta-feature matrix, This is the final prediction result vector, which is the population characteristic prediction value obtained after fusing the three models.

[0013] According to a second aspect of the present disclosure, a population prediction system based on adaptive ridge regression and multi-model stacking is provided, comprising: The data preprocessing module preprocesses the raw population data to obtain time-series features; The machine learning model training module constructs three machine learning models: multilayer perceptron (MLP), random forest (RF), and linear regression (LR). It optimizes the model hyperparameters by combining cross-validation and grid search, and completes model training based on the aforementioned time-series features. The model stacking and fusion module adopts a layered stacking strategy, taking the predicted outputs of three machine learning models as new feature vectors and inputting them into the Ridge Regression model. By introducing regularization to minimize the mean squared error (MSE), the optimal combination coefficients are learned. The adaptive weight adjustment and prediction module dynamically adjusts the weight ratio of each model based on the performance of each model in different population characteristic prediction tasks, and realizes the prediction of multi-dimensional population characteristics by using the regularization parameter of ridge regression.

[0014] According to a third aspect of the present disclosure, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and running on the memory, wherein the processor executes the program to implement the population prediction method based on adaptive ridge regression and multi-model stacking.

[0015] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the population prediction method based on adaptive ridge regression and multi-model stacking.

[0016] The advantages of the above technical solutions adopted in this invention compared with the prior art are as follows: 1. The high-precision, multi-dimensional population prediction model constructed in this invention can accurately capture the changing patterns of core population indicators such as total population, gender structure, and urban-rural migration, significantly improving the predictive ability of key indicators. The output quantitative prediction results can provide a scientific and reliable basis for decision-making in population development strategy formulation, public service supply optimization, and social security system planning, effectively enhancing the forward-looking layout and precise implementation level of the population governance system.

[0017] 2. By predicting future population size, distribution patterns, and evolutionary trends, this invention can provide data support for government departments, helping them to rationally plan public resources such as education, healthcare, transportation, and housing, thus avoiding waste caused by excessive resource investment or demand gaps caused by insufficient supply. Simultaneously, the prediction results can empower the scientific formulation of urban and rural planning and regional coordinated development policies, promote the standardized and refined management of urbanization, and ultimately improve the overall utilization efficiency of social resources.

[0018] 3. High-precision population forecasting results can be directly applied to risk warning in scenarios such as public emergencies and natural disasters, providing strong support for governments to improve emergency management response speed and efficiency. Furthermore, the multi-model fusion method employed in this invention provides a new paradigm for the deep application of artificial intelligence technology in fields such as demography, social governance, and macroeconomic forecasting. It effectively breaks down disciplinary barriers, promotes the deep integration of computer science, demography, sociology, and other disciplines, and contributes to the continuous improvement and development of intelligent governance systems. Attached Figure Description

[0019] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments of this application and their descriptions are used to explain this application and do not constitute an undue limitation of this application.

[0020] Figure 1 The flowchart shows a population prediction method based on adaptive ridge regression and multi-model stacking. Figure 2 The image shows the fitting result of the multilayer perceptron. Figure 3 The image shows the fitting result of the random forest. Figure 4 This is a graph showing the results of the linear regression fitting. Figure 5 This is a diagram showing the fitting effect of layered stacking. Figure 6 This is a graph showing the error comparison (population count). Figure 7 This is a graph showing the comparison (proportion) of errors. Detailed Implementation

[0021] The present disclosure will be further described below with reference to the accompanying drawings and embodiments.

[0022] It should be noted that the following detailed descriptions are exemplary and intended to provide further explanation of this application. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains.

[0023] It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the exemplary embodiments according to this application. As used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise. Furthermore, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof.

[0024] It should be noted that the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of methods and systems according to various embodiments of this disclosure. It should be noted that each block in a flowchart or block diagram may represent a module, segment, or portion of code, which may include one or more executable instructions for implementing the logical functions specified in the various embodiments. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than that shown in the drawings. For example, two consecutively represented blocks may actually be executed substantially in parallel, or they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the flowcharts and / or block diagrams, and combinations of blocks in the flowcharts and / or block diagrams, may be implemented using a dedicated hardware-based system that performs the specified functions or operations, or using a combination of dedicated hardware and computer instructions.

[0025] Example 1: This embodiment provides a population prediction method based on adaptive ridge regression and multi-model stacking, including the following steps: S1. Preprocess the raw population data to obtain time-series features; In this embodiment, constructing a multidimensional population feature set is the core foundation of the model input. The selected population feature data covers multiple key dimensions such as population size and population structure, specifically including the following feature variables: (1) Total indicators: total population at the end of the year, number of males, number of females and male-to-female ratio; (2) Structural indicators: urban population, rural population and urbanization rate, ruralization rate (wherein, the urbanization rate is the proportion of urban population to total population). Based on the above feature variables, the multidimensional time series data is constructed into an initial feature matrix, where each column of the matrix corresponds to a feature variable and each row corresponds to a time node (i.e., year).

[0026] Before model training, the original population time series data needs to be preprocessed. The preprocessing process includes outlier detection and repair, first-order differencing, and data standardization. Specifically, outlier detection and repair are implemented by using the criterion of "mean ± 2 standard deviations" to identify outliers in the data, and then using linear interpolation to repair the detected outliers and missing values ​​in the data.

[0027] For elements that are judged to be abnormal or missing Utilizing adjacent valid observations on the time axis and Construct a local linear mapping. The repaired value. The following geometric proportional relationships must be satisfied: The interpolation operator is obtained by solving: This method ensures that the repaired data points lie on the line connecting the two valid observations, thus maintaining the local continuity of the population growth trend.

[0028] Next, the first-order difference method is used to stabilize the population size and proportion characteristics. The time-series population data... Convert to incremental sequence For each feature column At the point in time The formula for calculating the difference at point is: Transforming the forecast of next year's population into a forecast of next year's increase eliminates the linear deterministic trend in the time series, allowing the model to focus on capturing the dynamic evolution of population growth rates. The differencing matrix: Next to Standardization is necessary for Calculate the mean for each column. and standard deviation Then, the standardized data is obtained using the following formula. : Finally, principal component analysis (PCA) is used to reduce the dimensionality of the data, retaining principal components with a cumulative contribution rate of up to (e.g., 95%) to remove noise and improve computational efficiency. Matrix The covariance matrix can be expressed as a matrix product: Solve the characteristic equation of the covariance matrix and extract the eigenvalues. With the corresponding feature vector : By solving the above equation, we obtain nonnegative eigenvalues For each eigenvalue Solve the system of linear equations: Obtain orthogonally normalized eigenvectors Each eigenvector represents a principal axis direction in the original feature space, and these principal axes are orthogonal to each other, thus eliminating collinearity among features. Before computation... Cumulative variance contribution rate of each principal component This reflects the proportion of original population information retained in the dimensionality-reduced data: Based on the above criteria, the first... Construct the load matrix from the eigenvectors The standardized incremental matrix is ​​obtained by using the load matrix. Projecting onto a low-dimensional orthogonal subspace yields the feature matrix of the final input model. : S2. Construct three machine learning models: Multilayer Perceptron (MLP), Random Forest (RF), and Linear Regression (LR). Optimize the model hyperparameters using a combination of cross-validation and grid search. Complete model training based on the aforementioned temporal features. This embodiment uses the feature data after dimensionality reduction by differential processing and principal component analysis (PCA) as a basis, and trains three machine learning models on the multidimensional population features respectively. Among them, multilayer perceptron (MLP) is used to capture nonlinear features in the data. The optimal model structure is determined by grid search to be a single hidden layer (preferably containing 30 neurons), and the ReLU activation function is used to introduce a nonlinear mechanism to enable the model to deeply explore the complex correlations in the data. Random forest (RF) focuses on processing the complex interaction relationships between features, and its optimal parameters are also determined by grid search algorithm. Linear regression (LR) is used to model the linear change law related to population size and proportion.

[0029] Each model is trained on an independent training set, and hyperparameters are adjusted using cross-validation to ensure optimal performance for each model. To further improve the model's fitting effect and generalization ability, this invention employs time-series-based 5-fold cross-validation (TimeSeriesSplit) during the model training phase. This method differs from the random sample partitioning of conventional K-Fold cross-validation, strictly ensuring that the validation data for each fold is located after the time series of the training data, always adhering to the core principle of "using the past to predict the future," which aligns with the characteristics of population time-series data. For each hyperparameter combination, the model's mean squared error (MSE) is calculated on the 5-fold validation dataset. By comparing the model performance corresponding to different hyperparameter combinations, the optimal parameter configuration is selected, and the model is retrained based on the entire training data, ultimately obtaining a stable basic prediction model.

[0030] Next, according to the formula The transformation is then destandardized to obtain incremental prediction data in the original dimensions; next, inverse differencing is performed to restore the data to its original form, and the difference matrix... It can also be written as: make ,but The data is restored to its original state to obtain the model's prediction results in the original dimensions. ,Right now .

[0031] S3. A stacking strategy is adopted, and the predicted outputs of the three machine learning models are used as new feature vectors and input into the Ridge Regression model. By introducing regularization to minimize the mean squared error (MSE), the optimal combination coefficients are learned. Specifically, the predicted output levels of the three machine learning models (MLP, RF, and LR) are concatenated to form a new meta-feature matrix: The ridge regression model incorporates the predictions from three machine learning methods as new features using a stacking approach. This model aims to minimize the mean squared error (MSE) and learns an optimal set of combined coefficients to integrate the predictions from each machine learning model. To effectively mitigate multicollinearity among the meta-features and reduce the risk of overfitting, an L2 regularization term is introduced into the ridge regression loss function, defined as follows: In order to efficiently solve for the optimal weight vector using a closed-form solution, the above scalar summation form is converted into a matrix operation form. The meta-feature matrix, For the true value vector, Let be the weight vector to be solved. The coefficients of the constant term are ignored. (It does not affect the location of the extreme points), the loss function can be rewritten in matrix norm form: The objective function is strictly convex in the parameter space. This property determines that its global optimal solution must exist and be unique, and this optimal solution lies precisely at the stationary point where the gradient is zero. Therefore, by taking the gradient of the objective function with respect to the weight vector ω, and setting the gradient vector to zero according to the first-order optimality condition, the problem of searching for the optimal weights can be transformed into solving a linear operator equation, as shown in the following equation: Arrange the equations and extract common factors : in It is an identity matrix. Due to the high correlation among population characteristics, the feature matrix... There may be multicollinearity, leading to It tends to become singular (irreversible). A regularization term is introduced. Then, by adding perturbations to the diagonal, the matrix was ensured. It is always a positive definite matrix and invertible, thus solving the problem of computational instability.

[0032] S4. Based on the performance of each model in different population characteristic prediction tasks, the weight ratio of each model is dynamically adjusted by the regularization parameter of ridge regression to achieve prediction of multi-dimensional population characteristics.

[0033] Specifically, the weights in ridge regression are obtained by minimizing the above loss function: Increase the regularization parameter This approach constrains the model to select smaller weight coefficients, thereby reducing model complexity and effectively suppressing overfitting. To determine the optimal regularization strength, this invention employs a cross-validation algorithm, which automatically selects the optimal value of the regularization parameter that minimizes the mean squared error (MSE), eliminating the need for manual iterative adjustments throughout the process. Utilizing an adaptive weight adjustment mechanism, the contribution ratio of each machine model in the fusion process is dynamically adjusted based on their actual performance in different population feature prediction tasks, ultimately achieving accurate prediction of multi-dimensional population features.

[0034] The entire experimental procedure is as follows: Figure 1 As shown, in this embodiment, the hierarchical stacking framework includes an L1 layer (machine learning model) and an L2 layer (ridge regression model). The L1 layer includes three machine learning models: MLP, random forest, and linear regression; each learning model is independently trained through cross-validation to generate its own prediction output. A ridge regression model is then trained as a meta-learning model, learning a set of optimal combined L1 prediction coefficients by minimizing the mean squared error (MSE). After determining the optimal ridge regression model, this model is used to predict the combined feature matrix. The input matrix is ​​linearly combined using the weight vectors obtained during training to obtain the final prediction result.

[0035] The fitting results of the three machine learning models are as follows Figure 2-4 As shown: the red dashed line (predicted value) and the blue solid line (true value) of the random forest model almost completely overlap in all subplots, showing the best fit; in contrast, the predicted trajectory of the linear regression model exhibits typical linear characteristics; the prediction curve of the multilayer perceptron (MLP) is highly similar to that of the linear regression, almost a straight line, and fails to adaptively fit the nonlinear variations present in the real data.

[0036] To comprehensively evaluate the accuracy and reliability of the prediction results of each model, an error evaluation method was used to conduct a comprehensive analysis of the prediction performance of different models. The details of the prediction errors of each model on different population characteristics are shown in Table 1-3.

[0037] Table 1: Error Assessment of Multilayer Perceptron Table 2: Random Forest Error Assessment Table 3: Error Estimation of Linear Regression Model Table 1 shows that the multilayer perceptron model exhibits strong accuracy in the "gender structure" prediction task, but the error increases significantly in the "urban-rural structure" prediction task. This result indicates that while the model can accurately capture the changing patterns of gender ratio-related characteristics, it has limitations in handling complex patterns such as urban-rural population distribution, leading to significant prediction bias. Table 2 shows that the random forest model's prediction error distribution across all demographic indicators is relatively balanced, with the prediction error for "male-female ratio" consistently remaining low, reflecting the high predictability of this feature. In predicting indicators related to "urban-rural distribution," the model also demonstrates stable performance. Although the relative error for "rural proportion" is the highest among all variables, it does not fluctuate drastically, and the relative error for total population prediction is controlled at 0.0057, with a root mean square error (RMSE) of 436.8, indicating that the random forest model performs stably and consistently across different demographic indicators. Table 3 shows that the linear regression model exhibits significant polarization when handling different types of population characteristics: it has extremely high accuracy in predicting "gender ratio," with a relative error of approximately 0.0015, demonstrating excellent linear fitting; however, it shows significant distortion in predicting "urban-rural structure," reflecting the inherent limitations of the model in handling complex population dynamics.

[0038] In summary, the results of the examples demonstrate that the inherent characteristics of the data have a decisive impact on the prediction results: "Gender structure," as a highly deterministic variable, can be accurately captured by all models, while the complexity of "urban-rural structure" makes it the main source of prediction errors for each model. Different algorithmic mechanisms exhibit drastically different performance characteristics, ranging from highly stable and balanced performance like the random forest model to local accuracy but global fluctuations in the multilayer perceptron, and extreme divergence in the linear regression model's prediction of simple versus complex variables. These differences indicate that model performance is not only a direct reflection of numerical accuracy but also a direct manifestation of the degree to which the algorithm's principles match the data characteristics (such as linearity and structural complexity). Therefore, when tackling population prediction tasks of varying difficulty, selecting a model architecture that is compatible with the data characteristics is more crucial than simply pursuing general performance indicators.

[0039] After determining the combined prediction model, the prediction performance of the model on different population characteristics was comprehensively evaluated by calculating the relative error and root mean square error (RMSE) between the true and predicted values. The specific error results are shown in Table 4.

[0040] Table 4: Estimation of Hierarchical Stacking Prediction Error Evaluation results show that the hierarchical stacked ensemble model achieves high prediction accuracy across all demographic indicators in the feature-level prediction task on the test set, with the best performance and highest prediction accuracy on population structure ratio features. Overall, this hierarchical stacked model effectively balances the prediction accuracy of population features at different scales, demonstrating robust comprehensive performance in multidimensional population prediction tasks.

[0041] Figure 5 The model's fit on the test set is demonstrated. Overall, the model exhibits excellent fit for most target features, accurately capturing the long-term evolution of population data. First, regarding population size characteristics, the predicted trajectory almost perfectly matches the actual curve, showing a stable growth or continuous stabilization. This indicates that the model has successfully learned the intrinsic growth mechanism behind population size and remains highly faithful to the absolute magnitude of the data. Second, the model also demonstrates robustness in handling population proportion characteristics. For variables with small fluctuations (such as the male-to-female ratio), the predicted results accurately reproduce subtle changes in the actual values ​​within a very narrow range; while for features with larger fluctuations (such as the "urban population ratio" and "rural population ratio"), the model clearly presents linear upward and downward trends related to the urbanization process.

[0042] exist Figure 6 As shown in Figure 7, there are significant performance differences among the base models. In contrast, the L2 stacked model exhibits stronger robustness: it not only achieves errors comparable to or even lower than the best base model on indicators such as "total population" and "male population," but also effectively avoids serious errors of some base models (such as the significant bias of MLP on "rural population"). This performance demonstrates that the meta-learning model can reasonably allocate weights and suppress the adverse effects of weak models. Furthermore, the advantages of the stacked model are even more pronounced in complex dynamic indicators such as "urban proportion" and "rural proportion." A single model struggles to capture multidimensional trends simultaneously, while the stacked model, by integrating the global fitting capability of MLP, the nonlinear pattern recognition capability of RF, and the linear trend inference capability of LR, achieves complementarity and synergy among models, thereby significantly improving the overall accuracy of population structure proportion prediction.

[0043] In summary, the visualization results further validate the effectiveness of the stacking strategy. By integrating the predictive capabilities of multiple base learning models, the second-level (L2) model not only achieves high numerical accuracy but also demonstrates significant robustness in capturing temporal trends, making it highly suitable for complex population dynamics prediction tasks.

[0044] Example 2: This embodiment provides a population prediction system based on adaptive ridge regression and multi-model stacking, including: The data preprocessing module preprocesses the raw population data to obtain time-series features; The machine learning model training module constructs three machine learning models: multilayer perceptron (MLP), random forest (RF), and linear regression (LR). It optimizes the model hyperparameters by combining cross-validation and grid search, and completes model training based on the aforementioned time-series features. The model stacking and fusion module adopts a layered stacking strategy, taking the predicted outputs of three machine learning models as new feature vectors and inputting them into the Ridge Regression model. By introducing regularization to minimize the mean squared error (MSE), the optimal combination coefficients are learned. The adaptive weight adjustment and prediction module dynamically adjusts the weight ratio of each model based on the performance of each model in different population characteristic prediction tasks, and realizes the prediction of multi-dimensional population characteristics by using the regularization parameter of ridge regression.

[0045] The above modules can be deployed on the same device or distributed devices; the division of modules is only a functional logic description and does not limit the specific physical boundaries or implementation order.

[0046] Example 3: An electronic device is provided for running the aforementioned "population prediction method based on adaptive ridge regression and multi-model stacking". The electronic device includes a processor, a memory, and optional communication interfaces / display devices / input devices, etc.; the memory stores a computer program that can run on the processor, and when the processor executes the program, it implements steps S1 to S4 of the method described in Embodiment 1, specifically including but not limited to: S1. Preprocess the raw population data to obtain time-series features; S2. Construct three machine learning models: Multilayer Perceptron (MLP), Random Forest (RF), and Linear Regression (LR). Optimize the model hyperparameters using a combination of cross-validation and grid search. Complete model training based on the aforementioned temporal features. S3. A stacking strategy is adopted, and the predicted outputs of the three machine learning models are used as new feature vectors and input into the Ridge Regression model. By introducing regularization to minimize the mean squared error (MSE), the optimal combination coefficients are learned. S4. Based on the performance of each model in different population characteristic prediction tasks, the weight ratio of each model is dynamically adjusted by the regularization parameter of ridge regression to achieve prediction of multi-dimensional population characteristics.

[0047] The electronic device hardware can be one of a server, personal computer, workstation, industrial controller, edge computing device, or mobile terminal; the processor can be a general-purpose CPU, GPU, NPU, FPGA, or a combination thereof; the memory can be RAM, ROM, flash memory, or disk array. The device can interact with local / remote data storage (acquiring observation data and outputting inversion results) through a communication interface. The above hardware configuration does not constitute a limitation of the present invention.

[0048] Example 4: A computer-readable storage medium storing a computer program, which, when run on a processor of an electronic device, causes the program to perform the method steps S1 to S4 described in Embodiment 1; the storage medium may be a disk, optical disk, flash memory, solid-state drive, read-only memory, random access memory, or any combination of the above media.

[0049] Those skilled in the art will understand that the modules or steps described above can be implemented using general-purpose computer devices. Optionally, they can be implemented using computer-executable program code, which can then be stored in a storage device for execution by a computer device. Alternatively, they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. This disclosure is not limited to any particular combination of hardware and software.

[0050] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

[0051] While the specific embodiments of this disclosure have been described above in conjunction with the accompanying drawings, this is not intended to limit the scope of protection of this disclosure. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art without creative effort based on the technical solutions of this disclosure are still within the scope of protection of this disclosure.

Claims

1. A population prediction method based on adaptive ridge regression and multi-model stacking, characterized in that, Includes the following steps: Preprocessing of raw population data yields time-series features; Three machine learning models, namely Multilayer Perceptron (MLP), Random Forest (RF), and Linear Regression (LR), were constructed. The hyperparameters of the models were optimized by combining cross-validation and grid search. The model training was completed based on the aforementioned temporal features. A hierarchical stacking strategy is adopted, and the predicted outputs of three machine learning models are used as new feature vectors and input into the ridge regression model. By introducing regularization to minimize the mean square error, the optimal combination coefficients are learned. Based on the performance of each model in different population characteristic prediction tasks, the weight ratio of each model is dynamically adjusted by the regularization parameter of ridge regression to achieve prediction of multi-dimensional population characteristics.

2. The population prediction method based on adaptive ridge regression and multi-model stacking according to claim 1, characterized in that, The original population data includes total indicators and structural indicators. The total indicators are the total population at the end of the year, the number of males, the number of females, and the male-to-female ratio. The structural indicators are the urban population, the rural population, the urbanization rate, and the ruralization rate. The above data are used to construct an initial time series feature matrix, where each column represents a feature variable and each row represents a time node.

3. The population prediction method based on adaptive ridge regression and multi-model stacking according to claim 1, characterized in that, The specific methods for preprocessing raw population data are as follows: Outlier identification is performed using the mean, and missing values ​​are repaired using linear interpolation. The first-order difference method is used to convert the repaired time-series population data into an incremental sequence matrix. The differential increment sequence matrix is ​​standardized to obtain the standardized increment matrix: Then, principal component analysis is used to extract principal components whose cumulative contribution rate reaches a preset threshold, and a loading matrix is ​​constructed. The standardized incremental matrix is ​​then projected onto a low-dimensional orthogonal subspace to generate time series features.

4. The population prediction method based on adaptive ridge regression and multi-model stacking according to claim 1, characterized in that, The cross-validation adopts time series 5-fold cross-validation to ensure that the validation data is located after the training data time, strictly adhering to the principle of "using the past to predict the future". After each model determines the optimal parameters through grid search, it is retrained on all training data. After training, the prediction results are destandardized and inversely differencing to restore the data to the original dimensions.

5. The population prediction method based on adaptive ridge regression and multi-model stacking according to claim 1, characterized in that, The loss function of the ridge regression model is: in The loss function value for ridge regression; Let be the weight vector to be solved; This refers to the number of samples, i.e., the total number of time points involved in training. i This is the sample index, with a value range from 1 to n; For the first i The true value of each sample; For the first i Predicted values ​​for each sample; For regularization parameters; m The dimension of the weight vector; j For weighted indexes, For the first j The weight coefficients corresponding to each machine learning model; Convert the loss function to matrix norm form: in The meta-feature matrix is ​​formed by horizontally concatenating the predicted outputs of three machine learning models; A vector of true values; For regularization parameters; Taking the gradient of the loss function and setting it to zero, we obtain the linear operator equation: Extract common factors after sorting : in It is an identity matrix.

6. The population prediction method based on adaptive ridge regression and multi-model stacking according to claim 5, characterized in that, The method of dynamically adjusting the weights of each model using the regularization parameter of ridge regression is as follows: in, The optimal weight vector corresponds to the combination coefficients of the prediction results of each machine learning model. The optimal regularization parameter that minimizes the mean squared error is automatically selected using a cross-validation algorithm. The weight ratio is dynamically adjusted based on the relative error and root mean square error of each machine learning model in predicting different population characteristics, thereby suppressing the adverse effects of weak models.

7. The population prediction method based on adaptive ridge regression and multi-model stacking according to claim 6, characterized in that, The prediction method for multi-dimensional demographic characteristics is as follows: in, The optimal weight vector, The meta-feature matrix, This is the final prediction result vector, which is the population characteristic prediction value obtained after fusing the three models.

8. A population prediction system based on adaptive ridge regression and multi-model stacking, characterized in that, include: The data preprocessing module preprocesses the raw population data to obtain time-series features; The machine learning model training module constructs three machine learning models: multilayer perceptron (MLP), random forest (RF), and linear regression (LR). It optimizes the model hyperparameters by combining cross-validation and grid search, and completes model training based on the aforementioned time-series features. The model stacking and fusion module adopts a layered stacking strategy, taking the predicted outputs of three machine learning models as new feature vectors and inputting them into the Ridge Regression model. By introducing regularization to minimize the mean squared error (MSE), the optimal combination coefficients are learned. The adaptive weight adjustment and prediction module dynamically adjusts the weight ratio of each model based on the performance of each model in different population characteristic prediction tasks, and realizes the prediction of multi-dimensional population characteristics by using the regularization parameter of ridge regression.

9. An electronic device, comprising a memory, a processor, and a computer program stored in the memory and running thereon, characterized in that, When the processor executes the program, it implements the population prediction method based on adaptive ridge regression and multi-model stacking as described in any one of claims 1-7.

10. A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the population prediction method based on adaptive ridge regression and multi-model stacking as described in any one of claims 1-7.