Mountain building toughness evaluation machine learning model construction method and device

By constructing a machine learning model for resilience evaluation of mountain buildings, the problem that traditional evaluation methods are difficult to accurately evaluate in complex mountain environments is solved, and stronger generalization ability and stability is achieved, which is suitable for mountain urbanization construction.

CN120277773APending Publication Date: 2025-07-08BEIJING CHAOXU DINGXIN MUNICIPAL ENG INSPECTION TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510356185.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-25
Publication Date
2025-07-08

Smart Images

  • Figure CN120277773A_ABST
    Figure CN120277773A_ABST
Patent Text Reader

Abstract

The invention discloses a mountain building toughness evaluation machine learning model construction method and device. According to the method, mountain building toughness grades are divided into a grade I, a grade II and a grade III; constructing a mountain building toughness evaluation factor database; constructing a mountain building toughness evaluation model and performing preliminary optimization; selecting a recursive feature elimination strategy to screen out a master control factor; obtaining an importance sorting result of the main control factors through an average accuracy decrease value method and an average Gini coefficient decrease value method; selecting a random forest algorithm as a processing algorithm of the model; selecting a confusion matrix as an analysis evaluation strategy of the model; performing parameter optimization on the random forest algorithm through a loop iteration strategy to obtain optimal parameters; and inputting the optimal parameters into the mountain building toughness evaluation model for iterative optimization to obtain a target mountain building toughness evaluation model. The method can effectively deal with complex and changeable actual scenes, and provides a more accurate and robust solution for mountain building toughness evaluation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of mountain building resilience evaluation, and particularly relates to a method and device for constructing a machine learning model for mountain building resilience evaluation. Background Art

[0002] Resilient cities are one of the important goals of urbanization construction and have become hot issues in research and application. As one of the common topographic classifications, mountains are widely distributed. The vast mountain area and numerous mountain towns are the objective status quo of China's topography and urbanization construction. Therefore, future urbanization in China will focus on urbanization in mountainous areas.

[0003] Currently, in the face of a complex and vast mountain environment, how to construct "resilient mountain towns" has become an unavoidable issue in urbanization construction, and the resilience of mountain buildings is one of the main contents of mountain town resilience. In the construction and operation of towns, there is still room for improvement in the traditional mountain building safety assessment methods in terms of research content and dynamic management.

[0004] Therefore, how to invent a mountain building resilience evaluation model that can effectively respond to complex and changing actual scenarios and provide a more accurate and robust solution for mountain building resilience evaluation has become an urgent problem to be solved. Summary of the Invention

[0005] For this reason, the present invention provides a method and device for constructing a machine learning model for mountain building resilience evaluation. By optimizing the model twice, including factor screening and parameter optimization, the performance indicators of the model are significantly improved. The optimized model not only has stronger generalization ability, but also shows excellent reliability and stability in the modeling of mountain building resilience evaluation. At the same time, the model can effectively respond to complex and changing actual scenarios and provide a more accurate and robust solution for mountain building resilience evaluation.

[0006] To achieve the above object, the present invention provides the following technical solution: A method for constructing a machine learning model for mountain building resilience evaluation, comprising:

[0007] Classify the mountain building resilience levels into Grade I, Grade II, and Grade III according to the set standard materials.

[0008] Construct a mountain building resilience evaluation factor database from four dimensions: topographic and geological factors, hydro-meteorological factors, environmental factors, and housing building attribute factors where the mountain building is located, based on multi-source original data and on-site investigations.

[0009] Construct a resilience evaluation model for mountain buildings, and use the influencing factors in the database of resilience evaluation factors for mountain buildings as the input layer and the actual resilience level of mountain buildings as the output layer to preliminarily optimize the resilience evaluation model for mountain buildings;

[0010] Select the recursive feature elimination strategy to screen out the main control factors from the database of resilience evaluation factors for mountain buildings;

[0011] Perform equal-weight assignment comprehensive sorting through the average accuracy decline value method and the average Gini coefficient reduction value method to obtain the importance ranking result of the main control factors;

[0012] Select the random forest algorithm as the processing algorithm for the resilience evaluation model of mountain buildings; select the confusion matrix as the analysis and evaluation strategy for the prediction effect of the resilience evaluation model of mountain buildings;

[0013] Use the main control factors as the input layer, and optimize the parameters of the random forest algorithm through the loop iteration strategy to obtain the optimal parameters of the resilience evaluation model of mountain buildings;

[0014] Input the optimal parameters into the resilience evaluation model of mountain buildings; test and train the resilience evaluation model of mountain buildings through test data and training data; analyze and evaluate the prediction effect of the resilience evaluation model of mountain buildings through the confusion matrix to obtain the evaluation result; perform iterative optimization on the resilience evaluation model of mountain buildings according to the evaluation result to obtain the target resilience evaluation model of mountain buildings.

[0015] As a preferred scheme of a method for constructing a machine learning model for evaluating the resilience of mountain buildings, the influencing factors in the database of resilience evaluation factors for mountain buildings include: elevation, slope, aspect, slope position, curvature, plane curvature, profile curvature, microtopography, terrain humidity index, terrain roughness index, formation lithology, average annual temperature, maximum temperature, average annual rainfall, aridity, distance from fault, distance from road, distance from river, building structure, construction year, number of building floors, and building use.

[0016] As a preferred scheme of a method for constructing a machine learning model for evaluating the resilience of mountain buildings, during the process of constructing the database of resilience evaluation factors for mountain buildings, perform normalization preprocessing on the reclassified data of the influencing factors, normalize all numerical values to be distributed between [0, 1], change the dimensional expression to a dimensionless expression, and make each influencing factor at the same scale;

[0017] The calculation formula for the normalization preprocessing is:

[0018]

[0019] Wherein, X* is the data obtained after normalization processing; X is the original data; X min , X max are the minimum and maximum values of the data respectively.

[0020] As an optimized solution for a method of constructing a machine learning model for evaluating the resilience of mountain buildings, the main control factors include: elevation, slope aspect, microtopography, formation lithology, average annual temperature, maximum temperature, average annual rainfall, aridity, distance from roads, distance from rivers, building structure, construction year, number of building floors, and building use.

[0021] As an optimized solution for a method of constructing a machine learning model for evaluating the resilience of mountain buildings, in the process of analyzing and evaluating the prediction effect of the mountain building resilience evaluation model through the confusion matrix, the evaluation indicators include: accuracy, precision, recall rate, F1 value, and weighted F1 value;

[0022] The calculation formula for the accuracy is:

[0023]

[0024] Wherein, Accuracy is the accuracy; i and j are both resilience levels, i = 1, 2, 3; j = 1, 2, 3; N ij is the number of samples whose actual sample level belongs to i but is predicted as j; N ii is the number of samples whose actual sample level is consistent with the predicted level;

[0025] The calculation formula for the precision is:

[0026]

[0027] Wherein, Precision i is the precision; N ji is the number of samples whose predicted sample level is j but actually belongs to i;

[0028] The calculation formula for the recall rate is:

[0029]

[0030] Wherein, Recall i is the recall rate;

[0031] The calculation formula for the F1 value is:

[0032] F1 score i = 2 × Precision i × Recall i / (Precision i + Recalli )

[0033] In the formula, F1score i is the F1 value;

[0034] The calculation formula of the weighted F1 value is:

[0035]

[0036] In the formula, weighted-F1score is the weighted F1 value; W i is the weight, and i = 1, 2, 3.

[0037] The present invention also provides a device for constructing a machine learning model for evaluating the resilience of mountain buildings, based on the above method for constructing a machine learning model for evaluating the resilience of mountain buildings, including:

[0038] A resilience level setting module, configured to classify the resilience levels of mountain buildings into level I, level II, and level III according to the set standard materials of the specification;

[0039] A database construction module for evaluating factors of mountain buildings, configured to construct a database for evaluating factors of mountain buildings from four dimensions of topographic and geological factors, hydro-meteorological factors, environmental factors, and housing building attribute factors where the mountain buildings are located, based on multi-source original data and field research;

[0040] A model construction and preliminary optimization module for evaluating the resilience of mountain buildings, configured to construct a model for evaluating the resilience of mountain buildings, and use the influencing factors in the database for evaluating factors of mountain buildings as the input layer, and the actual resilience level of the mountain buildings as the output layer, to perform preliminary optimization on the model for evaluating the resilience of mountain buildings;

[0041] A main control factor screening module, configured to screen out the main control factors from the database for evaluating factors of mountain buildings by selecting the recursive feature elimination strategy;

[0042] An importance ranking module, configured to perform comprehensive ranking with equal weight assignment through the average accuracy drop value method and the average Gini coefficient reduction value method to obtain the importance ranking result of the main control factors;

[0043] A processing algorithm and analysis and evaluation strategy selection module, configured to select the random forest algorithm as the processing algorithm for the model for evaluating the resilience of mountain buildings; select the confusion matrix as the analysis and evaluation strategy for the prediction effect of the model for evaluating the resilience of mountain buildings;

[0044] An optimal parameter acquisition module for the algorithm, configured to use the main control factors as the input layer, and optimize the parameters of the random forest algorithm through a loop iteration strategy to obtain the optimal parameters of the model for evaluating the resilience of mountain buildings;

[0045] The target mountain building resilience evaluation model acquisition module is used to input the optimal parameters into the mountain building resilience evaluation model; test and train the mountain building resilience evaluation model with test data and training data; analyze and evaluate the prediction effect of the mountain building resilience evaluation model through the confusion matrix to obtain an evaluation result; and iteratively optimize the mountain building resilience evaluation model according to the evaluation result to obtain the target mountain building resilience evaluation model.

[0046] As an optimal solution of a machine learning model construction device for mountain building resilience evaluation, in the mountain building resilience evaluation factor database construction module, the influencing factors of the mountain building resilience evaluation factor database include: elevation, slope, aspect, slope position, curvature, plane curvature, profile curvature, microtopography, terrain humidity index, terrain roughness index, formation lithology, average annual temperature, maximum temperature, average annual rainfall, aridity, distance from fault, distance from road, distance from river, building structure, construction year, number of building floors, and building use.

[0047] As an optimal solution of a machine learning model construction device for mountain building resilience evaluation, in the mountain building resilience evaluation factor database construction module, during the process of constructing the mountain building resilience evaluation factor database, reclassified data of the influencing factors are preprocessed by normalization, all numerical values are normalized to be distributed between [0, 1], and dimensional expressions are changed into dimensionless expressions so that each influencing factor is at the same scale;

[0048] The calculation formula for the normalization preprocessing is:

[0049]

[0050] In the formula, X* is the data obtained after normalization processing; X is the original data; X min and X max are the minimum and maximum values of the data respectively.

[0051] As an optimal solution of a machine learning model construction device for mountain building resilience evaluation, in the main control factor screening module, the main control factors include: elevation, aspect, microtopography, formation lithology, average annual temperature, maximum temperature, average annual rainfall, aridity, distance from road, distance from river, building structure, construction year, number of building floors, and building use.

[0052] As an optimal solution of a machine learning model construction device for mountain building resilience evaluation, in the target mountain building resilience evaluation model acquisition module, during the process of analyzing and evaluating the prediction effect of the mountain building resilience evaluation model through the confusion matrix, the evaluation indicators include: accuracy, precision, recall rate, F1 value, and weighted F1 value;

[0053] The calculation formula for the accuracy rate is as follows:

[0054]

[0055] In the formula, Accuracy is the accuracy rate; i and j are both toughness levels, where i = 1, 2, 3; j = 1, 2, 3; N ij is the number of samples whose actual sample level belongs to i but is predicted as j; N ii is the number of samples whose actual sample level is consistent with the predicted level;

[0056] The calculation formula for the precision rate is as follows:

[0057]

[0058] In the formula, Precision i is the precision rate; N ji is the number of samples whose predicted sample level is j but actually belongs to i;

[0059] The calculation formula for the recall rate is as follows:

[0060]

[0061] In the formula, Recall i is the recall rate;

[0062] The calculation formula for the F1 value is as follows:

[0063] F1 score i = 2 × Precision i × Recall i / (Precision i + Recall i )

[0064] In the formula, F1score i is the F1 value;

[0065] The calculation formula for the weighted F1 value is as follows:

[0066]

[0067] In the formula, weighted-F1score is the weighted F1 value; W i is the weight, where i = 1, 2, 3.

[0068] The present invention has the following advantages: According to the set standard materials, the resilience levels of mountain buildings are divided into Grade I, Grade II, and Grade III; based on multi-source original data and on-site investigations, a resilience evaluation factor database for mountain buildings is constructed from four dimensions: topographic and geological factors, hydro-meteorological factors, environmental factors, and building property factors of the mountain buildings; a resilience evaluation model for mountain buildings is constructed, and the influencing factors in the resilience evaluation factor database for mountain buildings are used as the input layer, and the actual resilience level of the mountain buildings is used as the output layer to preliminarily optimize the resilience evaluation model for mountain buildings; by selecting the recursive feature elimination strategy, the main control factors are screened out from the resilience evaluation factor database for mountain buildings; through the equal-weight assignment comprehensive ranking by the average accuracy drop value method and the average Gini coefficient reduction value method, the importance ranking result of the main control factors is obtained; the random forest algorithm is selected as the processing algorithm for the resilience evaluation model for mountain buildings; the confusion matrix is selected as the analysis and evaluation strategy for the prediction effect of the resilience evaluation model for mountain buildings; according to the main control factors as the input layer, the parameters of the random forest algorithm are optimized through the loop iteration strategy to obtain the optimal parameters of the resilience evaluation model for mountain buildings; the optimal parameters are input into the resilience evaluation model for mountain buildings; the resilience evaluation model for mountain buildings is tested and trained with test data and training data; the prediction effect of the resilience evaluation model for mountain buildings is analyzed and evaluated through the confusion matrix to obtain the evaluation result; according to the evaluation result, the resilience evaluation model for mountain buildings is iteratively optimized to obtain the target resilience evaluation model for mountain buildings. By optimizing the model twice, including factor screening and parameter optimization, the present invention significantly improves various performance indicators of the model. The optimized model not only has stronger generalization ability, but also shows excellent reliability and stability in the resilience evaluation modeling of mountain buildings. The present invention can effectively cope with complex and changeable actual scenarios and provides a more accurate and robust solution for the resilience evaluation of mountain buildings. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only exemplary, and for those of ordinary skill in the art, without creative efforts, other implementation drawings can be obtained according to the provided drawings.

[0070] The structures, proportions, sizes, etc. illustrated in this specification are only used to match the content disclosed in the specification for those familiar with this technology to understand and read, and are not used to limit the implementation conditions of the present invention. Therefore, they do not have substantial technical significance. Any modification of the structure, change in the proportional relationship, or adjustment of the size, without affecting the efficacy that the present invention can produce and the purpose that can be achieved, should still fall within the scope covered by the technical content disclosed in the present invention.

[0071] Figure 1 It is a schematic flowchart of a method for constructing a machine learning model for evaluating the resilience of mountain buildings provided in Embodiment 1 of the present invention;

[0072] Figure 2 It is a schematic diagram of the optimization loop of algorithm parameters in a method for constructing a machine learning model for evaluating the resilience of mountain buildings provided in Embodiment 1 of the present invention;

[0073] Figure 3 It is a schematic diagram of the architecture of a device for constructing a machine learning model for evaluating the resilience of mountain buildings provided in Embodiment 2 of the present invention. Detailed implementation manners

[0074] The following specific embodiments illustrate the implementation manners of the present invention. Those familiar with this technology can easily understand other advantages and effects of the present invention from the content disclosed in this specification. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of them. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the scope of protection of the present invention.

[0075] Embodiment 1

[0076] See Figure 1 , Embodiment 1 of the present invention provides a method for constructing a machine learning model for evaluating the resilience of mountain buildings, including the following steps:

[0077] S1. According to the set standard materials, the resilience levels of mountain buildings are divided into Grade I, Grade II, and Grade III;

[0078] S2. According to multi-source original data and on-site investigations, a database of evaluation factors for the resilience of mountain buildings is constructed from four dimensions: topographic and geological factors, hydro-meteorological factors, environmental factors, and housing building attribute factors where the mountain buildings are located;

[0079] S3. A machine learning model for evaluating the resilience of mountain buildings is constructed, and the influencing factors in the database of evaluation factors for the resilience of mountain buildings are used as the input layer, and the actual resilience level of the mountain buildings is used as the output layer, and the machine learning model for evaluating the resilience of mountain buildings is preliminarily optimized;

[0080] S4. Select the main control factors from the mountain building resilience evaluation factor database by using the recursive feature elimination strategy;

[0081] S5. Conduct an equal-weight assignment comprehensive ranking through the average accuracy decline value method and the average Gini coefficient reduction value method to obtain the importance ranking result of the main control factors;

[0082] S6. Select the random forest algorithm as the processing algorithm for the mountain building resilience evaluation model; select the confusion matrix as the analysis and evaluation strategy for the prediction effect of the mountain building resilience evaluation model;

[0083] S7. Use the main control factors as the input layer, and optimize the parameters of the random forest algorithm through a loop iteration strategy to obtain the optimal parameters of the mountain building resilience evaluation model;

[0084] S8. Input the optimal parameters into the mountain building resilience evaluation model; test and train the mountain building resilience evaluation model with test data and training data; analyze and evaluate the prediction effect of the mountain building resilience evaluation model through the confusion matrix to obtain the evaluation result; iteratively optimize the mountain building resilience evaluation model according to the evaluation result to obtain the target mountain building resilience evaluation model.

[0085] In this embodiment, in step S1, according to the set standard materials, the mountain building resilience levels are divided into level I, level II, and level III;

[0086] Specifically, referring to the "Standard for Appraisal of Dangerous Houses" and the "Technical Guidelines for the Appraisal of the Safety of Rural Houses", the mountain building resilience levels are divided into level I, level II, and level III. The specific classification is shown in Table 1:

[0087]

[0088] Table 1 Resilience Levels of Typical Buildings

[0089] In this embodiment, in step S2, according to multi-source original data and on-site investigations, a mountain building resilience evaluation factor database is constructed from four dimensions: topographic and geological factors, hydro-meteorological factors, environmental factors, and housing building attribute factors where the mountain building is located;

[0090] Among them, the influencing factors of the mountain building resilience evaluation factor database include: elevation, slope, aspect, slope position, curvature, plane curvature, profile curvature, micro-topography, terrain humidity index, terrain roughness index, stratigraphic lithology, average annual temperature, maximum temperature, average annual rainfall, aridity, distance from fault, distance from road, distance from river, building structure, construction year, number of building floors, and building use.

[0091] In this embodiment, to ensure the diversity of applicable models, eliminate the influence of data dimensions, and facilitate subsequent machine learning modeling, normalization preprocessing should be performed on the reclassified data of influencing factors. That is, all numerical values are normalized to be distributed between [0, 1], converting the dimensional expression into a dimensionless expression, so that each influencing factor is on the same scale. The calculation formula for the normalization preprocessing is as follows:

[0092]

[0093] In the formula, X* is the data obtained after normalization processing; X is the original data; X min and X max are the minimum and maximum values of the data respectively.

[0094] In this embodiment, in step S3, a mountain building resilience evaluation model is constructed, and the influencing factors in the mountain building resilience evaluation factor database are used as the input layer, and the actual level of mountain building resilience is used as the output layer to preliminarily optimize the mountain building resilience evaluation model;

[0095] Specifically, a mountain building resilience evaluation model is constructed, and all 22 influencing factors in the mountain building resilience evaluation factor database are used as the input layer, and the actual level of mountain building resilience is used as the output layer; based on the R language, the "mlbench" and "caret" packages are called, and the code is input to preliminarily optimize the mountain building resilience evaluation model.

[0096] In this embodiment, in step S4, by selecting the recursive feature elimination strategy, the main control factors are screened out from the mountain building resilience evaluation factor database;

[0097] Among them, the main control factors include: elevation, slope aspect, microtopography, formation lithology, average annual temperature, maximum temperature, average annual rainfall, aridity, distance from the road, distance from the river, building structure, construction year, number of building floors, and building use.

[0098] The selected indicators of the optimized leading factors include all building attribute factors, all meteorological and hydrological factors, 4 topographic and geological factors, and 2 environmental factors, which are comprehensive and representative.

[0099] In this embodiment, in step S5, through the average accuracy decline value method and the average Gini coefficient reduction value method for equal-weight assignment and comprehensive sorting, the importance ranking result of the main control factors is obtained;

[0100] Specifically, the average decrease in accuracy (MDA) and the average decrease in Gini coefficient (MDG) are used to rank the importance of features. MDA refers to the change in the error rate of the model results caused by shuffling the value of an influencing factor in the test set. The larger the error rate, the more important the influencing factor. MDG considers the importance of variables from the perspective of the impurity of decision tree nodes. The larger this value, the more important the influencing factor.

[0101] Equal-weight assignment and comprehensive ranking are performed on MDA and MDG. First, according to the specific values of MDA and MDG from high to low, the 14 influencing factors are assigned values of 14, 13, 12... 3, 2, and 1 respectively. Subsequently, the assignment results of the two are added together and re-ranked according to the sum of the assignments to obtain the comprehensive ranking results of the importance of the influencing factors, as shown in Table 2:

[0102]

[0103]

[0104] Table 2 Ranking of the importance of influencing factors

[0105] Among them, the calculation formula for accuracy is:

[0106]

[0107] In the formula, Accuracy is the accuracy; i and j are both toughness levels, i = 1, 2, 3; j = 1, 2, 3; N ij is the number of samples whose actual grade belongs to i but is predicted as j; N ii is the number of samples with the same actual and predicted grades.

[0108] The calculation formula for precision is:

[0109]

[0110] In the formula, Precision i is the precision; N ji is the number of samples whose predicted grade is j but actually belongs to i;

[0111] The calculation formula for recall is:

[0112]

[0113] In the formula, Recall i is the recall;

[0114] The calculation formula for the F1 value is:

[0115] F1 score i= 2 × Precision i × Recall i / (Precision i + Recall i )

[0116] where F1score i is the F1 value;

[0117] The calculation formula for the weighted F1 value is:

[0118]

[0119] where weighted-F1score is the weighted F1 value; W i is the weight, i = 1, 2, 3.

[0120] In this embodiment, the importance ranking of the 14 influencing factors of the optimized mountain building resilience evaluation model is as follows: building structure, building use, construction year, number of building floors, dryness, maximum temperature, formation lithology, distance from road, distance from river, average annual temperature, slope aspect, elevation, average annual rainfall, microtopography.

[0121] In this embodiment, in step S6, the random forest algorithm is selected as the processing algorithm for the mountain building resilience evaluation model; the confusion matrix is selected as the analysis and evaluation strategy for the prediction effect of the mountain building resilience evaluation model;

[0122] Specifically, constructing an evaluation model through machine learning methods can largely avoid the influence of human subjectivity, thereby obtaining a more objective evaluation. The random forest model shows strong robustness and accuracy when dealing with complex data. Therefore, the random forest is selected as the processing algorithm for constructing the mountain building resilience evaluation model.

[0123] The confusion matrix is used to analyze the prediction effect of the model. It contains the actual and predicted category information completed by the classification system and is a commonly used tool for measuring the performance of the classifier. The basic form of the three-class confusion matrix is shown in Table 3. For simplicity of expression, each data is represented by a combination of the actual value in the subscript first and the predicted value second. N ij (i = 1, 2, 3; j = 1, 2, 3) represents the number of samples whose actual sample level belongs to i but is predicted as j.

[0124]

[0125] Table 3 Three-class confusion matrix

[0126] In this embodiment, in step S7, using the master factor as the input layer, the parameters of the random forest algorithm are optimized through a cyclic iteration strategy to obtain the optimal parameters of the mountain building resilience evaluation model;

[0127] Specifically, as Figure 2 shown, a cyclic iteration method is used to optimize the parameters of the random forest algorithm to complete the second step of model optimization. The model divides the test data and training data in a ratio of 7:3, installs and calls packages such as "randomForest", "ggplot2", and "caret", and imports the data. Select the 14 dominant factors optimized by recursive elimination as the input layer, and the actual level of mountain building resilience as the output layer. By comparing the cyclic iteration to select the optimal parameter mtry, substitute the optimal mtry into the code to check the stability of the model error and find the optimal parameter ntree.

[0128] In this embodiment, in step S8, the optimal parameters are input into the mountain building resilience evaluation model; the mountain building resilience evaluation model is tested and trained with the test data and training data; the prediction effect of the mountain building resilience evaluation model is analyzed and evaluated through the confusion matrix to obtain the evaluation result; the mountain building resilience evaluation model is iteratively optimized according to the evaluation result to obtain the target mountain building resilience evaluation model.

[0129] Specifically, call the random forest code, set the optimal parameters mtry and ntree, and then call the predict code to test and train the mountain building resilience evaluation model with the test data and training data;

[0130] Among them, the test data and training data are as follows: 1456 housing data with all influencing factor information obtained are regarded as the total sample. Among the 1456 houses, the number of houses with resilience levels of I, II, and III are 418, 327, and 711 respectively, and the weight ratios in the total sample are 28.68%, 22.47%, and 48.85% respectively. The training set and the test set randomly divide the total sample into 1019 training samples and 437 test samples in a ratio of 7:3. Among the training samples, the number of houses with resilience levels of I, II, and III are 292, 229, and 498 respectively. Among the test samples, the numbers of the above three types of houses are 125, 98, and 213 respectively.

[0131] The prediction effect of the mountain building resilience evaluation model is analyzed and evaluated through the confusion matrix to obtain the prediction result confusion matrix and various evaluation indicators of the mountain building resilience model training data, test data, and all data based on the random forest algorithm, as shown in Tables 4 - 6.

[0132]

[0133] Table 4 Confusion Matrix of Training Data

[0134]

[0135]

[0136] Table 5 Confusion Matrix of Test Data

[0137]

[0138] Table 6 Confusion Matrix of All Data

[0139] Since the test data does not participate in the model construction, its accuracy rate of 96.35% and weighted F1 value of 95.26% have good effects, and the evaluation indicators are quite similar to those of the training data and all data, verifying the generalization ability of the model, indicating that using machine learning algorithms for the resilience evaluation modeling of mountain buildings has reliability and stability, and the selected optimization method plays a good role in improving the performance of each index of the model.

[0140] In summary, according to the set standard specification materials, the resilience levels of mountain buildings are divided into Grade I, Grade II, and Grade III; based on multi-source original data and field research, a resilience evaluation factor database for mountain buildings is constructed from four dimensions: topographic and geological factors, hydro-meteorological factors, environmental factors, and building property factors of mountain buildings; a resilience evaluation model for mountain buildings is constructed, and the influencing factors in the resilience evaluation factor database for mountain buildings are used as the input layer, and the actual resilience level of mountain buildings is used as the output layer to preliminarily optimize the resilience evaluation model for mountain buildings; by selecting the recursive feature elimination strategy, the main control factors are screened out from the resilience evaluation factor database for mountain buildings; through the equal-weight assignment comprehensive ranking using the average accuracy decline value method and the average Gini coefficient reduction value method, the importance ranking result of the main control factors is obtained; the random forest algorithm is selected as the processing algorithm for the resilience evaluation model for mountain buildings; the confusion matrix is selected as the analysis and evaluation strategy for the prediction effect of the resilience evaluation model for mountain buildings; according to the main control factors as the input layer, the parameters of the random forest algorithm are optimized through a loop iteration strategy to obtain the optimal parameters of the resilience evaluation model for mountain buildings; the optimal parameters are input into the resilience evaluation model for mountain buildings; the resilience evaluation model for mountain buildings is tested and trained through test data and training data; the prediction effect of the resilience evaluation model for mountain buildings is analyzed and evaluated through the confusion matrix to obtain an evaluation result; according to the evaluation result, the resilience evaluation model for mountain buildings is iteratively optimized to obtain the target resilience evaluation model for mountain buildings. Through two optimizations of the model, including factor screening and parameter optimization, the present invention significantly improves various performance indicators of the model. The optimized model not only has stronger generalization ability but also shows excellent reliability and stability in the resilience evaluation modeling of mountain buildings. The present invention can effectively handle complex and changeable actual scenarios and provides a more accurate and robust solution for the resilience evaluation of mountain buildings.

[0141] It should be noted that the method of the embodiments of the present disclosure can be executed by a single device, such as a computer or a server. The method of this embodiment can also be applied to a distributed scenario, and multiple devices cooperate with each other to complete it. In the case of such a distributed scenario, one of the multiple devices can only execute one or more steps of the method of the embodiments of the present disclosure, and these multiple devices will interact with each other to complete the described method.

[0142] It should be noted that some embodiments of the present disclosure have been described above. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the above embodiments and still achieve the desired results. Additionally, the processes depicted in the figures do not necessarily require the specific order or sequential order shown to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0143] Embodiment 2

[0144] Referring to Figure 3 , Embodiment 2 of the present invention also provides a device for constructing a machine learning model for evaluating the resilience of mountainous buildings, including:

[0145] A resilience level setting module 001, configured to classify the resilience levels of mountainous buildings into level I, level II, and level III according to the set standard specifications of materials;

[0146] A database construction module 002 for evaluating factors of mountainous buildings, configured to construct a database for evaluating factors of mountainous buildings from four dimensions: topographic and geological factors, hydro-meteorological factors, environmental factors, and housing building attribute factors where the mountainous buildings are located, based on multi-source original data and on-site investigations;

[0147] A module 003 for constructing and preliminarily optimizing a mountainous building resilience evaluation model, configured to construct a mountainous building resilience evaluation model, and use the influencing factors in the database for evaluating factors of mountainous buildings as the input layer and the actual resilience level of mountainous buildings as the output layer to preliminarily optimize the mountainous building resilience evaluation model;

[0148] A master factor screening module 004, configured to screen out master factors from the database for evaluating factors of mountainous buildings by selecting a recursive feature elimination strategy;

[0149] An importance ranking module 005, configured to perform equal-weight assignment comprehensive ranking by the average accuracy drop value method and the average Gini coefficient reduction value method to obtain the importance ranking result of the master factors;

[0150] A module 006 for selecting a processing algorithm and an analysis and evaluation strategy, configured to select a random forest algorithm as the processing algorithm for the mountainous building resilience evaluation model; select a confusion matrix as the analysis and evaluation strategy for the prediction effect of the mountainous building resilience evaluation model;

[0151] An optimal parameter acquisition module 007 for the algorithm, configured to optimize the parameters of the random forest algorithm through a loop iteration strategy with the master factors as the input layer to obtain the optimal parameters of the mountainous building resilience evaluation model;

[0152] The target mountain building resilience evaluation model acquisition module 008 is used to input the optimal parameters into the mountain building resilience evaluation model; test and train the mountain building resilience evaluation model with test data and training data; analyze and evaluate the prediction effect of the mountain building resilience evaluation model through the confusion matrix to obtain an evaluation result; and iteratively optimize the mountain building resilience evaluation model according to the evaluation result to obtain the target mountain building resilience evaluation model.

[0153] In this embodiment, in the mountain building resilience evaluation factor database construction module 002, the influencing factors of the mountain building resilience evaluation factor database include: elevation, slope, aspect, slope position, curvature, plane curvature, profile curvature, microtopography, terrain humidity index, terrain roughness index, stratigraphic lithology, average annual temperature, maximum temperature, average annual rainfall, dryness, distance from fault, distance from road, distance from river, building structure, construction year, number of building floors, and building use.

[0154] In this embodiment, in the mountain building resilience evaluation factor database construction module 002, during the construction of the mountain building resilience evaluation factor database, reclassified data of the influencing factors is preprocessed by normalization, and all numerical values are normalized to be distributed between [0, 1], changing the dimensional expression into a dimensionless expression, so that each influencing factor is at the same scale;

[0155] The calculation formula for the normalization preprocessing is:

[0156]

[0157] where X* is the data obtained after normalization processing; X is the original data; X min and X max are the minimum and maximum values of the data respectively.

[0158] In this embodiment, in the main control factor screening module 004, the main control factors include: elevation, aspect, microtopography, stratigraphic lithology, average annual temperature, maximum temperature, average annual rainfall, dryness, distance from road, distance from river, building structure, construction year, number of building floors, and building use.

[0159] In this embodiment, in the target mountain building resilience evaluation model acquisition module 008, during the process of analyzing and evaluating the prediction effect of the mountain building resilience evaluation model through the confusion matrix, the evaluation indicators include: accuracy, precision, recall rate, F1 value, and weighted F1 value;

[0160] The calculation formula for the accuracy is:

[0161]

[0162] In the formula, Accuracy is the accuracy rate; i and j are both toughness levels, where i = 1, 2, 3; j = 1, 2, 3; N ij is the number of samples whose actual sample level belongs to i but is predicted as j; N ii is the number of samples whose actual sample level is consistent with the predicted level;

[0163] The formula for calculating the precision rate is as follows:

[0164]

[0165] In the formula, Precision i is the precision rate; N ji is the number of samples whose predicted sample level is j but actually belongs to i;

[0166] The formula for calculating the recall rate is as follows:

[0167]

[0168] In the formula, Recall i is the recall rate;

[0169] The formula for calculating the F1 value is as follows:

[0170] F1 score i = 2 × Precision i × Recall i / (Precision i + Recall i )

[0171] In the formula, F1score i is the F1 value;

[0172] The formula for calculating the weighted F1 value is as follows:

[0173]

[0174] In the formula, weighted-F1score is the weighted F1 value; W i is the weight, where i = 1, 2, 3.

[0175] It should be noted that for the information interaction, execution process, etc. between the above-mentioned system modules, since they are based on the same concept as the method embodiment in Embodiment 1 of this application, the technical effects brought by them are the same as those of the method embodiment of this application. For the specific content, reference can be made to the description in the method embodiment shown above in this application, and details will not be repeated here.

[0176] Embodiment 3

[0177] Embodiment 3 of the present invention provides a non-transitory computer-readable storage medium, in which program code for a method of constructing a machine learning model for evaluating the resilience of mountainous buildings is stored. The program code includes instructions for executing the method of constructing a machine learning model for evaluating the resilience of mountainous buildings according to Embodiment 1 or any possible implementation thereof.

[0178] The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or a data center that integrates one or more available media. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid-state disk (SSD)), etc.

[0179] Embodiment 4

[0180] Embodiment 4 of the present invention provides an electronic device, including: a memory and a processor;

[0181] The processor and the memory communicate with each other through a bus; the memory stores program instructions executable by the processor, and the processor can execute the method of constructing a machine learning model for evaluating the resilience of mountainous buildings according to Embodiment 1 or any possible implementation thereof by calling the program instructions.

[0182] Specifically, the processor can be implemented by hardware or by software. When implemented by hardware, the processor can be a logic circuit, an integrated circuit, etc.; when implemented by software, the processor can be a general-purpose processor that is implemented by reading software code stored in the memory. The memory can be integrated in the processor or can exist independently outside the processor.

[0183] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions according to the embodiments of the present invention are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable systems. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wire (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wirelessly (such as infrared, wireless, microwave, etc.).

[0184] Obviously, those skilled in the art should understand that the various modules or steps of the present invention described above can be implemented by a general-purpose computing system. They can be concentrated on a single computing system or distributed on a network composed of multiple computing systems. Optionally, they can be implemented by program codes executable by the computing system. Thus, they can be stored in the storage system and executed by the computing system. And in some cases, the steps shown or described can be executed in a sequence different from that here, or they can be separately fabricated into individual integrated circuit modules, or multiple modules or steps among them can be fabricated into a single integrated circuit module for implementation. In this way, the present invention is not limited to any specific combination of hardware and software.

[0185] Although the present invention has been described in detail with general descriptions and specific embodiments above, based on the present invention, some modifications or improvements can be made, which are obvious to those skilled in the art. Therefore, these modifications or improvements made without departing from the spirit of the present invention all fall within the scope of the present invention claimed.

Claims

1. A method for constructing a machine learning model for evaluating the resilience of mountainous buildings, characterized in that, Including: According to the set standard specifications of materials, the resilience levels of mountain buildings are divided into Grade I, Grade II, and Grade III; Based on multi-source original data and field investigations, a resilience evaluation factor database for mountain buildings is constructed from four dimensions: topographic and geological factors, hydro-meteorological factors, environmental factors, and building property factors where the mountain buildings are located; A resilience evaluation model for mountain buildings is constructed, and the influencing factors in the resilience evaluation factor database for mountain buildings are used as the input layer, and the actual resilience level of the mountain buildings is used as the output layer to preliminarily optimize the resilience evaluation model for mountain buildings; By selecting the recursive feature elimination strategy, the main control factors are screened out from the resilience evaluation factor database for mountain buildings; Through the equal-weight assignment comprehensive sorting using the average accuracy drop value method and the average Gini coefficient reduction value method, the importance ranking result of the main control factors is obtained; The random forest algorithm is selected as the processing algorithm for the resilience evaluation model for mountain buildings; The confusion matrix is selected as the analysis and evaluation strategy for the prediction effect of the resilience evaluation model for mountain buildings; Based on the main control factors as the input layer, the parameters of the random forest algorithm are optimized through a cyclic iteration strategy to obtain the optimal parameters of the resilience evaluation model for mountain buildings; The optimal parameters are input into the resilience evaluation model for mountain buildings; the resilience evaluation model for mountain buildings is tested and trained with test data and training data; The prediction effect of the resilience evaluation model for mountain buildings is analyzed and evaluated through the confusion matrix to obtain an evaluation result; the resilience evaluation model for mountain buildings is iteratively optimized according to the evaluation result to obtain the target resilience evaluation model for mountain buildings.

2. The method for constructing a machine learning model for evaluating the resilience of mountainous buildings according to claim 1, wherein The influencing factors in the resilience evaluation factor database for mountain buildings include: elevation, slope, aspect, slope position, curvature, planar curvature, profile curvature, micro-topography, terrain humidity index, terrain roughness index, formation lithology, average annual temperature, maximum temperature, average annual rainfall, aridity, distance from fault, distance from road, distance from river, building structure, construction year, number of building floors, and building use.

3. A method for constructing a machine learning model for evaluating the resilience of mountain architecture according to claim 2, characterized in that, During the process of constructing the resilience evaluation factor database for mountain buildings, the reclassified data of the influencing factors are preprocessed by normalization, and all numerical values are normalized to be distributed between [0, 1], changing the dimensional expression into a dimensionless expression, so that each influencing factor is at the same scale; The calculation formula for the above-mentioned normalization preprocessing is: Wherein, X* is the data obtained after normalization processing; X is the original data; X min , X max are respectively the minimum value and the maximum value of the data.

4. A method for constructing a machine learning model for evaluating the resilience of mountainous buildings according to claim 3, characterized in that, The main control factors include: elevation, aspect, micro-topography, formation lithology, average annual temperature, maximum temperature, average annual rainfall, aridity, distance from road, distance from river, building structure, construction year, number of building floors, and building use.

5. A method for constructing a machine learning model for evaluating the resilience of mountain architecture according to claim 4, characterized in that, During the process of analyzing and evaluating the prediction effect of the resilience evaluation model for mountain buildings through the confusion matrix, the evaluation indicators include: accuracy, precision, recall rate, F1 value, and weighted F1 value; The calculation formula for the accuracy is: Wherein, Accuracy is the accuracy rate; i and j are both toughness levels, i = 1, 2, 3; j = 1, 2, 3; N ij is the number of samples whose actual sample level belongs to i but is predicted as j; N ii is the number of samples with the same actual and predicted sample levels; The calculation formula for the precision is: where Precision i is the precision rate; N ji is the number of samples whose predicted class is j but actually belongs to i; The calculation formula for the recall rate is: where Recall i is the recall rate; The calculation formula for the F1 value is: F1 score i = 2 × Precision i × Recall i / (Precision i + Recall i ) In the formula, F1score i is the F1 value; The calculation formula for the weighted F1 value is: where weighted-F1score is the weighted F1 value; W i is the weight, and i = 1, 2, 3.

6. A device for constructing a machine learning model for evaluating the resilience of mountainous buildings, which adopts the method for constructing a machine learning model for evaluating the resilience of mountainous buildings according to any one of claims 1-5, characterized in that, Including: A toughness level setting module, which is used to classify the toughness levels of mountain buildings into level I, level II, and level III according to the set standard specifications for materials; A database construction module for mountain building toughness evaluation factors, which is used to construct a database of mountain building toughness evaluation factors from four dimensions: topographic and geological factors, hydro-meteorological factors, environmental factors, and housing building attribute factors based on multi-source original data and field research; A module for constructing and initially optimizing a mountain building toughness evaluation model, which is used to construct a mountain building toughness evaluation model, take the influencing factors in the database of mountain building toughness evaluation factors as the input layer, and take the actual toughness level of the mountain building as the output layer to initially optimize the mountain building toughness evaluation model; A main control factor screening module, which is used to screen out the main control factors from the database of mountain building toughness evaluation factors by selecting a recursive feature elimination strategy; An importance ranking module, which is used to perform equal-weight assignment comprehensive ranking through the mean accuracy decrease value method and the mean Gini coefficient decrease value method to obtain the importance ranking result of the main control factors; A processing algorithm and analysis and evaluation strategy selection module, which is used to select the random forest algorithm as the processing algorithm for the mountain building toughness evaluation model; Select the confusion matrix as the analysis and evaluation strategy for the prediction effect of the mountain building toughness evaluation model; An algorithm optimal parameter acquisition module, which is used to take the main control factors as the input layer and optimize the parameters of the random forest algorithm through a cyclic iteration strategy to obtain the optimal parameters of the mountain building toughness evaluation model; A target mountain building toughness evaluation model acquisition module, which is used to input the optimal parameters into the mountain building toughness evaluation model; test and train the mountain building toughness evaluation model with test data and training data; Analyze and evaluate the prediction effect of the mountain building toughness evaluation model through the confusion matrix to obtain an evaluation result; iteratively optimize the mountain building toughness evaluation model according to the evaluation result to obtain a target mountain building toughness evaluation model.

7. The device for constructing a machine learning model for evaluating the resilience of mountain architecture according to claim 6, characterized in that In the database construction module for mountain building toughness evaluation factors, the influencing factors of the database of mountain building toughness evaluation factors include: elevation, slope, aspect, slope position, curvature, planar curvature, profile curvature, micro-topography, terrain humidity index, terrain roughness index, formation lithology, average annual temperature, maximum temperature, average annual rainfall, aridity, distance from fault, distance from road, distance from river, building structure, construction year, number of building floors, and building use.

8. The device for constructing a machine learning model for evaluating the resilience of mountainous buildings according to claim 7, wherein In the database construction module for mountain building toughness evaluation factors, during the process of constructing the database of mountain building toughness evaluation factors, normalization preprocessing is performed on the reclassified data of the influencing factors, and all numerical values are normalized to be distributed between [0, 1], changing the dimensional expression into a dimensionless expression so that each influencing factor is at the same scale; The calculation formula for the normalization preprocessing is: where X* is the data obtained after normalization; X is the original data; X min and X max are the minimum and maximum values of the data, respectively.

9. The device for constructing a machine learning model for evaluating the resilience of mountainous buildings according to claim 8, characterized in that, In the main control factor screening module, the main control factors include: elevation, slope aspect, microtopography, formation lithology, average annual temperature, maximum temperature, average annual rainfall, aridity, distance from road, distance from river, building structure, construction year, number of building floors, and building use.

10. The device for constructing a machine learning model for evaluating the resilience of mountainous buildings according to claim 9, characterized in that, In the target mountain building resilience evaluation model acquisition module, in the process of analyzing and evaluating the prediction effect of the mountain building resilience evaluation model through the confusion matrix, the evaluation indicators include: accuracy, precision, recall, F1 value, and weighted F1 value; The calculation formula for the accuracy is: Wherein, Accuracy is the accuracy rate; i and j are both toughness levels, i = 1, 2, 3; j = 1, 2, 3; N ij is the number of samples whose actual sample level belongs to i but is predicted as j; N ii is the number of samples whose actual sample level is consistent with the predicted level; The calculation formula for the precision is: where Precision i is the precision rate; N ji is the number of samples whose predicted sample level is j but actually belongs to i; The calculation formula for the recall is: In the formula, Recall i is the recall rate; The calculation formula for the F1 value is: F1 score i = 2 × Precision i × Recall i / (Precision i + Recall i ) Where F1score i is the F1 value; The calculation formula for the weighted F1 value is: where weighted-F1score is the weighted F1 value; W i is the weight, and i = 1, 2, 3.