Method and system for predicting carbon emission of expressway construction project and electronic equipment
The carbon emission model of highway construction projects was established through SVM machine learning algorithm, which solved the problem that inefficient algorithms in the existing technology could not handle complex relationships and characteristics, achieved more accurate carbon emission prediction, and improved decision-making and planning. reliability.
Patent Information
- Application Number
- CN202411556910.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-04
- Publication Date
- 2024-12-03
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the existing technology, inexperienced algorithms cannot handle complex relationships and features in the carbon emission forecast in highway construction projects, resulting in low accuracy in model prediction and affecting decision-making and planning processes.
The SVM machine learning algorithm is used to establish a carbon emission model, and the training set and test set are divided through data preprocessing, feature selection and normalization processing, and the support vector machine model is used for training and evaluation, and the model is optimized to achieve accurate prediction.
Improves the accuracy of carbon emission forecasts and complex data processing capabilities, providing more accurate carbon emission forecasts and calculation results, supporting the reliability of decision-making and planning.
Smart Images

Figure CN119067267A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of carbon emission, and in particular to a method for predicting carbon emission of a highway construction project. Background Art
[0002] The carbon emissions of highway construction projects refer to the total amount of carbon dioxide and other greenhouse gases generated during the construction process. This includes construction activities related to the project, which require fuel, materials and energy, and their use will produce corresponding carbon emissions. Resource consumption: highway construction projects require a large amount of materials and energy, such as cement, asphalt, steel and electricity. The production, transportation and use of these resources will be accompanied by certain carbon emissions. Energy use: the machinery, vehicles and power generation equipment used in the construction process all require energy supply, and burning fuel or using electricity will produce corresponding carbon emissions. In the actual process of monitoring and measuring carbon emissions, since the corresponding machine learning algorithms are not integrated for carbon emissions modeling, after obtaining the baseline data, some less efficient algorithms may have certain limitations on the complexity of the model and cannot handle complex relationships and features. In addition, since the inefficient algorithms may not fully utilize the information in the data, the prediction accuracy of the model is low, which may lead to inaccurate prediction results, thus affecting the decision-making and planning process; Therefore, there is an urgent need to propose carbon emission prediction methods, systems and electronic equipment for highway construction projects. Summary of the invention
[0003] The purpose of the present invention is to address the shortcomings of the existing technology and provide a method, system and electronic equipment for predicting carbon emissions for highway construction projects, aiming to integrate an efficient SVM machine learning algorithm to establish a corresponding carbon emissions model, achieve accurate carbon emissions estimation and calculation, and avoid technical problems such as low model accuracy and inability to process complex data.
[0004] To this end, this application provides a method for predicting carbon emissions of highway construction projects, including the following steps: Step 100: collecting carbon emission related data based on highway project information, and performing preprocessing based on the collected data; Step 200: Based on the preprocessed data, data analysis is performed to select features related to carbon emissions from the data and normalize the features; Step 300: Based on the normalized data, the data set is divided into a training set and a test set, the training set is used for model training, and the test set is used for model evaluation testing; Step 400: Use the SVM machine learning algorithm to model carbon emissions, use the training set to train the SVM model, and solve the optimal separation plane by minimizing the objective function; Step 500: Use the test set to evaluate the trained model, calculate the performance index of the model on new samples, and optimize the model based on the calculated index data; Step 600: Based on the trained and evaluated model, carbon emissions are predicted for new sample data, and a prediction result is obtained based on the decision function of the model.
[0005] In some specific implementations, carbon emission related data is collected based on highway project information, and preprocessing is performed based on the collected data, specifically including: Step 100.1, collecting carbon emission related data based on highway project information, wherein the related data specifically includes energy consumption and construction scale data, and after collecting the two data, performing missing value processing on the data; Step 100.1.1, using the spline interpolation method to handle missing values, first determine the specific type of spline interpolation, based on the data using linear spline, quadratic spline or cubic spline type; Step 100.1.2: Before performing spline interpolation, it is necessary to determine known data points, where the data points are data points with non-missing values, and the known data points are used to construct the spline function; Step 100.1.3, based on the known data points, an interpolation method is used to construct a spline function, and the spline function connects the data points to form a smooth curve; Step 100.1.4, interpolation calculation, based on each missing value, replace it with an unknown data point and an estimated value using a spline function, and based on the definition of the spline function, obtain an estimated value of the missing value through interpolation calculation; Suppose there are n known data points, namely , ,..., ,in < <...< , then the corresponding interpolation function is: ,
[0006] In the formula, Indicates The segment spline interpolation function value is defined as:
[0007] In the formula, Indicates Segment spline interpolation function value, Indicates The constant term coefficient of the segment spline function, Indicates The linear coefficients of the segmental spline function, Indicates The quadratic coefficients of the segment spline function, Indicates The cubic coefficients of the segment spline function, represents the independent variable to be interpolated, Indicates The position of the interpolation points; The spline function must meet the following conditions: Two adjacent spline segments have equal function values at interior points:
[0008] The first-order derivatives of two adjacent spline segments at interior points are equal:
[0009] The second-order derivatives of two adjacent spline segments at interior points are equal:
[0010] Boundary conditions: natural boundary conditions, the second-order derivative is 0 at the boundary or fixed boundary conditions specify the first-order derivative value at the boundary; Step 100.2: Outlier processing, using Methods: Outlier detection and processing; Step 100.2.1: For a given data set, first calculate the value, It indicates the degree of deviation between a data point and the mean of the data set, measured in units of standard deviation. The calculation formula is as follows:
[0011] In the formula, is the value of the data point, is the mean of the data set, is the standard deviation of the data set; Step 100.2.2: According to the individuality of the data, a threshold is set to determine whether a data point is an outlier. Data points with a Z-score greater than a certain threshold are defined as outliers. Based on the set threshold , determine the data point Is it an outlier? like , then the data point is an outlier.
[0012] In some specific embodiments, based on the preprocessed data, data analysis is used to select features related to carbon emissions from the data and normalize the features, specifically including: Step 200.1: Based on the preprocessed data, data correlation analysis is performed. The correlation analysis uses a determination coefficient as an analysis criterion. The determination coefficient is a statistical indicator used to measure the strength of the linear relationship between the dependent variable and the independent variable. Step 200.1.1, the coefficient of determination ranges from 0 to 1, where 0 means that the variability of the dependent variable cannot be explained by the independent variable, and 1 means that the variability of the dependent variable is completely explained by the independent variable; Step 200.1.2, the calculation of the determination coefficient is based on the goodness of fit of the linear regression model. In the linear regression model, the data is fitted by the least squares method to obtain the predicted value of the model. The determination coefficient measures the variance ratio between the actual observed value of the dependent variable and the predicted value of the regression model. The calculation formula of the determination coefficient is as follows:
[0013] In the formula, is the residual sum of squares, which represents the sum of squares of the differences between the actual observed values of the dependent variable and the predicted values of the regression model. is the total sum of squares, which represents the sum of squares of the differences between the observed values of the dependent variable and their means. When the determination coefficient is close to 0, it means that the linear regression model cannot explain the variability of the dependent variable and the prediction effect is poor. When the determination coefficient is close to 1, it means that the linear regression model can well explain the variability of the dependent variable and the prediction effect is good. If the determination coefficient is a negative value, it means that the model fitting effect is worse than directly using the average value. Step 200.2, normalizing the features. Normalization is to convert the selected features into numerical ranges to eliminate dimensional differences between different features. Using the maximum-minimum normalization method: For each feature, its value is linearly mapped to the specified range (usually between [0, 1]), the formula is as follows:
[0014] In the formula, is the original eigenvalue, is the normalized eigenvalue, and are the minimum and maximum values of the feature respectively; Standardization method: For each feature, its value is transformed into a distribution with a mean of 0 and a standard deviation of 1, as follows:
[0015] In the formula, is the original eigenvalue, is the normalized eigenvalue, is the mean of the feature, is the standard deviation of the feature.
[0016] In some specific implementations, the SVM machine learning algorithm is used to model carbon emissions, and the SVM model is trained using a training set. The optimal separation plane is obtained by minimizing the objective function, specifically including: Step 400.1, select the corresponding support vector machine model, linear support vector machine or nonlinear support vector machine, and set the relevant hyperparameters according to the characteristics of the data and the requirements of the problem; Step 400.1.1: For linear support vector machines, by setting different regularization parameters To adjust the complexity of the model, The larger it is, the lower the model's tolerance is and the better it fits the training set. Step 400.1.2: For a nonlinear support vector machine, a nonlinear decision boundary is constructed by setting a kernel function and related hyperparameters; Step 400.2: Use the training set to train the support vector machine model. The training goal is to find the optimal hyperplane or decision boundary to minimize the classification error or regression loss. Step 400.2.1: For a linear support vector machine, by using The algorithm trains the model; Step 400.2.2: For nonlinear support vector machines, the training goal is to find the optimal decision boundary to minimize the regression loss. This problem is transformed into a convex quadratic programming problem by mapping samples to a high-dimensional feature space and solving the optimal hyperplane in the high-dimensional space. Step 400.3: Use the test set to evaluate the trained support vector machine model. Based on the selected task type, use appropriate evaluation indicators, including accuracy, precision, recall, and root mean square error. Use the evaluation indicators to evaluate the performance and prediction ability of the model. Step 400.3.1: For the classification task, the accuracy calculation formula is:
[0017] In the formula, represents a true positive, represents a true negative, Indicates a false positive. Indicates a false negative; Step 400.3.2: For regression tasks, the root mean square error is used, which is:
[0018] In the formula, represents the true value, represents the predicted value, represents the number of samples; Step 400.4: The hyperparameters of the support vector machine model are tuned by cross-validation and other techniques. The goal of the tuning is to find the optimal hyperparameter combination to improve the generalization ability and prediction performance of the model. Step 400.4.1. For each hyperparameter combination, use cross-validation to evaluate the model and select the hyperparameter combination with the best performance.
[0019] In some embodiments, for a linear support vector machine, by using The algorithm trains the model, including: Step 400.2.1.1, based on the data obtained after normalization processing in step 300, import the library to be used; Step 400.2.1.2, define the auxiliary function of the SMO algorithm. During the definition process, it is necessary to calculate the kernel function, the prediction value and the error; Kernel function calculation, linear kernel function calculation is specifically:
[0020] The Gaussian kernel function calculation is as follows:
[0021] In the formula, and is the feature vector of the sample point, is the width parameter of the Gaussian kernel function; Calculate the predicted value. The predicted value is obtained by calculating the inner product of the weight vector and the bias term with the sample feature vector, specifically:
[0022] In the formula, is the weight vector, is the bias term, is the sample feature vector; Calculate the error. The error refers to the difference between the predicted value and the true value of the sample point. For classification tasks, the error is expressed as the difference between the predicted value and the true value. For regression tasks, the error is expressed as the difference between the predicted value and the true value. The specific calculation formula is:
[0023] Step 400.2.1.3, initializing the parameters of the SVM model, the parameters specifically including the weight vector and the bias term; First, calculate the objective function of the SVM model. The objective function of the SVM is a convex quadratic programming problem, which is solved using the Lagrange dual problem. Specifically:
[0024] In the formula, represents the Lagrange multiplier, each With sample Correspondingly, by solving , determine the support vector; and Represents the classification label, specifically the sample and Category of; Represents the kernel function, which is used to transform the original sample and Mapping to a higher-dimensional feature space, thereby achieving linear separability in that space; and Represents the input feature vector, specifically the sample data point. In SVM, all data points and The combination of is used to construct the optimal separating hyperplane; By optimizing the objective function, we can get the support vector corresponding to Value, non-zero based Value, calculate the weight vector and the bias term , specifically: Weight vector The calculation formula is as follows:
[0025] In the formula, The eigenvectors representing the support vectors, represents the class label of the support vector, is the corresponding Lagrange multiplier; Bias The calculation formula is as follows:
[0026] In the formula, is the eigenvector of any support vector, is the category label of the support vector, and in the bias term In the calculation of The values are summed, because Only the support vectors are non-zero, and the other non-support vectors are is zero, so the calculation of the weight vector and bias term only involves the support vector; Step 400.2.1.4: Implementation The main loop of the algorithm repeatedly performs the following steps until the stopping condition is met: Select two sample points in the training set as a pair of variables to be optimized; According to the two selected variables, calculate the corresponding predicted value and error; according to Algorithm rules, update the parameters of the two selected variables; Update the parameters of other variables to maintain conditions and interval boundary conditions; In each loop iteration, different heuristics and rules are chosen to select variables and update parameters; Step 400.2.1.5: After the main loop ends, return to the final Model.
[0027] In some specific implementations, based on the trained and evaluated model, carbon emissions are predicted for new sample data, and a prediction result is obtained based on the decision function of the model, specifically including: Step 600.1, substitute the carbon emission index into the formula for calculation; Step 600.2, the linear support vector machine classification formula is as follows:
[0028] In the formula, Represents the input sample The prediction results, represents the weight vector, represents the feature vector of the input sample, represents the bias term. For the classification problem substituted into the carbon emission index, the feature vector x includes factors related to carbon emissions such as energy consumption and production scale; Step 600.3, nonlinear support vector machine classification formula, specifically:
[0029] In the formula, Represents the input sample The prediction results, represents the Lagrange multiplier corresponding to the support vector, Representation sample Tags, Represents the similarity or distance calculated by the kernel function. For the nonlinear classification problem of substituting the carbon emission index, the kernel function is used to capture the nonlinear relationship and map the input features to the high-dimensional feature space for classification; Step 600.4: Support vector machine regression formula, specifically:
[0030] In the formula, Represents the input sample The prediction results, represents the weight vector, represents the feature vector of the input sample, Represents the bias term. The goal of the regression problem is to predict the continuous carbon emission index value by fitting the training data. The carbon emission prediction results are obtained based on the specific values of
[0031] The present application further provides a highway construction project carbon emission prediction system, which is characterized by comprising: A collection unit, used for collecting carbon emission related data based on highway project information, and performing preprocessing based on the collected data; A preprocessing unit, for selecting features related to carbon emissions from the data by using data analysis based on the preprocessed data, and performing normalization processing on the features; The classification unit is used to divide the data set into a training set and a test set based on the normalized data, use the training set for model training, and use the test set for model evaluation testing; A modeling unit, used for modeling carbon emissions using an SVM machine learning algorithm, training the SVM model using a training set, and solving for an optimal separation plane by minimizing an objective function; The evaluation unit is used to evaluate the trained model using the test set, calculate the performance index of the model on new samples, and optimize the model based on the calculated index data; The prediction unit is used to predict carbon emissions for new sample data based on the trained and evaluated model, and obtain the prediction result based on the decision function of the model.
[0032] In some specific implementations, the method is used to divide the data set into a training set and a test set based on the normalized data, use the training set for model training, and use the test set for model evaluation testing, specifically including: The classification unit divides the data set into K mutually exclusive subsets by using K-fold cross validation, and randomly shuffles the data set and then divides it into K subsets in order; For each subset , use it as a test set, and other A subset is used as the training set; Train the SVM model on each training set, use the trained model to make predictions on the corresponding test set, and calculate the performance indicators of the model; Repeat the training and calculate the performance indicators until each subset serves as a test set once and obtains K performance indicators.
[0033] In some specific implementations, the trained model is evaluated using a test set, the performance index of the model on new samples is calculated, and the model is optimized based on the calculated index data, specifically: The evaluation unit performs statistical analysis on K performance indicators and calculates the mean and standard deviation to evaluate the overall performance of the model and detect the stability of the model, that is, the performance difference of the model on different training sets.
[0034] The present application further provides an electronic device, comprising: one or more processors; a storage system for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the above method.
[0035] The method for predicting carbon emissions from highway construction projects provided in the present application collects carbon emission related data based on highway project information, and preprocesses the collected data; based on the preprocessed data, uses data analysis to select features related to carbon emissions from the data, and normalizes the features; based on the normalized data, divides the data set into a training set and a test set, uses the training set for model training, and uses the test set for model evaluation testing; uses an SVM machine learning algorithm to model carbon emissions, uses the training set to train the SVM model, and solves the optimal separation plane by minimizing the objective function; uses the test set to evaluate the trained model, calculates the performance index of the model on new samples, and optimizes the model based on the calculated index data; based on the trained and evaluated model, predicts carbon emissions for new sample data, and obtains prediction results based on the decision function of the model, and achieves accurate prediction and complex numerical calculation through multi-step collaboration. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0037] Figure 1 A schematic flow chart of a method for predicting carbon emissions from highway construction projects provided in an embodiment of the present application. DETAILED DESCRIPTION
[0038] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure is implemented in various forms and should not be construed as being limited to the embodiments set forth herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0039] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0040] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0041] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0042] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0043] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0044] Please refer to Figure 1 , which shows a flow chart of a method for predicting carbon emissions of a highway construction project according to the present disclosure.
[0045] like Figure 1 As shown, the carbon emission prediction method for the highway construction project includes the following steps: Step 100: Collect carbon emission related data based on highway project information, and perform preprocessing based on the collected data.
[0046] Here, specifically include: Step 100.1, collect carbon emission related data based on highway project information, the related data specifically includes energy consumption and construction scale data, after collecting the two data, the data is processed for missing values.
[0047] Step 100.1.1: Use the spline interpolation method to handle missing values. First, determine the specific type of spline interpolation. Use linear spline, quadratic spline, or cubic spline based on the data.
[0048] Step 100.1.2: Before performing spline interpolation, it is necessary to determine known data points, which are data points with non-missing values. The known data points are used to construct the spline function.
[0049] Step 100.1.3: Based on the known data points, an interpolation method is used to construct a spline function, which connects the data points to form a smooth curve.
[0050] Step 100.1.4: Interpolation calculation: Based on each missing value, a spline function is used to replace it with an unknown data point and an estimated value. Based on the definition of the spline function, an estimated value of the missing value is obtained through interpolation calculation.
[0051] Suppose there are n known data points, namely , ,..., ,in < <...< , then the corresponding interpolation function is: ,
[0052] In the formula, Indicates The segment spline interpolation function value is defined as:
[0053] In the formula, Indicates Segment spline interpolation function value, Indicates The constant term coefficient of the segment spline function, Indicates The coefficient of the first-order term of the segment spline function, Indicates The coefficients of the quadratic terms of the segment spline function, Indicates The cubic coefficients of the segment spline function, represents the independent variable to be interpolated, Indicates The location of the interpolation points; The spline function must meet the following conditions: Two adjacent spline segments have equal function values at interior points:
[0054] The first-order derivatives of two adjacent spline segments at interior points are equal:
[0055] The second-order derivatives of two adjacent spline segments at interior points are equal:
[0056] Boundary conditions: Natural boundary conditions, the second-order derivative is 0 at the boundary or fixed boundary conditions specify the first-order derivative value at the boundary.
[0057] Step 100.2: Outlier processing, using Methods for outlier detection and processing.
[0058] Step 100.2.1: For a given data set, first calculate the value, It indicates the degree of deviation between a data point and the mean of the data set, measured in units of standard deviation. The calculation formula is as follows:
[0059] In the formula, is the value of the data point, is the mean of the data set, is the standard deviation of the data set; Step 100.2.2: According to the individuality of the data, a threshold is set to determine whether a data point is an outlier, and a data point with a Z-score greater than a certain threshold is defined as an outlier.
[0060] Based on the set threshold , determine the data point Is it an outlier? like , then the data point is an outlier.
[0061] Step 200: Based on the preprocessed data, data analysis is performed to select features related to carbon emissions from the data and normalize the features.
[0062] Here, specifically include: Step 200.1: Based on the preprocessed data, data correlation analysis is performed. The correlation analysis uses the determination coefficient as an analysis criterion. The determination coefficient is a statistical indicator used to measure the strength of the linear relationship between the dependent variable and the independent variable.
[0063] Step 200.1.1, the value range of the coefficient of determination is between 0 and 1, where 0 means that the variability of the dependent variable cannot be explained by the independent variable, and 1 means that the variability of the dependent variable is completely explained by the independent variable.
[0064] Step 200.1.2, the calculation of the determination coefficient is based on the goodness of fit of the linear regression model. In the linear regression model, the data is fitted by the least squares method to obtain the predicted value of the model. The determination coefficient measures the variance ratio between the actual observed value of the dependent variable and the predicted value of the regression model. The calculation formula of the determination coefficient is as follows:
[0065] In the formula, is the residual sum of squares, which represents the sum of squares of the differences between the actual observed values of the dependent variable and the predicted values of the regression model. It is the total sum of squares, which represents the sum of squares of the differences between the observed values of the dependent variable and their means. When the determination coefficient is close to 0, it means that the linear regression model cannot explain the variability of the dependent variable and the prediction effect is poor. When the determination coefficient is close to 1, it means that the linear regression model can well explain the variability of the dependent variable and the prediction effect is good. If the determination coefficient is a negative value, it means that the model fitting effect is worse than directly using the average value.
[0066] Step 200.2: normalize the features. Normalization is to convert the selected features into numerical ranges to eliminate the dimensional differences between different features.
[0067] Using the maximum-minimum normalization method: For each feature, its value is linearly mapped to the specified range (usually between [0, 1]), the formula is as follows:
[0068] In the formula, is the original eigenvalue, is the normalized eigenvalue, and are the minimum and maximum values of the feature, respectively.
[0069] Standardization method: For each feature, its value is transformed into a distribution with a mean of 0 and a standard deviation of 1, as follows:
[0070] In the formula, is the original eigenvalue, is the normalized eigenvalue, is the mean of the feature, is the standard deviation of the feature.
[0071] Step 300: Based on the normalized data, the data set is divided into a training set and a test set, the training set is used for model training, and the test set is used for model evaluation testing.
[0072] Step 400: Use the SVM machine learning algorithm to model carbon emissions, use the training set to train the SVM model, and solve the optimal separation plane by minimizing the objective function.
[0073] Here, specifically include: Step 400.1: Select the corresponding support vector machine model, linear support vector machine or nonlinear support vector machine, and set the relevant hyperparameters according to the characteristics of the data and the requirements of the problem.
[0074] Step 400.1.1: For linear support vector machines, by setting different regularization parameters To adjust the complexity of the model, The larger it is, the lower the error tolerance of the model and the better it fits the training set.
[0075] Step 400.1.2: For the nonlinear support vector machine, a nonlinear decision boundary is constructed by setting the kernel function and related hyperparameters.
[0076] Step 400.2: Use the training set to train the support vector machine model. The training goal is to find the optimal hyperplane or decision boundary to minimize the classification error or regression loss.
[0077] Step 400.2.1: For a linear support vector machine, by using The algorithm trains the model, which includes: Step 400.2.1.1: Based on the data obtained after normalization processing in step 300, import the library to be used.
[0078] Step 400.2.1.2, define the auxiliary function of the SMO algorithm. During the definition process, it is necessary to calculate the kernel function, the prediction value and the error.
[0079] Kernel function calculation, linear kernel function calculation is specifically:
[0080] The Gaussian kernel function calculation is as follows:
[0081] In the formula, and is the feature vector of the sample point, is the width parameter of the Gaussian kernel function; Calculate the predicted value. The predicted value is obtained by calculating the inner product of the weight vector and the bias term with the sample feature vector, specifically:
[0082] In the formula, is the weight vector, is the bias term, is the sample feature vector.
[0083] Calculate the error. The error refers to the difference between the predicted value and the true value of the sample point. For classification tasks, the error is expressed as the difference between the predicted value and the true value. For regression tasks, the error is expressed as the difference between the predicted value and the true value. The specific calculation formula is:
[0084] Step 400.2.1.3: Initialize the parameters of the SVM model, which specifically include the weight vector and the bias term.
[0085] First, calculate the objective function of the SVM model. The objective function of the SVM is a convex quadratic programming problem, which is solved using the Lagrange dual problem. Specifically:
[0086] In the formula, represents the Lagrange multiplier, each With sample Correspondingly, by solving , determine the support vector; and Represents the classification label, specifically the sample and Category of; Represents the kernel function, which is used to transform the original sample and Mapping to a higher-dimensional feature space, thereby achieving linear separability in that space; and Represents the input feature vector, specifically the sample data point. In SVM, all data points and The combination of is used to construct the optimal separating hyperplane.
[0087] By optimizing the objective function, we can get the support vector corresponding to Value, non-zero based Value, calculate the weight vector and the bias term , specifically: Weight vector The calculation formula is as follows:
[0088] In the formula, The eigenvectors representing the support vectors, represents the class label of the support vector, is the corresponding Lagrange multiplier.
[0089] Bias The calculation formula is as follows:
[0090] In the formula, is the eigenvector of any support vector, is the category label of the support vector, and in the bias term In the calculation of The values are summed, because Only the support vectors are non-zero, and the other non-support vectors are is zero, so the calculation of the weight vector and bias term involves only the support vectors.
[0091] Step 400.2.1.4: Implementation The main loop of the algorithm repeatedly performs the following steps until the stopping condition is met: Two sample points are selected in the training set as a pair of variables to be optimized.
[0092] Based on the two selected variables, calculate the corresponding predicted value and error.
[0093] according to Algorithm rules, update the parameters of two selected variables.
[0094] Update the parameters of other variables to maintain conditions and interval boundary conditions.
[0095] In each loop iteration, different heuristics and rules are chosen to select variables and update parameters.
[0096] Step 400.2.1.5: After the main loop ends, return to the final Model; Step 400.2.2: For nonlinear support vector machines, the training goal is to find the optimal decision boundary to minimize the regression loss. This problem is transformed into a convex quadratic programming problem by mapping samples to a high-dimensional feature space and solving the optimal hyperplane in the high-dimensional space.
[0097] Step 400.3: Use the test set to evaluate the trained support vector machine model. Based on the selected task type, use appropriate evaluation indicators, including accuracy, precision, recall, and root mean square error. The performance and predictive ability of the model are evaluated through the evaluation indicators.
[0098] Step 400.3.1: For the classification task, the accuracy calculation formula is:
[0099] In the formula, represents a true positive, represents a true negative, Indicates a false positive. Indicates a false negative.
[0100] Step 400.3.2: For regression tasks, the root mean square error is used, which is:
[0101] In the formula, represents the true value, represents the predicted value, Indicates the sample size.
[0102] Step 400.4: Use cross-validation and other techniques to tune the hyperparameters of the support vector machine model. The goal of the tuning is to find the optimal hyperparameter combination to improve the generalization ability and prediction performance of the model.
[0103] Step 400.4.1. For each hyperparameter combination, use cross-validation to evaluate the model and select the hyperparameter combination with the best performance.
[0104] Step 500: Use the test set to evaluate the trained model, calculate the performance index of the model on new samples, and optimize the model based on the calculated index data.
[0105] Step 600: Based on the trained and evaluated model, carbon emissions are predicted for new sample data, and a prediction result is obtained based on the decision function of the model.
[0106] Here, specifically include: Step 600.1: Substitute the carbon emission index into the formula for calculation.
[0107] Step 600.2, the linear support vector machine classification formula is as follows:
[0108] In the formula, Represents the input sample The prediction results, represents the weight vector, represents the feature vector of the input sample, Represents the bias term. For the classification problem of substituting the carbon emission index, the feature vector x includes factors related to carbon emissions such as energy consumption and production scale.
[0109] Step 600.3, nonlinear support vector machine classification formula, specifically:
[0110] In the formula, Represents the input sample The prediction results, represents the Lagrange multiplier corresponding to the support vector, Representation sample Tags, It represents the similarity or distance calculated by the kernel function. For the nonlinear classification problem of substituting the carbon emission index, the kernel function is used to capture the nonlinear relationship and map the input features to the high-dimensional feature space for classification.
[0111] Step 600.4: Support vector machine regression formula, specifically:
[0112] In the formula, Represents the input sample The prediction results, represents the weight vector, represents the feature vector of the input sample, Represents the bias term. The goal of the regression problem is to predict the continuous carbon emission index value by fitting the training data. The carbon emission prediction results are obtained based on the specific values of
[0113] This application collects carbon emission related data based on highway project information, and preprocesses the collected data; based on the preprocessed data, uses data analysis to select features related to carbon emissions from the data, and normalizes the features; based on the normalized data, divides the data set into a training set and a test set, uses the training set for model training, and uses the test set for model evaluation testing; uses the SVM machine learning algorithm to model carbon emissions, uses the training set to train the SVM model, and solves the optimal separation plane by minimizing the objective function; uses the test set to evaluate the trained model, calculates the performance indicators of the model on new samples, and optimizes the model based on the calculated indicator data; based on the trained and evaluated model, predicts carbon emissions for new sample data, and obtains prediction results based on the decision function of the model, and achieves accurate prediction and complex numerical calculations through multi-step collaboration.
[0114] The present application further provides a highway construction project carbon emission prediction system, which is characterized by comprising: The collection unit is used to collect carbon emission related data based on highway project information and perform preprocessing based on the collected data.
[0115] The preprocessing unit is used to select features related to carbon emissions from the data by using data analysis based on the preprocessed data, and to normalize the features.
[0116] The classification unit is used to divide the data set into a training set and a test set based on the normalized data, use the training set for model training, and use the test set for model evaluation testing.
[0117] The modeling unit is used to model carbon emissions using an SVM machine learning algorithm, train the SVM model using a training set, and obtain an optimal separation plane by minimizing an objective function.
[0118] The evaluation unit is used to evaluate the trained model using the test set, calculate the performance index of the model on new samples, and optimize the model based on the calculated index data.
[0119] The prediction unit is used to predict carbon emissions for new sample data based on the trained and evaluated model, and obtain the prediction result based on the decision function of the model.
[0120] Among them, in the above content, the classification unit divides the data set into K mutually exclusive subsets by adopting K-fold cross-validation, and randomly shuffles the data set and then divides it into K subsets in order.
[0121] For each subset , use it as a test set, and other A subset is used as the training set.
[0122] The SVM model is trained on each training set, the trained model is used to make predictions on the corresponding test set, and the performance indicators of the model are calculated.
[0123] Repeat the training and calculate the performance indicators until each subset serves as a test set once and obtains K performance indicators.
[0124] Among them, in the above content, the evaluation unit performs statistical analysis on K performance indicators and calculates the mean and standard deviation to evaluate the overall performance of the model and detect the stability of the model, that is, the performance difference of the model on different training sets.
[0125] The present application further provides an electronic device, which may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), etc., and fixed terminals such as digital TVs, desktop computers, etc.
[0126] An electronic device may include a processing system (e.g., a central processing unit, a graphics processing unit, etc.), which may perform various appropriate actions and processes according to a program stored in a read-only memory or a program loaded from a storage system into a random access memory. Various programs and data required for the operation of the electronic device are also stored in the ROM. The processing system, ROM, and RAM are connected to each other via a bus. An input / output (I / O) interface is also connected to the bus.
[0127] Typically, the following systems can be connected to the I / O interface: input systems including, for example, touch screens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output systems including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage systems including, for example, magnetic tapes, hard disks, etc.; and communication systems. The communication system can allow an electronic device to communicate with other devices wirelessly or by wire to exchange data.
[0128] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory storage medium, and the computer program contains a program code for executing the method shown in the flowchart. In such an embodiment, the computer program is downloaded and installed from the network through a communication system, or installed from a storage system, or installed from a ROM. When the computer program is executed by the processing system, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0129] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other.
[0130] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0131] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. A method for predicting carbon emissions from highway construction projects, characterized in that: The steps include: S100, collecting carbon emission related data based on highway project information, and performing preprocessing based on the collected data; S200, based on the preprocessed data, using data analysis to select features related to carbon emissions from the data, and normalizing the features; S300, based on the normalized data, dividing the data set into a training set and a test set, using the training set for model training, and using the test set for model evaluation testing; S400, using SVM machine learning algorithm to model carbon emissions, using training sets to train the SVM model, and solving for the optimal separation plane by minimizing the objective function; S500, using the test set to evaluate the trained model, calculating the performance index of the model on new samples, and optimizing the model based on the calculated index data; S600: Based on the trained and evaluated model, carbon emissions are predicted for new sample data, and a prediction result is obtained based on the decision function of the model.
2. The method for predicting carbon emissions of a highway construction project according to claim 1, characterized in that: Collect carbon emission related data based on highway project information and pre-process the collected data, including: S100.
1. Collect carbon emission related data based on highway project information, the related data specifically including energy consumption and construction scale data. After collecting the two data, perform missing value processing on the data; S100.1.
1. Use spline interpolation to handle missing values. First, determine the specific type of spline interpolation. Use linear spline, quadratic spline, or cubic spline based on the data. S100.1.
2. Before performing spline interpolation, it is necessary to determine known data points, where the data points are data points with non-missing values, and the known data points are used to construct a spline function; S100.1.
3. Based on known data points, an interpolation method is used to construct a spline function, which connects the data points to form a smooth curve; S100.1.4, interpolation calculation, based on each missing value, replace it with an unknown data point and an estimated value using a spline function, and obtain an estimated value of the missing value through interpolation calculation based on the definition of the spline function; Suppose there are n known data points, namely , ,..., ,in < <... < , then the corresponding interpolation function is: , In the formula, Indicates The segment spline interpolation function value is defined as: In the formula, Indicates Segment spline interpolation function value, Indicates The constant term coefficient of the segment spline function, Indicates The coefficient of the first-order term of the segment spline function, Indicates The coefficients of the quadratic terms of the segment spline function, Indicates The cubic coefficients of the segment spline function, represents the independent variable to be interpolated, Indicates The location of the interpolation points; The spline function must meet the following conditions: Two adjacent spline segments have equal function values at interior points: The first-order derivatives of two adjacent spline segments at interior points are equal: The second-order derivatives of two adjacent spline segments at interior points are equal: Boundary conditions: natural boundary conditions, the second-order derivative is 0 at the boundary or fixed boundary conditions specify the first-order derivative value at the boundary; S100.2, outlier processing, using Methods: Outlier detection and processing; S100.2.
1. For a given data set, first calculate the value, It indicates the degree of deviation between a data point and the mean of the data set, measured in units of standard deviation. The calculation formula is as follows: In the formula, is the value of the data point, is the mean of the data set, is the standard deviation of the data set; S100.2.
2. According to the individuality of the data, a threshold is set to determine whether a data point is an outlier. Data points with a Z-score greater than a certain threshold are defined as outliers. Based on the set threshold , determine the data point Is it an outlier? like , then the data point is an outlier.
3. The method for predicting carbon emissions of a highway construction project as claimed in claim 2, characterized in that: Based on the preprocessed data, data analysis is used to select features related to carbon emissions from the data and normalize the features, including: S200.
1. Based on the preprocessed data, data correlation analysis is performed. The correlation analysis uses a determination coefficient as an analysis criterion. The determination coefficient is a statistical indicator used to measure the strength of the linear relationship between the dependent variable and the independent variable. S200.1.1, the coefficient of determination ranges from 0 to 1, where 0 means that the variability of the dependent variable cannot be explained by the independent variable, and 1 means that the variability of the dependent variable is fully explained by the independent variable; S200.1.
2. The calculation of the determination coefficient is based on the goodness of fit of the linear regression model. In the linear regression model, the data is fitted by the least squares method to obtain the predicted value of the model. The determination coefficient measures the variance ratio between the actual observed value of the dependent variable and the predicted value of the regression model. The calculation formula of the determination coefficient is as follows: In the formula, is the residual sum of squares, which represents the sum of squares of the differences between the actual observed values of the dependent variable and the predicted values of the regression model. is the total sum of squares, which represents the sum of squares of the differences between the observed values of the dependent variable and their means. When the determination coefficient is close to 0, it means that the linear regression model cannot explain the variability of the dependent variable and the prediction effect is poor. When the determination coefficient is close to 1, it means that the linear regression model can well explain the variability of the dependent variable and the prediction effect is good. If the determination coefficient is a negative value, it means that the model fitting effect is worse than directly using the average value. S200.2, normalizing the features. Normalization is to convert the selected features into numerical ranges to eliminate dimensional differences between different features. Using the maximum-minimum normalization method: For each feature, its value is linearly mapped to the specified range (usually between [0, 1]), the formula is as follows: In the formula, is the original eigenvalue, is the normalized eigenvalue, and are the minimum and maximum values of the feature respectively; Standardization method: For each feature, its value is transformed into a distribution with a mean of 0 and a standard deviation of 1, as follows: In the formula, is the original eigenvalue, is the normalized eigenvalue, is the mean of the feature, is the standard deviation of the feature.
4. The method for predicting carbon emissions of a highway construction project as claimed in claim 3, characterized in that: The SVM machine learning algorithm is used to model carbon emissions. The SVM model is trained using a training set. The optimal separation plane is obtained by minimizing the objective function, including: S400.
1. Select the corresponding support vector machine model, linear support vector machine or nonlinear support vector machine, and set the relevant hyperparameters according to the characteristics of the data and the requirements of the problem; S400.1.
1. For linear support vector machines, by setting different regularization parameters To adjust the complexity of the model, The larger it is, the lower the model's tolerance is and the better it fits the training set. S400.1.
2. For nonlinear support vector machines, a nonlinear decision boundary is constructed by setting the kernel function and related hyperparameters; S400.
2. Use the training set to train the support vector machine model. The training goal is to find the optimal hyperplane or decision boundary to minimize the classification error or regression loss. S400.2.
1. For linear support vector machines, by using The algorithm trains the model; S400.2.
2. For nonlinear support vector machines, the training goal is to find the optimal decision boundary to minimize the regression loss. This problem is transformed into a convex quadratic programming problem by mapping samples to a high-dimensional feature space and solving the optimal hyperplane in the high-dimensional space. S400.
3. Evaluate the trained support vector machine model using the test set. Based on the selected task type, use appropriate evaluation indicators, including accuracy, precision, recall, and root mean square error. Use the evaluation indicators to evaluate the performance and prediction ability of the model. S400.3.
1. For classification tasks, the accuracy calculation formula is: In the formula, represents a true positive, represents a true negative, Indicates a false positive. Indicates a false negative; S400.3.
2. For regression tasks, the root mean square error is used, which is: In the formula, represents the true value, represents the predicted value, represents the number of samples; S400.
4. Use cross-validation and other techniques to tune the hyperparameters of the support vector machine model. The goal of the tuning is to find the optimal hyperparameter combination to improve the generalization ability and prediction performance of the model. S400.4.
1. For each hyperparameter combination, use cross-validation to evaluate the model and select the hyperparameter combination with the best performance.
5. The method for predicting carbon emissions of a highway construction project as claimed in claim 4, characterized in that: For linear support vector machines, by adopting The algorithm trains the model, including: S400.2.1.
1. Based on the data obtained after normalization processing in S300, import the library to be used; S400.2.1.
2. Define the auxiliary functions of the SMO algorithm. During the definition process, it is necessary to calculate the kernel function, the predicted value and the error. Kernel function calculation, linear kernel function calculation is specifically: The Gaussian kernel function calculation is as follows: In the formula, and is the feature vector of the sample point, is the width parameter of the Gaussian kernel function; Calculate the predicted value. The predicted value is obtained by calculating the inner product of the weight vector and the bias term with the sample feature vector, specifically: In the formula, is the weight vector, is the bias term, is the sample feature vector; Calculate the error. The error refers to the difference between the predicted value and the true value of the sample point. For classification tasks, the error is expressed as the difference between the predicted value and the true value. For regression tasks, the error is expressed as the difference between the predicted value and the true value. The specific calculation formula is: S400.2.1.
3. Initialize the parameters of the SVM model, the parameters specifically including a weight vector and a bias term; First, calculate the objective function of the SVM model. The objective function of the SVM is a convex quadratic programming problem, which is solved using the Lagrange dual problem. Specifically: In the formula, represents the Lagrange multiplier, each With sample Correspondingly, by solving , determine the support vector; and Represents the classification label, specifically the sample and Category of; Represents the kernel function, which is used to transform the original sample and Mapping to a higher-dimensional feature space, thereby achieving linear separability in that space; and Represents the input feature vector, specifically the sample data point. In SVM, all data points and The combination of is used to construct the optimal separating hyperplane; By optimizing the objective function, we can get the support vector corresponding to Value, non-zero based Value, calculate the weight vector and the bias term , specifically: Weight vector The calculation formula is as follows: In the formula, The eigenvectors representing the support vectors, represents the class label of the support vector, is the corresponding Lagrange multiplier; Bias The calculation formula is as follows: In the formula, is the eigenvector of any support vector, is the category label of the support vector, and in the bias term In the calculation of The values are summed, because Only the support vectors are non-zero, and the other non-support vectors are is zero, so the calculation of the weight vector and bias term only involves the support vector; S400.2.1.4, Implementation The main loop of the algorithm repeatedly performs the following steps until the stopping condition is met: Select two sample points in the training set as a pair of variables to be optimized; According to the two selected variables, calculate the corresponding predicted value and error; according to Algorithm rules, update the parameters of the two selected variables; Update the parameters of other variables to maintain conditions and interval boundary conditions; In each loop iteration, different heuristics and rules are chosen to select variables and update parameters; S400.2.1.5, after the main loop ends, return to the final Model.
6. The method for predicting carbon emissions of a highway construction project as claimed in claim 5, characterized in that: Based on the trained and evaluated model, carbon emissions are predicted for new sample data, and the prediction results are obtained based on the decision function of the model, including: S600.
1. Substitute the carbon emission index into the formula for calculation; S600.2, linear support vector machine classification formula, specifically: In the formula, Represents the input sample The prediction results, represents the weight vector, represents the feature vector of the input sample, represents the bias term. For the classification problem substituted into the carbon emission index, the feature vector x includes factors related to carbon emissions such as energy consumption and production scale; S600.3, nonlinear support vector machine classification formula, specifically: In the formula, Represents the input sample The prediction results, represents the Lagrange multiplier corresponding to the support vector, Representation sample Tags, Represents the similarity or distance calculated by the kernel function. For the nonlinear classification problem of substituting the carbon emission index, the kernel function is used to capture the nonlinear relationship and map the input features to the high-dimensional feature space for classification; S600.4, support vector machine regression formula, specifically: In the formula, Represents the input sample The prediction results, represents the weight vector, represents the feature vector of the input sample, Represents the bias term. The goal of the regression problem is to predict the continuous carbon emission index value by fitting the training data. The carbon emission prediction results are obtained based on the specific values of 7. Highway construction project carbon emission prediction system, characterized by: include: A collection unit, used for collecting carbon emission related data based on highway project information, and performing preprocessing based on the collected data; A preprocessing unit, for selecting features related to carbon emissions from the data by using data analysis based on the preprocessed data, and performing normalization processing on the features; The classification unit is used to divide the data set into a training set and a test set based on the normalized data, use the training set for model training, and use the test set for model evaluation testing; A modeling unit, used for modeling carbon emissions using an SVM machine learning algorithm, training the SVM model using a training set, and solving for an optimal separation plane by minimizing an objective function; The evaluation unit is used to evaluate the trained model using the test set, calculate the performance index of the model on new samples, and optimize the model based on the calculated index data; The prediction unit is used to predict carbon emissions for new sample data based on the trained and evaluated model, and obtain the prediction result based on the decision function of the model.
8. The highway construction project carbon emission prediction system as claimed in claim 7, characterized in that: It is used to divide the data set into training set and test set based on the normalized data, use the training set for model training, and use the test set for model evaluation and testing, including: The classification unit divides the data set into K mutually exclusive subsets by using K-fold cross validation, and randomly shuffles the data set and then divides it into K subsets in order; For each subset , use it as a test set, and other A subset is used as the training set; Train the SVM model on each training set, use the trained model to make predictions on the corresponding test set, and calculate the performance indicators of the model; Repeat the training and calculate the performance indicators until each subset serves as a test set once and obtains K performance indicators.
9. The highway construction project carbon emission prediction system as claimed in claim 8, characterized in that: Use the test set to evaluate the trained model, calculate the performance indicators of the model on new samples, and optimize the model based on the calculated indicator data, specifically: The evaluation unit performs statistical analysis on K performance indicators and calculates the mean and standard deviation to evaluate the overall performance of the model and detect the stability of the model, that is, the performance difference of the model on different training sets.
10. An electronic device, characterized in that include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Urban carbon emission prediction method, device and equipment and readable storage medium
CN115759327A
Method and system for predicting carbon emission of highway construction project
CN116108998A
Carbon emission abnormal data detection method, terminal and storage medium
CN116484289A
Carbon emission calculation system for highway reconstruction and extension construction period
CN118839536A
System and method for display of aircraft carbon savings
US20230419842A1
Cited By
Bridge construction stage carbon emission prediction method based on machine learning
CN120746605A
Isoline correction method based on machine learning
CN121388392A
A machine learning based sand ratio contour correction method
CN121388392B
