A lithium ion battery capacity prediction method, device, terminal and storage medium

CN122546033APending Publication Date: 2026-08-11JIANGXI GANFENG BATTERY TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-04-29
Publication Date
2026-08-11

AI Technical Summary

Technical Problem

[0005]现有技术中,电池容量预测主要采用以下三种方法:第一种为传统机器学习方法:如支持向量回归(SVR)、随机森林等,但是这类方法对特征工程依赖性强,难以自动学习复杂的非线性关系

Benefits of technology

[0024](1) Comprehensive improvement of prediction performance: Through the two-level residual correction architecture, the first-level MLP model is responsible for learning the overall mapping relationship, and the second-level XGBoost model is specifically learning the error pattern of the first-level model. The two-level models work together to improve R² from 0.845 to 0.854, reduce RMSE by 2.3%, reduce MAPE by 2.8%, reduce the maximum relative error by more than 4%, and reduce the P99.5 quantile error by about 2.7%, achieving comprehensive improvement of multiple indicators.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122546033A_ABST
    Figure CN122546033A_ABST
Patent Text Reader

Abstract

This invention provides a method for predicting the capacity of lithium-ion batteries, comprising: Step S1: preprocessing the original features during the battery formation and capacity testing process, and selecting and obtaining input features; Step S2: inputting the input features into a pre-trained first-level prediction model, and outputting a first-level predicted capacity value; Step S3: constructing a residual feature vector based on the original features and the first-level predicted capacity value; Step S4: inputting the residual feature vector into a pre-trained second-level residual correction model, and outputting a second-level residual correction value; wherein, the first-level prediction residual is the difference between the actual cumulative capacity value of the training samples and the first-level predicted capacity value; Step S5: summing the first-level predicted capacity value and the second-level residual correction value to obtain the final predicted battery capacity value. This invention fully utilizes battery feature information, improves prediction consistency and accuracy, has good generalization ability, and improves overall prediction performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0002] This invention relates to the fields of lithium-ion battery and artificial intelligence prediction technology, and in particular to a lithium-ion battery capacity prediction method, device, terminal, and storage medium. Background Technology

[0004] As a core energy storage component in the new energy field, the accuracy of lithium-ion battery capacity prediction directly affects the performance of the battery management system (BMS) and the safe operation of the battery pack. During the battery production process, characteristic parameters such as voltage, temperature, and capacity collected through the formation and capacity testing process can be used to predict the final capacity of the battery, thereby enabling battery sorting and quality control.

[0005] In existing technologies, battery capacity prediction mainly employs three methods: The first is traditional machine learning methods, such as Support Vector Regression (SVR) and Random Forest. However, these methods are highly dependent on feature engineering and struggle to automatically learn complex nonlinear relationships. The second is single neural network methods, such as Multilayer Perceptron (MLP) and Recurrent Neural Network (RNN). While these methods can learn nonlinear mapping relationships, they suffer from low average error and high maximum error; that is, the model performs well on most samples but has significant prediction errors for some anomalous samples. The third is ensemble learning methods, such as XGBoost and LightGBM gradient boosting tree models, which have good robustness, but their accuracy is limited in continuous numerical prediction tasks. In summary, these existing battery capacity prediction methods suffer from the following drawbacks: 1. A single model struggles to simultaneously achieve both average prediction accuracy and maximum error control, leading to excessively large prediction deviations for some battery capacities; 2. There is a lack of dedicated modeling mechanisms for prediction residuals, making it impossible to effectively correct systematic errors in the first-level model; 3. Feature utilization is insufficient, failing to uncover the interaction information between the first-level prediction results and the original features.

[0006] Therefore, there is an urgent need to develop a battery capacity prediction method that can effectively reduce the maximum relative error and improve prediction reliability. Summary of the Invention

[0008] To address the aforementioned technical problems in existing methods and effectively reduce the maximum relative error while maintaining the average accuracy of battery capacity prediction, thereby improving the reliability and consistency of prediction results, this invention provides a lithium-ion battery capacity prediction algorithm based on second-level residual correction, comprising the following steps: Step S1: Preprocessing the original features during the battery formation and capacity testing process, and selecting and obtaining input features; Step S2: Inputting the input features into a pre-trained first-level prediction model, outputting a first-level capacity prediction value; the first-level prediction model is obtained by training with the input features as input and the actual cumulative capacity value during capacity testing as a label. Layered perceptron neural network; Step S3: Construct residual feature vectors based on the original features and the first-level capacity prediction value; Step S4: Input the residual feature vectors into a pre-trained second-level residual correction model and output the second-level residual correction value; The second-level residual correction model is an extreme gradient boosting tree model trained with the residual feature vectors of the training samples as input and the first-level prediction residuals as labels; Wherein, the first-level prediction residual is the difference between the actual cumulative capacity value of the training samples and the first-level capacity prediction value; Step S5: Sum the first-level capacity prediction value and the second-level residual correction value to obtain the final battery capacity prediction value.

[0009] Furthermore, the input features in step S1 are obtained by filtering in the following way: quantifying the linear and nonlinear correlations between each feature and the target battery capacity, linearly superimposing and fusing the obtained correlation scores and sorting them, and completing the feature filtering based on the sorting results.

[0010] 3. The lithium-ion battery capacity prediction method as described in claim 1, wherein the multilayer perceptron neural network in step S2 contains 2 to 5 hidden layers, and the data processing process of each hidden layer is as follows: first, it passes through a fully connected layer, then enters a batch normalization layer, and after being processed by the ReLU activation function, it enters a Dropout layer.

[0011] Furthermore, in step S2, the first-level prediction model is trained using a multi-level composite loss function, the formula of which is: ,in: This is the root mean square error loss; This indicates that the extreme error is constrained for 99.5% of the positions; This is the penalty term for the maximum error. The value range is 3.0 to 8.0. The value range is 2.0 to 5.0.

[0012] Furthermore, step S2 also includes iteratively optimizing all learnable parameters of the multilayer perceptron neural network using the Adam optimizer.

[0013] Furthermore, the formula for calculating the first-level prediction residual in step S3 is as follows:

[0014]

[0015] in, Let be the first-order prediction residual of the i-th sample; This represents the actual battery capacity value of the i-th sample. This represents the capacity prediction value output by the first-level prediction model for the i-th sample.

[0016] Furthermore, the residual feature vector includes: the original feature vector X = [X1, X2, ..., X...]. d ], (where d is the dimension of the original feature vector), capacity first-level prediction, square of capacity first-level prediction, arithmetic mean of the original feature vector, and product of capacity first-level prediction and arithmetic mean of the original feature vector.

[0017] Another aspect of the present invention provides a lithium-ion battery capacity prediction device, including a data preprocessing and feature selection module, configured to perform the original feature preprocessing and input feature filtering in step S1 of the method;

[0018] The first-level prediction module is configured to perform first-level prediction model training and capacity first-level prediction value output in step S2 of the method.

[0019] The residual correction module is configured to perform the residual feature vector construction in step S3 of the method, and the training of the second-level residual correction model and the output of the second-level residual correction value in step S4.

[0020] The result fusion output module is configured to perform the prediction value fusion and result output in step S5 of the method.

[0021] A third aspect of the present invention also provides a terminal device, including a processor and a memory, the memory storing a computer program, which, when executed by the processor, implements the steps of any of the capacity prediction methods described above.

[0022] In a fourth aspect, the present invention also provides a computer-readable storage medium storing a computer program, which is executed by a processor to implement the various steps of the lithium-ion battery capacity prediction method.

[0023] The technical solution provided by this invention has the following beneficial effects:

[0024] (1) Comprehensive improvement of prediction performance: Through the two-level residual correction architecture, the first-level MLP model is responsible for learning the overall mapping relationship, and the second-level XGBoost model is specifically learning the error pattern of the first-level model. The two-level models work together to improve R² from 0.845 to 0.854, reduce RMSE by 2.3%, reduce MAPE by 2.8%, reduce the maximum relative error by more than 4%, and reduce the P99.5 quantile error by about 2.7%, achieving comprehensive improvement of multiple indicators.

[0025] (2) Improve prediction consistency: The multi-level loss function design (RMSE + P99.5 penalty + maximum error penalty) makes the model pay special attention to high error samples during training, which effectively improves the consistency of prediction results and reduces tail extreme errors.

[0026] (3) Make full use of feature information: The residual feature construction method fully explores the interaction information between the first-level prediction results and the original features, including the squared term of the predicted value (capturing nonlinear relationship) and the interaction term between the predicted value and the feature mean, providing rich learning signals for the second-level model.

[0027] (4) High prediction accuracy: The method of the present invention can achieve high accuracy of R²>0.85 and MAPE<0.21% in battery capacity prediction tasks, which meets the accuracy requirements of battery sorting in industrial production.

[0028] (5) Good generalization ability: The comprehensive feature selection method effectively reduces the feature dimension (from 40 dimensions to 22 dimensions), reduces the risk of model overfitting, and improves the model's generalization ability. It can still maintain stable prediction performance on a three-source merged dataset containing multiple batches and multiple electrolyte formulations. Attached Figure Description

[0030] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only one embodiment of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0031] Figure 1 This is a flowchart of the lithium-ion battery capacity prediction method of the present invention;

[0032] Figure 2 This is a block diagram of the secondary residual correction architecture in the lithium-ion battery capacity prediction method of the present invention;

[0033] Figure 3 This is a diagram of the MLP neural network structure in the lithium-ion battery capacity prediction method of the present invention.

[0034] Figure 4 This is a flowchart of the residual feature construction process in the lithium-ion battery capacity prediction method of the present invention;

[0035] Figure 5 This is a block diagram of the battery capacity prediction device of the present invention;

[0036] Figure 6 This is a hardware block diagram of the terminal device of the present invention. Detailed Implementation

[0038] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0039] Example 1

[0040] This invention provides a method for predicting the capacity of lithium-ion batteries, which includes the following steps:

[0041] Step S1: Preprocess the original features during the battery formation and capacity testing process, and select and obtain input features; Step S2: Input the input features into a pre-trained first-level prediction model, and output the first-level capacity prediction value; the first-level prediction model is a multilayer perceptron neural network trained with the input features as input and the actual cumulative capacity value as the label; Step S3: Construct a residual feature vector based on the original features and the first-level capacity prediction value; Step S4: Input the residual feature vector into a pre-trained second-level residual correction model, and output the second-level residual correction value; the second-level residual correction model is an extreme gradient boosting tree model trained with the residual feature vector of the training samples as input and the first-level prediction residual as the label; wherein, the first-level prediction residual is the difference between the actual cumulative capacity value of the training samples and the first-level capacity prediction value; Step S5: Summate the first-level capacity prediction value and the second-level residual correction value to obtain the final battery capacity prediction value. The lithium-ion battery capacity prediction method of the present invention includes the above five main steps and forms a hierarchical prediction-correction mode, with the output of the previous step serving as the input of the next step, gradually improving the prediction accuracy.

[0042] Furthermore, the specific operational details and process of the lithium-ion battery capacity prediction method of the present invention are as follows:

[0043] Step S1: Preprocess the original features in the battery capacity grading process to filter the original features and obtain input features.

[0044] Step S1 is performed mainly in the order of sub-steps S1.1 to S1.3, specifically as follows:

[0045] Step S1.1: Acquisition and preparation of raw battery data; First, acquire multiple raw characteristic data during the battery formation and capacity testing process. The raw characteristic data includes the start voltage, end voltage, and capacity of the formation stage; and the start voltage, end voltage, battery capacity, and temperature parameters of each step in the capacity testing stage. Specifically, for steps 2-11 of the capacity testing stage: a total of 30 characteristics including the start voltage, end voltage, and capacity of each step; and a total of 6 characteristics including the positive electrode temperature and negative electrode temperature of steps 4 / 6 / 8 of the capacity testing stage.

[0046] Step S1.2: Preprocess the data obtained in step S1.1. The specific preprocessing method is as follows: Standardize the raw feature data obtained in step S1.1, specifically by using the Z-score standardization function for calculation.

[0047]

[0048] in: Let X be the standardized feature value of a given original feature; X is the value of the original feature. The mean of a certain original feature in the training set; The standard deviation of a certain original feature in the training set.

[0049] During the standardization process in step S1.2, the feature mean and standard deviation To ensure that the values ​​are calculated only on the training set samples, in this embodiment, the test set preferably uses 2000 samples. The validation set and test set are standardized using the same mean and standard deviation calculated from the training set to prevent data leakage and ensure the objectivity of the model evaluation and consistency with industrial deployment. This is because if μ and σ are calculated on all data (including the test set), the model would "see" the statistical information of the test set during training, constituting data leakage and leading to overly optimistic evaluation results that fail to reflect the model's performance on real, unknown data. Therefore, in actual industrial deployment, the prediction method of this invention can only use the standardized parameters saved during training to predict new battery data, and the training phase should simulate this real-world scenario.

[0050] Step S1.3: Determine the optimal feature subset using a comprehensive feature selection method. The comprehensive feature selection method mainly includes the following sub-steps: (a) First, calculate the Pearson correlation coefficient between each original feature obtained in step S1.1 and the target battery capacity, and then calculate the Pearson correlation coefficient of each feature X. Sort in descending order, and denot the ranking number as follows: .

[0051] The Pearson correlation coefficient is calculated using the following formula:

[0052]

[0053] in: Let X be the Pearson correlation coefficient between the feature X and the target battery capacity y; Let i be the feature value of the i-th sample; Let be the target battery capacity value corresponding to the i-th sample; Let X be the mean of the feature X; The mean of the target battery capacity value y;

[0054] n is the total number of samples. For the Pearson correlation coefficient ∈ [−1,1], the closer the absolute value is to 1, the stronger the linear correlation; the closer the absolute value is to 0, the weaker the linear correlation. In this invention, a Pearson correlation coefficient of 0.55-0.62 is preferred. Since the Pearson correlation coefficient is scale invariant, standardization does not affect its calculation results.

[0055] (b) Then, the importance score of each original feature obtained in step S1.1 is calculated using a random forest regression model.

[0056] This invention employs a random forest model comprising 100 decision trees, trained with the target battery capacity as the regression objective. Feature importance is evaluated by calculating the average reduction in variance of the target variable across all decision tree split nodes. A higher importance score indicates a greater contribution of the feature to capacity prediction. In this embodiment, descending order is used, and the ranking number is denoted as... (e.g., 1st place, 2nd place, etc.).

[0057] (c) Combine the Pearson relevance ranking from step a with the random forest importance ranking from step b to obtain the overall ranking. The formula for calculating the overall ranking is as follows:

[0058] in: The overall ranking score of the original features (S represents the score). This represents the rank of the original feature in descending order of the Pearson correlation coefficients; is the rank of the original feature X in the descending order of importance in the random forest; The smaller the value, the higher the overall evaluation of the feature.

[0059] In this invention, by integrating linear correlation and nonlinear importance ranking, the influence of the original features on the target battery capacity is comprehensively evaluated, thereby making the final ranking more robust.

[0060] (d) Select the top N features with the highest overall ranking scores after step c as the optimal feature subset. In this embodiment, N is preferably 22.

[0061] Step S2: Input the input features into the pre-trained first-level prediction model and output the first-level predicted capacity value; the first-level prediction model is a multilayer perceptron neural network trained with the input features as input and the true value of the cumulative capacity as the label.

[0062] Step S2 is performed in the order of sub-steps S2.1 to S2.6, specifically as follows:

[0063] Step S2.1: Construct a multilayer perceptron (MLP) neural network as a first-level prediction model. The multilayer perceptron (MLP) neural network contains 2 to 5 hidden layers, with 32 to 512 neurons in each layer. In this embodiment, the MLP preferably includes three hidden layers, with 128, 64, and 32 neurons in each hidden layer, respectively.

[0064] The training process of the first-level prediction model in this embodiment includes the following key configurations:

[0065] (a) Batch Training Strategy: Divide the training data into multiple mini-batches, using a mini-batch of samples each time to calculate gradients and update model parameters. The batch size needs to balance training efficiency and gradient estimation accuracy. (b) Learning Rate Scheduling: Use an initial learning rate combined with a step-decay strategy. Use a larger learning rate in the early stages of training for rapid convergence, and multiply the learning rate by a decay factor after a preset number of rounds to allow for more precise parameter adjustment in the later stages of model training. (c) Early Stopping Mechanism: Evaluate model performance on the validation set after each round of training. Terminate training early when the validation set loss no longer decreases within a certain number of rounds to prevent overfitting. (d) Regularization Strategy: Use L2 regularization (weight decay), adding a weight L2 norm penalty term to the loss function to prevent excessive weights from causing overfitting. Gradient clipping is also used; when the gradient norm exceeds a threshold, it is scaled proportionally to prevent gradient explosion.

[0066] For the l-th hidden layer, the output calculation formula is:

[0067]

[0068] in: This is the output vector of the l-th layer, which can specifically be the output vector of the first layer. Let be the weight matrix of the l-th layer, which can specifically be the weight matrix of the 1st layer; Let l be the output vector of the previous layer, where when l is 1, it satisfies the condition of the input layer. =X, where X is the input feature vector; Let σ be the bias vector of the l-th layer, and σ be the activation function.

[0069] Specifically, during batch computation, the batch size is set to 1024; the initial learning rate is 0.002; the learning rate decay is 0.5 times the original value every 50 rounds; the maximum number of training rounds is 300; the early stopping patience value is 30 rounds; the L2 regularization coefficient is 0.001; and the gradient clipping threshold is 1.0.

[0070] S2.2 Perform data processing on each hidden layer. The data processing flow for each hidden layer is as follows:

[0071] Fully connected layer → batch normalized layer → ReLU activation function → Dropout layer, specifically:

[0072] (1) Fully connected layer: performs affine transformation on the input vector:

[0073] in, This is the output feature vector of the (l-1)th layer (which is also the input of the current layer). Here is the weight matrix for the l-th layer; Let l be the bias vector of the l-th layer; This is the weighted sum of the l-th layer (output before activation);

[0074] The fully connected layer performs a simulated transformation on the input vector to map the output of the previous layer to the feature space of the current layer.

[0075] (2) Batch Normalization Layer: The output of the fully connected layer is normalized along the mini-batch sample dimension to eliminate internal covariate bias, accelerate training convergence, and improve model stability. The calculation process of the batch normalization layer includes the following steps:

[0076] (a) Calculate the mean of the mini-batch sample:

[0077]

[0078] in, It is the mean of a small batch of samples, that is, the average value of this set of data;

[0079] m is the size of the sample batch, that is, the total number of samples in the current small batch; Let be the input feature value of the i-th sample.

[0080] (b) Calculate the variance of the small batch sample:

[0081] in, is the variance of the current mini-batch; m is the batch size, i.e., how many samples are in a batch; Let be the input value for the i-th sample; This is the mean of this batch of samples.

[0082] (c) Normalize each input value in the sample, i.e., use the following function:

[0083]

[0084] in, This is the output value of the i-th sample after normalization; This is the input value of the original i-th sample in the sample; The mean of the current small batch of samples calculated earlier; The variance of the current mini-batch sample from the previous tests;

[0085] ε is a very small constant, typically taken as 10. −5 This is used to prevent the denominator from being 0. The significance of using the above function for normalization is that by subtracting the sample mean from the value of each sample and then dividing by the standard deviation, the data becomes a standard distribution with a mean of 0 and a variance close to 1.

[0086] (d) Perform scaling and translation transformations on the normalized result using the following functions:

[0087]

[0088] in, : These are the feature values ​​of the final output after batch normalization, which have been scaled and translated; : This is the normalized result after step c; : This is a learnable scaling parameter (gamma) used to adjust the amplitude of the data; : This is a learnable translation parameter (beta) used to adjust the offset of the data;

[0089] (3) ReLU activation function: Apply nonlinear transformation:

[0090]

[0091] By introducing nonlinear expressive capabilities, the network can learn complex nonlinear mapping relationships.

[0092] (4) Dropout layer: During the training phase, probability is used to... Randomly setting the output of some neurons to zero forces the network to learn more robust distributed feature representations, preventing overfitting. The output after Dropout processing is the final output of this hidden layer. The calculation formula for the Dropout layer is as follows:

[0093]

[0094] in:

[0095] This is the output value after Dropout calculation;

[0096] This is the original output of the neuron before it undergoes Dropout computation;

[0097] The variables are random variables that follow a Bernoulli distribution, and are randomly assigned to 0 or 1; during training, some neuron outputs are randomly set to zero to prevent overfitting. , During the inference phase, the Dropout layer does not randomly zero out the outputs. Instead, it scales all outputs by multiplying them by the retention probability (1-p) to keep the expected output values ​​consistent between training and inference.

[0098] p is the probability that a neuron is discarded, and the value of p can range from 0.2 to 1.

[0099] 1−p is used for scaling compensation during training to ensure that the expected output remains unchanged.

[0100] In this embodiment, the Dropout layer acts on the output of the neuron in the current hidden layer after it has been processed by the ReLU activation function. Let the current hidden layer be the... The output vector of the layer after passing through a fully connected layer, batch normalization, and ReLU activation is The Dropout layer performs a random masking operation on the output:

[0101]

[0102] in: For the current number Layer The output of a neuron after ReLU activation (i.e., the input before Dropout); For the 1st after Dropout processing The final output of each neuron. The above four operations are executed in cascade, forming a complete hidden layer processing unit. The input features start from the first hidden layer and are processed layer by layer through the three hidden layers, with the number of neurons decreasing successively (128→64→32), forming a funnel-shaped structure, extracting higher-level feature representations layer by layer. The output of the third hidden layer is sent to the output layer (a single-neuron fully connected layer) to generate the capacity prediction value.

[0103] Step S2.3: Train the first-level model using a multi-level composite loss function.

[0104] The multi-level composite loss function in this embodiment is shown below:

[0105]

[0106] in, The value ranges from 3.0 to 8.0, with 5.0 being the preferred value. The value range is 2.0 to 5.0, preferably 3.0;

[0107]

[0108] is the root mean square error loss, where N is the total number of samples; Predict the capacity value for the model for the i-th sample;

[0109] is the true capacity label value (cumulative capacity) of the i-th sample; N is the total number of samples in the current training mini-batch.

[0110] In each iteration of model training, a mini-batch of samples from the feature subset selected in step S1 is used as input, and sequentially processed through the forward propagation calculations of each hidden layer described in steps S2.1 and S2.2, ultimately generating a predicted value from the output layer. For the i-th training sample, its predicted value is denoted as:

[0111]

[0112] in:

[0113] Represents the forward propagation function of the entire MLP network;

[0114] Let be the input feature vector of the i-th sample;

[0115] W and b are the weight matrices and bias vector parameter sets of all layers in the network, respectively;

[0116] in,

[0117]

[0118] Let $\frac{j}{j}$ be the absolute value of the prediction error for the $j$-th sample, i.e. =∣ - |;

[0119] k is the number of the top 0.5% of samples with the largest absolute error among all samples;

[0120] To constrain extreme errors at 99.5% of positions, this is used to specifically penalize extremely large errors and reduce the maximum relative error. This is achieved by setting... This feature enables the model to focus on and suppress the 0.5% of extremely large error samples during training, significantly reducing the maximum relative error while maintaining the overall average prediction accuracy, thereby improving the reliability and consistency of capacity prediction results.

[0121]

[0122] This is the penalty term for the maximum error.

[0123] The maximum absolute value of the prediction error among all samples is used to square the maximum error, thereby achieving a strong penalty for extreme abnormal prediction results.

[0124] S2.4 Employs the Adam optimizer for all learnable parameters of the MLP network. (Including the weight matrices and bias vectors of each layer) undergo iterative optimization. In the... In the first iteration, the composite loss function is calculated using the backpropagation algorithm. For the current parameter gradient Then update the parameters by following these steps:

[0125] (a) First, calculate the first-order momentum of the gradient of the loss function (the exponentially weighted moving average of the gradient, reflecting the historical average direction of the gradient):

[0126]

[0127] in,

[0128] This is the first moment estimate of the gradient at the t-th iteration;

[0129] This is the first moment estimate of the gradient at the (t-1)th iteration;

[0130] The first-order moment exponential decay rate is 0.9.

[0131] For the first The gradient vector of the composite loss function with respect to all network parameters during step iteration.

[0132] (b) Then calculate the second momentum of the gradient of the loss function (an exponentially weighted moving average of the squared gradient, reflecting the magnitude of gradient fluctuations):

[0133]

[0134] in, This is the second moment estimate of the squared gradient at the t-th iteration;

[0135] This is the second moment estimate for the (t-1)th iteration;

[0136] The second-order moment exponential decay rate has a value of 0.999.

[0137] gt is the gradient of the t-th iteration, i.e., the gradient at the current time.

[0138] in For the first The gradient vector of the composite loss function with respect to all network parameters during each iteration. and These are the first-order and second-order momentum estimates (initial values) from the previous step. , ), and This is the exponential decay coefficient.

[0139] Since m0=0 and v0=0 during initialization, the estimated values ​​are biased towards zero in the early stages of training, and bias correction is required.

[0140] (c) Recalculate the first-order momentum estimate after bias correction:

[0141]

[0142] in, This is the first-order momentum estimate after bias correction;

[0143] For the attenuation coefficient The power of β1, in this embodiment β1 = 0.9;

[0144] (d) Then calculate the bias-corrected second-order momentum estimate:

[0145]

[0146] in, This is the second-order momentum estimate after bias correction;

[0147] This represents the current iteration step. For the attenuation coefficient Power. With As the value increases, the effect of the correction gradually decreases, β2 = 0.999.

[0148] (e) Update parameters using the bias-corrected momentum estimate:

[0149]

[0150] in:

[0151] These are the model parameters updated after the t-th iteration;

[0152] These are the model parameters for the (t-1)th iteration;

[0153] The initial learning rate is set to 0.002 in this invention.

[0154] ε is a constant for maintaining numerical stability, and its value is 10. −8 .

[0155] S2.5 uses the Xavier / Glorot method for weight initialization:

[0156]

[0157] in,

[0158] This represents the number of input neurons in the current layer.

[0159] This represents the number of neurons in the current layer's output.

[0160] This initialization method keeps the variance of activation values ​​and gradients of each layer of the network stable, accelerates model convergence, and improves training stability.

[0161] S2.6: After training is completed in steps 2.4 and 2.5, the first-level prediction model is used to predict all samples to obtain the first-level predicted capacity value. ,in , The total number of samples.

[0162] Step S3: Construct residual feature vectors based on the original features and the first-level predicted values ​​of the capacity;

[0163] Specifically, it includes the following sub-steps:

[0164] (1) Extract the original input feature vector X after feature selection in step S1. i (22-dimensional);

[0165] (2) Obtain the first-level capacity prediction value ŷ1,i (1-dimensional) output by step S2;

[0166] (3) Calculate the first-level predicted value of capacity ŷ 1,i The square of ŷ 1,i ² (1-dimensional);

[0167] (4) Calculate the original input feature vector X for each sample. i arithmetic mean (1-dimensional); ;

[0168] in The number of feature dimensions retained after feature selection in step S1 (in this invention) ), For the first The first sample eigenvalues ​​( ), For the first The arithmetic mean (scalar) of all feature values ​​of a sample reflects the overall feature level of the sample from a macro perspective.

[0169] (5) Calculate the capacity first-level predicted value ŷ1,i and the original input feature vector X i Interaction term of arithmetic mean (1-dimensional), used to capture the correlation information between the prediction results and sample features;

[0170] The above features are concatenated to obtain a 26-dimensional residual feature vector:

[0171]

[0172] Step S4: Input the residual feature vector into the pre-trained second-level residual correction model and output the second-level residual correction value; the second-level residual correction model is an extreme gradient boosting tree model trained with the residual feature vector of the training sample as input and the first-level prediction residual as label; wherein, the first-level prediction residual is the difference between the true value of the cumulative capacity of the training sample and the first-level predicted value of the capacity.

[0173] Step 4.1: Calculate the residual between the first-level predicted capacity and the actual capacity. The first-level prediction residual is calculated according to the following formula:

[0174]

[0175] Let be the first-order prediction residual of the i-th sample, which is a scalar value representing the value of the i-th sample. The difference between the true size of a sample and the first-level predicted size; > 0 indicates that the first-level model predicts a lower value; ri < 0 indicates that the first-level model predicts a higher value. In subsequent steps, Used as a learning target for the second-level correction model;

[0176] This represents the true capacity value of the i-th sample.

[0177] This is the capacity first-level prediction value output by the first-level prediction model for the i-th sample.

[0178] Step S4: Construct residual features and train the secondary correction model

[0179] S4.2 The XGBoost (eXtreme Gradient Boosting) gradient boosting tree model is used as the second-level residual correction model.

[0180] XGBoost is based on the gradient boosting framework. It iteratively trains multiple decision trees, with each new tree focusing on fitting the cumulative prediction residuals of all previous trees, gradually approaching the target value.

[0181] The model's final prediction is the sum of all decision tree predictions:

[0182]

[0183] in For the total number of decision trees, For the first The prediction function of a decision tree.

[0184] In the t-th iteration, the newly added t-th tree is determined by minimizing the following regularization objective function:

[0185]

[0186] in The loss function is the squared error loss. This represents the first-level prediction residual (the target value of the second-level model). The regularization term, including L1 and L2 regularization, controls the complexity of the tree.

[0187] In this embodiment, the parameters set in the model are preferably as follows: maximum depth: 6; learning rate: 0.03; number of trees: 300; minimum child node weight: 5; subsampling ratio: 0.8; column sampling ratio: 0.8; L1 regularization: 0.1; L2 regularization: 1.0.

[0188] The main reasons for choosing XGBoost as the second-level model in this embodiment are: (1) the splitting mechanism of the decision tree can effectively capture the nonlinear error patterns in the residuals; (2) built-in regularization and depth constraints prevent overfitting to noisy residuals; (3) support for row and column sampling to improve generalization ability; (4) it belongs to a different learning paradigm from the first-level MLP, and the error patterns are complementary.

[0189] S4.3: Using the residual feature vector of the training samples As input, the first-level prediction residual i To predict the target, a second-order residual correction model is trained. The training specifically includes the following:

[0190] (a) Training objective: To learn the mapping from residual features to residuals. This enables the secondary model to estimate the prediction bias of the primary model on each sample;

[0191] (b) Training set composition: Training is performed using the residual features and corresponding residuals of all samples in the training set, and the validation set data is used to monitor the training process;

[0192] (c) Training process: XGBoost iteratively adds decision trees, and each new tree learns the prediction residuals of all previous trees until the upper limit of the number of trees is reached or the early stopping mechanism is triggered;

[0193] (d) Model output: The second-level residual correction model is obtained after training. It can predict the prediction bias of the first-level model based on the residual characteristics.

[0194] After the S4.4 secondary model is trained, use Predictive estimation of the first-level prediction residuals: In the prediction stage, the residual feature vectors of the samples to be tested are input into the trained XGBoost model function f. XGB Output the second-order residual correction value of the test sample.

[0195]

[0196] This is the correction value for the second-order residual.

[0197] Step S5: Fusion prediction output final result

[0198] The final capacity prediction is obtained by summing the first-level capacity prediction value and the second-level residual correction value:

[0199] i

[0200] This is the predicted final battery capacity.

[0201] This is the correction value for the second-order residual;

[0202] This is the first-level predicted value for capacity.

[0203] The capacity prediction method described above will significantly improve the accuracy and consistency of battery capacity prediction. The following six indicators (R) will be used as a basis for further analysis. 2 The accuracy and consistency of the prediction model are comprehensively evaluated using RMSE, MAE, MAPE, maximum relative error, and P99.5 relative error. The specific meanings of each performance indicator are as follows:

[0204] (1) R² (coefficient of determination)

[0205] This measures the proportion of the variance of the target variable that the model explains, and its value ranges from -∞ to 1. The closer the value is to 1, the better the fit.

[0206]

[0207] in This is the mean of all true values.

[0208] R²=1 indicates a perfect prediction, and R²=0 indicates that the effect is equivalent to the predicted mean.

[0209] (2) RMSE (Root Mean Square Error)

[0210] The unit is the same as the target variable (Ah), making it more sensitive to large errors:

[0211]

[0212] (3) MAE (Mean Absolute Error)

[0213] Assign the same weight to all samples:

[0214]

[0215] (4) MAPE (Mean Absolute Percentage Error)

[0216] Expressed as a percentage, unaffected by dimensions:

[0217]

[0218] (5) Maximum relative error

[0219] The maximum relative error across all samples, measuring the prediction bias in the worst-case scenario, is a key indicator of battery sorting reliability.

[0220]

[0221]

[0222] (6) P99.5 Relative error

[0223] The 99.5th percentile of the relative error, meaning 99.5% of the samples are below this value. It is more robust than the maximum relative error and is unaffected by isolated extreme outliers.

[0224] L

[0225] In 20,000 test samples, P99.5 means that the error may be higher than this value for about 100 samples. After excluding the most extreme 0.5% of samples, a robust estimate of the "near worst case" is provided.

[0226] Comparative Example 1

[0227] The difference between Comparative Example 1 and Example 1 is that Comparative Example 1 only uses the conventional first-level prediction model (Deep) for capacity prediction, and does not implement the second-level correction model of Example 1 of this invention.

[0228] The results of Comparative Example 1 and Example 1 are compared in Table 1 below:

[0229] R² 0.845 0.854 +1.1% RMSE (Ah) 0.133 0.130 -2.3% MAE(Ah) 0.104 0.101 -2.9% MAPE (%) 0.215 0.209 -2.8% Maximum relative error (%) 1.671 1.603 -4.1% P99.5 Relative error (%) 0.876 0.852 -2.7%

[0230] As shown in the table above, the capacity prediction method of this invention improves all performance indicators after secondary residual correction. Specifically, R² increases by 1.1%, RMSE decreases by 2.3%, MAPE decreases by 2.8%, maximum relative error decreases by 4.1%, and P99.5 quantile error decreases by 2.7%. This demonstrates that the capacity prediction method of this invention, through the secondary residual correction method, effectively improves the effectiveness of capacity prediction.

[0231] Example 2

[0232] This embodiment compares the performance of different MLP architectures in capacity prediction tasks, using the same dataset and training configuration. Table 2 below shows the specific performance parameters of each MLP architecture:

[0233] Standard [128,64,32] 0.830 0.139 0.226 2.097 Deep [256,128,64,32] 0.845 0.133 0.215 1.671 Wide [256,256,128] 0.854 0.129 0.208 1.723

[0234] As shown in the table above, the Wide architecture performs best in R² and MAPE, while the Deep architecture performs best in maximum relative error control. Considering all factors, the Deep architecture is the preferred choice for the first-level model, and when combined with second-level residual correction, it achieves the best overall performance.

[0235] Example 3: Comparison of Residual Correction Effects

[0236] This embodiment compares the effects before and after applying two-stage residual correction, as well as the performance of different model architectures after residual correction. The performance comparison of various models is shown in Table 3 below:

[0237] Deep (Level 1) 0.845 0.133 0.215 1.671 0.876 Deep+XGBoost 0.854 0.130 0.209 1.603 0.852 XGBoost (Pure) 0.823 0.142 0.232 1.774 0.885

[0238] As can be seen from the table above, the two-stage residual correction method is superior to using a neural network alone or XGBoost alone. The Deep+XGBoost residual correction scheme outperforms the single model in all metrics, verifying the effectiveness of the two-stage collaborative strategy.

[0239] Example 4: Comparison of Loss Functions

[0240] This example compares the impact of different loss function designs on model performance. The same Deep architecture is used, with only the loss function changed. Performance comparisons for various models are shown in Table 4 below:

[0241] Standard MSE 0.220 2.35 0.96 RMSE 0.218 2.10 0.92 RMSE+P99.5 penalty 0.216 1.85 0.88 RMSE + P99.5 + Max penalty 0.215 1.67 0.876

[0242] As shown in the table above, the multi-level composite loss function (RMSE + P99.5 + Max penalty) can effectively reduce the tail extreme error, with the maximum relative error decreasing from 2.35% to 1.67%, a reduction of 29%. Although MAPE only slightly improves, the P99.5 quantile error and the maximum error are significantly reduced, resulting in a substantial improvement in overall prediction reliability.

[0243] Meanwhile, based on the above-mentioned scheme, this invention also provides a lithium-ion battery capacity prediction device based on secondary residual correction, comprising: a data preprocessing module for acquiring the original feature data during the battery formation and capacity testing process and standardizing the data; a feature selection module for selecting the optimal feature subset from the original features using a comprehensive feature selection method; a primary prediction module for constructing and training an MLP neural network model to perform primary prediction of battery capacity; a residual correction module for calculating the primary prediction residual, constructing residual features, and training an XGBoost secondary model to predict and correct the residual; and a result output module for fusing the primary prediction value and the residual correction value to output the final capacity prediction result.

[0244] This invention also provides a terminal device, comprising: a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, it implements the steps of the above-described lithium-ion battery capacity prediction method based on second-level residual correction. When this terminal device is in operation, data is input to the processor via a data acquisition interface, the processor performs calculations based on the capacity prediction algorithm stored in the memory, and the results are output via a display interface; the processor and memory interact bidirectionally via a system bus, and the memory is bidirectionally linked with the communication and power management modules to realize data storage and transmission as well as overall device power supply control.

[0245] The present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the above-described lithium-ion battery capacity prediction method based on second-order residual correction.

[0246] The technical solution provided by this invention has the following beneficial effects:

[0247] (1) Comprehensive improvement of prediction performance: Through the two-level residual correction architecture, the first-level MLP model is responsible for learning the overall mapping relationship, and the second-level XGBoost model is specifically learning the error pattern of the first-level model. The two-level models work together to improve R² from 0.845 to 0.854, reduce RMSE by 2.3%, reduce MAPE by 2.8%, reduce the maximum relative error by more than 4%, and reduce the P99.5 quantile error by about 2.7%, achieving comprehensive improvement of multiple indicators.

[0248] (2) Improve prediction consistency: The multi-level loss function design (RMSE + P99.5 penalty + maximum error penalty) makes the model pay special attention to high error samples during training, which effectively improves the consistency of prediction results and reduces tail extreme errors.

[0249] (3) Make full use of feature information: The residual feature construction method fully explores the interaction information between the first-level prediction results and the original features, including the squared term of the predicted value (capturing nonlinear relationship) and the interaction term between the predicted value and the feature mean, providing rich learning signals for the second-level model.

[0250] (4) High prediction accuracy: The method of the present invention can achieve high accuracy of R²>0.85 and MAPE<0.21% in battery capacity prediction tasks, which meets the accuracy requirements of battery sorting in industrial production.

[0251] (5) Good generalization ability: The comprehensive feature selection method effectively reduces the feature dimension (from 40 dimensions to 22 dimensions), reduces the risk of model overfitting, and improves the model's generalization ability. It can still maintain stable prediction performance on a three-source merged dataset containing multiple batches and multiple electrolyte formulations.

Claims

1. A method for predicting the capacity of a lithium-ion battery, characterized in that, The steps include: Step S1: Preprocessing the original features in the battery formation and capacity testing process, and filtering to obtain input features; Step S2: Input the input features into a pre-trained first-level prediction model, and output the first-level predicted capacity value; the first-level prediction model is a multilayer perceptron neural network trained with the input features as input and the true value of the capacity accumulation as the label; Step S3: Construct a residual feature vector based on the original features and the first-level predicted capacity value; S4: Input the residual feature vector into the pre-trained second-level residual correction model and output the second-level residual correction value; The second-level residual correction model is an extreme gradient boosting tree model trained with the residual feature vector of the training samples as input and the first-level prediction residual as label; wherein, the first-level prediction residual is the difference between the true value of the cumulative capacity of the training samples and the first-level predicted value of the capacity; Step S5: Sum the first-level capacity prediction value and the second-level residual correction value to obtain the final battery capacity prediction value.

2. The lithium-ion battery capacity prediction method of claim 1, wherein, The input features in step S1 are obtained by filtering in the following way: quantifying the linear and nonlinear correlations between each feature and the target battery capacity, linearly superimposing and fusing the obtained correlation scores and sorting them, and completing the feature filtering based on the sorting results.

3. The lithium-ion battery capacity prediction method of claim 1, wherein, The multilayer perceptron neural network in step S2 contains 2 to 5 hidden layers. The data processing process of each hidden layer is as follows: first, it passes through a fully connected layer, then enters a batch normalization layer, and after being processed by the ReLU activation function, it enters the Dropout layer.

4. The lithium-ion battery capacity prediction method of claim 1, wherein, In step S2, the first-level prediction model is trained using a multi-level composite loss function, the formula of which is: ,in: This is the root mean square error loss; This indicates that the extreme error is constrained for 99.5% of the positions; This is the penalty term for the maximum error. The value range is 3.0 to 8.

0. The value range is 2.0 to 5.

0.

5. The lithium-ion battery capacity prediction method of claim 3, wherein, Step S2 further includes using the Adam optimizer to iteratively optimize all learnable parameters of the multilayer perceptron neural network.

6. The lithium-ion battery capacity prediction method of claim 1, wherein, The formula for calculating the first-level prediction residual in step S3 is as follows: , where r i Let y be the first-order prediction residual of the i-th sample; true,i This represents the actual battery capacity value of the i-th sample. This represents the capacity prediction value output by the first-level prediction model for the i-th sample.

7. The lithium-ion battery capacity prediction method of claim 1, wherein, The residual feature vector includes: the original feature vector x = [x1, x2, ..., x...]. d ] (where d is the dimension of the original feature vector), capacity level 1 prediction, the square of capacity level 1 prediction, the arithmetic mean of the original feature vector, and the product of capacity level 1 prediction and the arithmetic mean of the original feature vector.

8. A lithium-ion battery capacity prediction device, characterized by, include: The data preprocessing and feature selection module is configured to perform the original feature preprocessing and input feature filtering in step S1 of the method as described in claim 1; The first-level prediction module is configured to perform the first-level prediction model training and capacity first-level prediction value output in step S2 of the method as described in claim 1. The residual correction module is configured to perform the residual feature vector construction in step S3 of the method as described in claim 1, and the training of the second-level residual correction model and the output of the second-level residual correction value in step S4. The result fusion output module is configured to perform the predicted value fusion and result output in step S5 of the method as described in claim 1.

9. A lithium-ion battery capacity prediction terminal, characterized by, It includes a processor and a memory, the memory storing a computer program that, when executed by the processor, implements the steps of the capacity prediction method as described in any one of claims 1-7.

10. A computer readable storage medium characterized by, The system contains a computer program that is executed by a processor to implement the steps of the lithium-ion battery capacity prediction method as described in any one of claims 1-7.