{'fraction_non_alphanumeric': 0.0392618767177071, 'fraction_numerical': 0.013839811542991754, 'mean_word_length': 4.607319757842598, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Sequence-in-Sequence Learning for SOH Estimation of Lithium- on Battery

. State-of-Health (SOH) prediction of a Lithium-ion battery is essential for preventing malfunction and maintaining efﬁcient working behaviors for the battery. In practice, this task is difﬁcult due to the high level of noise and complexity. There are many machine learning methods, especially deep learning approaches, that have been proposed to address this problem recently. However, there is much room for improvement because the nature of the battery data is highly non-linear and exhibits higher dependence on multidisciplinary parameters such as resistance, voltage and external conditions the battery is subjected to. In this paper, we propose an approach known as bidirectional sequence-in-sequence, which exploits the de- pendency of nested cycle-wise and channel-wise battery data. Experimented with real dataset acquired from NASA, our method results in signiﬁcant reduction of error of approximately up to 32.5%.


Introduction
Nowadays, Lithium-ion Batteries (LIB) have been used in many electronic devices as the main power supply to avoid power interruption. Especially, the recent growing quantity of moving objects explodes the demand for LIB. In particular, LIB has been used enormously due to its advantages of durability, stability, high-capacity, low-cost, light-weight and small-scale. In another approach, users need to have recent batteries monitoring data during using them. This demand comes from the need to lookahead malfunction, foresee the risks, avoid explosion or optimize the battery life. Therefore, it is essential to predict LIB capacity accurately and promptly in order to provide the exact input for above demands, making the issue of State-of-Health (SOH) estimation for LIB highly essential to maintain proper functioning [1]. Basically, SOH is a metric to reflect the condition of a battery, compared to its ideal conditions. In the actual lifetime, the capacity of a battery is normally reduced during the discharge cycle and needs a charge cycle afterward. These charge and discharge cycles, empirically, influence the battery SOH over a long time. There are a number of metrics used for SOH estimation of a battery. Perhaps the most popular one is introduced in [2], where SOH is calculated as SOH = C f ull C nom × 100%, where C nom (Nominal Capacity) is the original capacity given when the battery was manufactured and C f ull (Full Capacity) is the full capacity practically charged at the current cycle. Theoretically, C f ull is gradually degraded after every charge and discharge cycles and the SOH estimation task is thus equivalent to that of C f ull prediction, given the current cycle of the battery. However, this estimation is a non-trivial exercise due to the nonlinear nature of battery capacity change one practically used. Moreover, different batteries introduce different rates of SOH decay. Figure 1 shows an example of SOHs measured from four batteries [3]. It can be observed that the SOHs of the cycles create a time-series trend and there are clear degradations with various rates over around 150 cycles of charge and discharge of all the four modules. Moreover, the batteries C f ull have not always strictly decreased but occasionally increased in a periodical manner, making spikes over the trends.
Research in this field shows that even though each battery possesses a different decay rate, historical data of the energy status of the battery, can be used to predict the energy status in the next few cycles [4]. With the recent advancement of AI methods, much work considers leveraging sequence-based deep learning models to handle this issue. In [5], a model using importance sampling and neural networks is introduced. Perhaps the most widely used sequence-based deep learning model for this problem is based on the well-known deep learning architecture of Long Short-term Memory (LSTM) [6], [7], [2], which was applied in various works with remarkable results [5], [6].
Traditionally, in LSTM-based approaches, the previous information of the battery capacity in some last cycles will be used to predict the corresponding capacity statuses in the next cycles. However, some additional information from other channels, such as voltage, current and temperature, can be complementarily used for insightful analysis of the battery status. Thus, the collected channel-wise data of a battery become those of multivariate time series [2]. In [8], a multi-channel charging model is proposed for the prediction task. Other partial data also used in [9] with similar purpose.
Notably, perhaps the most remarkable achievement so far is reported in the work of [2]. In this work, the authors proposed an importance sampling strategy of 11 points in a charge cycle. To construct a predictive model, other channel-wise information, as above discussed, has been incorporated to introduce a multivariate time series data model, which is then eventually handled by an LSTM architecture. This work is considered state-of-the-art now in this area.
Thus, in this study, we exploit an observation that not only the cycle-wise relationship during a lifetime of a battery, but also its internal channel-wise information. To realize this idea, we suggest a novel architecture, known as sequence-in-sequence (seq-inseq) model, where the battery energy is analyzed during two nested sequences, including local sequence and global sequence, which reflect the channel-wise and cycle-wise information respectively. Moreover, we also present a combined architecture of Bi-LSTM [10] and Autoregression [11], applied in each local and global sequences, to better represent their sequential relationships in different views, resulting in our ultimate model, socalled BiAR-SeqInSeq.
In the rest of paper, we summarize preliminaries in Section 2. The overall architecture and details of BiAR-SeqInSeq model are given in Section 3. Section 4 discusses our experimental results when verifying our model with real NASA battery dataset. Finally, Section 5 concludes the paper.

Charge Cycle of a Lithium-ion Battery
In common working conditions, a LIB lifetime spans up to 2-3 years or equivalently, 300-500 charge and discharge cycles. In the prior cycle, LIB internal channels (current, voltage, temperature) vary and LIB capacity increases gradually to reach a fully-charged state. This charge cycle can be roughly divided into 2 separate periods: Constant Current (CC) one with gradually increased voltage and Constant Voltage (CV) one with gradually decreased current, as depicted in Figure 2. A charge cycle starting with CC period as the current is kept unchanged while voltage is gradually increased. By the end of CC period, the charge cycle is continuously controlled under CV period as the current is gradually decreased and the voltage remains stable. This CC-CV process is completed when the current reaches a threshold constant value [12]. The battery then goes for a later discharge phase to accumulate SOH.
In [4], there are 5 crucial features that can be extracted during this CC-CV process to infer battery lifetime as follows ( Figure 2).  Obviously, those x 1 values are usually unstable considering many different cycles. Moreover, x 1 is taken in the non-sampling area [5] and its value practically plays a very small impact on the output. Therefore, in this study, we will ignore x 1 contribution in the calculation. The other 4 values x 2 , x 3 , x 4 , x 5 are encoded as cycle-wise data to predict the battery SOH, as subsequently discussed.
Additionally, we also adopt the information of peak status, which represents that the SOH value of the current cycle is staying at the peak comparing to its neighbour using z-scores or not [13] as a cycle-wise information, alongside with the C f ull information of the considered cycle.

A Baseline Sampling-based Model
Obviously, current and voltage are essential in the learning model to predict battery lifetime or SOH. However, these values are continuous and one would naturally consider sampling them. In [2], temperature values are additionally sampled at these timepoints to create multi-channel input for their prediction. Those attributes of current, voltage and temperature introduce channel-wise information of a LIB. Figure 3 depicts the channel-wise raw values of a battery. Moreover, in [5], the authors proposed 11 important timepoints in a charge cycle to extract the sampling current, voltage and temperature as depicted. The authors explained the need to maintain important data points which carry the shape of the derivative ΔVoltage (V) at 11 positions in the charge cycle. Those 11 points of corresponding to the 35 th , 52 th , 70 th , 88 th , 90 th , 92 th , 94 th , 96 th , 98 th , 99 th , 100 th produce the corresponding sampled channel-wise data. Figure 4 illustrates how channel-wise data are encoded in [2]. The sampled values of voltage V j , current I j and temperature T j at the above mentioned 11 data points are formed together as 11 The authors also use the C j , which is the SOH value at the j th cycle, as other additional information in their final encoded feature vectors of a cycle. The features vectors of the past cycles are then fed into a LSTM model to make the prediction for the next cycle, as subsequently discussed. In our study, we consider this model as the baseline model in our subsequent experiments.

Long Short-Term Memory
As discussed, these sequences of feature vectors over cycles will be used to train LSTM [14], which is virtually a sequence of multiple logical cells, unfolded from a physical cell. Figure 5 presents an architecture of a basic LSTM cell, which was introduced in [14]. LSTM is in fact an upgraded version of Recurrent Neural Network (RNN) [15]. At the time t, this network will produce output y(t) from the input x(t). However, the output of this network at the previous iteration will also be used as part of the input of the next step, or recurrent input, together with new actual input. In the standard LSTM model, processing information is more complicated when modules containing computational blocks are repeated over many timesteps to selectively interact with each other in order to determine what information will be added or removed. This process is controlled by three gates namely input gate, output gate, and forget gate. Controlling the flow of information inside an LSTM model can be described as the following mathematical equations: Figure 5. A basic LSTM cell [14].
In Eq. (1) -Eq. (5), i, f , o, (C), h denote input gate, forget gate, output gate, internal state, and hidden layer, respectively. Here, W i ,W f ,W o ,W C , and b i , b f , b o , and b C represent the weights and bias of three gates and a memory cell, in the order given. Concretely, the activation function sigmoid helps an LSTM model to control the flow of information because the range of this activation function varies from 0 to 1 so that if the value is 0 then all of the information will be cut off, otherwise the entire flow of information will pass through. Similarly, the output gate will allow information to be revealed appropriately due to the sigmoidal activation function then the weights will be updated by the element-wise multiplication of output gate and internal state activated by non-linearity tanh function.
In the LSTM neural network architecture proposed by [2], input vector x i at each timestep is feature vector of each cycle as described above. This LSTM architecture uses L previous cycle to predict C f ull of next cycle. As discussed, this work has enjoyed the best performance so far in terms of SOH prediction.

The BiAR-SeqInSeq Model
In this section, we present our proposed BiAR-SeqInSeq model. For the sake of convenience, technical details of our model is presented in separate subsections. Firstly, we present the Autoregression technique. Then, we present our feature encoding strategy for each charge cycle as the premise for our next discussion about the sequence-in-sequence bidirectional architecture. Finally, we present how to combine these techniques into our ultimate model.

The Autoregression Technique
In statistics, econometrics and signal processing, an Autoregression (AR) model is a random process, which specifies that the output variable depends linearly on its own previous values and on a stochastic term. Thus, the model can be considered as a form of a stochastic difference equation evaluated on the values from the past.
In general, given the value C k+1 ,C k+2 , ...,C k+L where C j is the value the j th timepoint and C k+L the current time, the value of the next value C k+L+1 can be evaluated as Eq. (6) where c is a initial constant (or bias), ϕ j is the corresponding coefficient of C k+ j and ε k+L+1 is a random noise. There are different methods to evaluate ϕ j , one of which is to approximate them by means of a neural network, as we further discuss and apply in our works.

Cycle Encoding
Extended from [2], we rearrange 3 channel information inside each cycle into 11 vectors ξ j = (V j ,C j , T j ); j = 1..11, corresponding to 11 sampling time steps as illustrated in Figure 6. Additionally, in each cycle, we also additionally extract an encoded vector E V = (x 2 , x 3 , x 4 , x 5 , peak,C), where the meaning of x 2 , x 3 , x 4 , x 5 , peak,C are already discussed in Section 2.1. ξ j and E V will be used in our sequence-in-sequence training mechanism in later discussion.

Bidirectional Seq-in-seq Training Strategy
With feature vectors described above for each cycle, the features are encoded as the input using the sequence-in-sequence mechanism to train our predictive model as illustrated in Figure 7. We call this mechanism sequence-in-sequence because the gradients flow through two nested sequences during the training phase: local sequence and global sequence, or channel-wise and cycle-wise sequences.

Bidirectional LSTM
In both channel-wise and cycle-wise sequences, data-points are trained in forward and backward directions between time steps, hence the name bidirectional. Recall that in [2], the author used LSTM architecture to learn from sequential data.This LSTM is unidirectional, which reads input data from left to right order. In this research, we use another variation of LSTM, known as Bidirectional LSTM, or Bi-LSTM [10] to better capture sequential relationships in each sequence. As illustrated in Figure 7, Bi-LSTM neural network composed of two independent LSTM networks in opposite directions, w.r.t the order of the input data-points. The output hidden vectors to those LSTM manner are then concatenated in a cell-wise manner, producing the final output of the Bi-LSTM network.

Channel-wise sequence
Channel-wise sequence is equivalent to a Bi-LSTM neural network whose input are 11 vectors ξ j = (V j ,C j , T j ); j = 1..11 above discussed. The final output of this Bi-LSTM is then concatenated with the vector E V = (x 2 , x 3 , x 4 , x 5 , peak,C) as the final output of this processing step. We denote this result vector as a channel-wise feature vector V j cw .

Cycle-wise Sequence
Cycle-wise sequence is also a Bi-LSTM neural network, whose inputs are channel-wise feature vectors V j cw , ( j = 1,..,11), encoded from L = 11 consecutive cycles in the past, after processed in the channel-wise sequence step. The final output of this global BiL-STM, denoted as V FC , will flow through a fully connected layer to predict SOH of the next cycles. Figure 8 captures our ultimate model, in which bidirectional seq-in-seq architecture is combined with Autoregression technique to improve prediction results. We enhance our prediction by combining the two results from two computational branches, known as Non-linear Branch and Linear Branch, whereas Non-linear Branch output is the above mentioned V FC , now is referred as C non linear . Meanwhile, in Linear-Branch, we apply Autoregression on the SOH values of the L processed cycles (C k+1 ,C k+2 ,..,C k+L ) to obtain the C regression result (Eq. (7)). Finally, the C non linear will be added up C regression based on the trainable combined parameter as the below Eq. (8). C k+L+Q = βC non linear + (1 − β )C regression (8) As discussed, the weights ϕ j and β are trainable parameters optimized in the training of the whole model to achieve the best prediction performance.

Experiments
In this section, we describe the experiments to confirm the performance of our proposed BiAR-SeqInSeq model. The datasets of 4 NASA batteries and the cross-validation techniques used in [2] are inherited. The quantitative comparisons will be given as below.

Dataset
Dataset used in this research are provided by NASA [16], including 4 batteries named B0005, B0006, B0007, B0018. The first three battery modules provide full 168 cycles (charge and discharge) and the last B0018 123 cycles. These dataset specification is presented in Table 1. Test conditions of these batteries are presented in Table 2. We used all 4 batteries historical data to develop the models, in which 80% of the dataset was used for training and the remaining 20% was used for testing.

Evaluation results
In our experiments, we develop the following models.
• LSTM-based Multi-Channel Prediction [2]: As discussed, this is the current SOTA performance of SOH estimation problem. • LSTM-based Multi-Channel Prediction: based specifically on [2], apply basic fine-tuning and noise-removal techniques to record the output. We have no seq-inseq and cycle-wise features in this experiment. • Con2DLSTM: Another additional model we develop for experiment. This architecture uses 2D CNN to extract cycle features and use LSTM to predict [17]. • Bi-SeqInSeq NoAR: similar to above BiLSTM-seq-in-seq-Autoregression but without Autoregression is applied. • BiLSTM-seq-in-seq-Autoregression (BiAR-SeqInSeq): This is the model we presented.
Experiments results are summarized in Tab. 3. We can see that the baseline LSTMbased Multi-Channel [2] method is still outperforming deep-learning based time series analysis methods such as its baseline. However, models Conv2D LSTM and Bi-SeqInSeq results even better than the baseline due to their capability to capture both local features and global features. Besides that, Autoregression technique helps to coordinate channel-wise and cycle-wise information most reasonably by trainable parameters learnt by back propagation mechanism when training the end-to-end model, which also significantly contributes to our best performance enjoyed. The experiment result on Tab. 3 shows that the overall loss is reduced approximately 10% from 0.030 (reported in [2]) to 0.027 ((0.030-0.027)/0.030 = 10%) compared between LSTM-based Multi-Channel to BiAR-SeqInSeq. Moveover, if we compare with the result of the same method re-implemented and worked on the same data set, the loss is reduced from 0.040 (LSTM-based Multi-Channel) to 0.036 (Bi-SeqInSeq NoAR, reduce ((0.04-0.036)/0.040 = 10%) and to 0.027 (BiAR-SeqInSeq, reduce ((0.040-0.027)/0.040 = 32.5%), which are significant.

Conclusion
We have proposed some set of improvements on a SOTA method in Lithium-ion Battery SOH prediction using LSTM-based deep learning model. Based on the deep study of LIB data, we have developed a sequence-in-sequence advancement. Moverover, thanks to the dependency on cycle-wise SOH time-series, we keep the Autoregression portion to play its role in final prediction.
The improvements originate from the deep understanding of the nature seq-in-seq in LIB data. Before our study, the existing LIB researches have not fully investigated the dependency. Therefore, we create deep improvement on the outcome. The experiment result shows that the proposed method creates improvement in almost all cases and the ultimate model BiAR-SeqInSeq definitely gave significant improvement.
From the promising result presented, we will continue data-driven investigation, applying more natural enhancements into the model. The current method, still, shows some shortcomings at the discrete 11 datapoints sampling approach. Moreover, the extracted features have room to apply an attention mechanism. As presented in [18], the attention model can extract the sequence contribution and prioritize the features contribution into the final output. We will apply the above ideas into our future research.