Machine Learning Benchmarks for the Classification of Equivalent Circuit Models from Electrochemical Impedance Spectra

Analysis of Electrochemical Impedance Spectroscopy (EIS) data for electrochemical systems often consists of defining an Equivalent Circuit Model (ECM) using expert knowledge and then optimizing the model parameters to deconvolute various resistance, capacitive, inductive, or diffusion responses. For small data sets, this procedure can be conducted manually; however, it is not feasible to manually define a proper ECM for extensive data sets with a wide range of EIS responses. Automatic identification of an ECM would substantially accelerate the analysis of large sets of EIS data. We showcase machine learning methods to classify the ECMs of 9,300 impedance spectra provided by QuantumScape for the BatteryDEV hackathon. The best-performing approach is a gradient-boosted tree model utilizing a library to automatically generate features, followed by a random forest model using the raw spectral data. A convolutional neural network using boolean images of Nyquist representations is presented as an alternative, although it achieves a lower accuracy. We publish the data and open source the associated code. The approaches described in this article can serve as benchmarks for further studies. A key remaining challenge is the identifiability of the labels, underlined by the model performances and the comparison of misclassified spectra.


Introduction
Processes inside lithium-ion batteries (LIBs) and other electrochemical devices occur at different timescales [1].In LIBs, lithium ions are shuttled between positive and negative electrodes, via the electrolyte and separator, mostly through diffusion processes.The kinetics during this transition vary due to differences between lithium-ion diffusion coefficients in liquids (electrolyte) and solids (positive/negative electrode active materials), which give rise to the different timescales mentioned.One method for monitoring the various responses of electrochemical systems over different timescales is Electrochemical Impedance Spectroscopy (EIS), a non-invasive technique that uses AC voltage or current signals over a spectrum of frequencies to excite processes within the electrochemical system.These spectra can thus facilitate the evaluation of electrochemical systems [2], such as batteries [1,[3][4][5], fuel cells [6], supercapacitors [7], corrosion [8], or biological systems [9].For batteries, particular research areas exploiting EIS are Equivalent Circuit Model (ECM) characterization [3], blocking electrode experiments to investigate purely ionic or electronic behaviors [10], diffusion processes modeling [11], characterization of porous electrodes [12], electrode characterization via transmission line modeling [13], and monitoring of cell performance [14].However, to analyze these spectra and to assign a specific mechanism such as electronic resistance, charge-transfer, mass transport, etc., electrochemists usually employ ECM to represent the different physicochemical processes in the battery by parameterizing them in terms of electrical circuit elements such as inductance, resistance, capacitance, or a combination of them.Defining the structure of an ECM generally requires expert judgment, meaning that evaluation of a very large number of EIS measurements is a difficult process to automate.
As in many other scientific and engineering fields, Machine Learning (ML) methods have become popular in the area of electrochemistry to accelerate data analysis or modeling tasks, especially for large data sets.For example, ML methods have been used successfully for predicting the remaining useful life of batteries both in laboratory environments [15] as well as in deployed systems [16].Furthermore, machine learning methods gained popularity during the last years for analyzing spectral data such as FTIR spectra [17,18], Raman spectra [18][19][20], X-ray diffraction spectra [21], and EIS data [14,[22][23][24][25][26][27].Recent developments include Bayesian model selection for EIS data [28,29] based on fast Bayesian inference using quadrature [30].[31] Further development of software tools and ML methods for analyzing impedance data can be accelerated by the publication of open-source software libraries and data sets.There exists open-source software to analyze EIS data (e.g.[32,33]).However, there is still significant potential and need for analysis software and machine learning approaches to be shared and published open source.The situation is similar for data.Various data sets are available [14,27,34,35], but the total amount of open data is still small compared to the wide range of applications and the diversity of EIS data that arises from those.So, this article aims to contribute to the growing body of open-source battery data and software.We focus on using ML methods to accurately classify the latent ECM.With this article, we share a large synthetic EIS data set with the associates ECMs and an unlabeled data set consisting of synthetic and measured data, both provided by QuantumScape (QS) for the international BatteryDEV hackathon to attract a variety of researchers and source interdisciplinary solutions for the problem of ECM identification.
BatteryDEV Hackathon The machine learning approaches described in this article were partially developed during the one-week open-source BatteryDEV hackathon in March 2022.However, additional approaches were developed afterward, and the existing work was refined for this article.This publication makes the data and the code publicly available.The BatteryDEV hackathons were started by its host organization Battery Associates to foster innovation in the battery space.The first BatteryDEV hackathon took place in January 2021, and the second iteration in March 2022.The BatteryDEV hackathons receive support from industry and academia, as described in the acknowledgments.Within the context of batteries, the objectives of BatteryDEV are to (1) increase global collaboration involving data across sectors, (2) encourage the development of open-source solutions for analyzing data, and (3) provide an opportunity for hands-on training to grow the pool of global talent.For BatteryDEV 2022, there were 140 registrations, 85 people joined the hackathon, and there were submissions from 60 participants.There were registrations from more than 20 countries, and participants included Data Analytics, ML, Battery, and Energy Materials experts from industry and academia, many participating in interdisciplinary teams.The need for more openly available data sets in the battery space is widely accepted [36,37].Hackathons can accelerate innovation and have been shown to yield exciting results in other fields [38].This article is organized as follows.Section 2 describes the EIS data set provided by QS.Section 3 defines the purpose and the challenges of the hackathon.Section 4 reports the approaches followed by Section 5 for discussion of other ideas and Section 6 outlines the paper conclusions.
The EIS data set, Z, associated with this article was created by QS.It comprises approximately 9,300 synthetic impedance spectra, z ∈ Z that are vectors of impedances, z ∈ C n .Furthermore, the data set includes the generating ECM types.No noise was added to the data.The parameters of the ECMs were drawn from independent reciprocal distributions, except for the time constants, which were drawn from uniform distributions.Furthermore, it was ensured that the time constants of the RC elements are significantly different for each impedance spectrum associated with the RC-RC-RCPE-RCPE circuit, i.e., max({τ 1 /τ 2 , τ 2 /τ 1 }) > 10.The parameter bounds and frequency ranges are informed by the solid-state battery R&D of QS.Furthermore, QS shared an unlabeled data set containing 80% synthetic and 20% measured data, which is also made available but not analyzed in this article.Information about how to access the data can be found in the data sharing section.
Table 1 illustrates the nine classes of the predefined ECMs.A hyphen denotes series connections, and a combination of two elements denotes a parallel connection.Each parallel connection has only two branches, each consisting of one element.The name in parenthesis is a shorthand notation.The number of impedance spectra in parenthesis is the number of spectra prior to filtering out spectra that met filter criteria described in the Supplementary Information Sec.A.1.These criteria remove spectra that are either unphysical or unlikely to represent a physical battery or both.However, for completeness, we include results for the filtered and unfiltered data in Tab. 4. All other results correspond to the filtered data.Table 2 states the six circuit elements, names, number of parameters, and equations for each of the elements which form the ECMs in Table 1.
Figure 1 shows four example spectra with different corresponding ECMs.The Bode plot on the left of each subplot shows the magnitude in black and the phase shift in green.The Nyquist plot shows the impedance response to each frequency used to excite the system, with each data point in the Nyquist plot corresponding to a distinct frequency; note that a Nyquist plot alone without frequency labeling does not show the data fully, as all detail of the frequency dimension is lost.The values in the Nyquist plot with a small absolute value correspond to the higher frequencies.Freq.
[Hz] shows the magnitude in black and the phase shift in green.The Nyquist plot on the right of each subplot shows the impedance response to each frequency used to excite the system, with each data point in the Nyquist plot corresponding to a distinct frequency.The dots are experimental recordings, and the lines are from equivalent circuit models using circuits and parameters provided by QS.

Data Preprocessing
The range of frequencies and the number of measured frequencies vary widely between the spectra of each circuit class (c.f., Supplementary Information, Figs.A.3 and A.4).The frequency ranges and ranges of the number of measured frequencies are the same for all circuits.Choosing specific frequency ranges is standard practice, depending on the underlying battery's characteristics and the scope of the EIS-based investigation [1,39].We interpolated the real and imaginary impedance vectors for every EIS spectra at n = 30 logarithmically spaced frequencies across the common frequency basis, ranging from 10 1 Hz to 10 5 Hz to obtain consistent data for feature design and machine learning.This limited frequency range may neglect certain features, especially at lower frequencies.Another possible approach would be to rescale all frequency ranges to a common vector, though this would lead to further issues since many circuit parameter values are dependent on frequency.

Data Visualization
Visualization of a large number of impedance spectra is difficult.For this data set, a particular challenge is the distribution of parameters over orders of magnitude, resulting in spectra that also span orders of magnitude.Figure 2 visualizes the spectra associated with each circuit class by rescaling them.
This normalization approach yields Re(z j ), Im(z j ) ∈ [0, 1] but leads to the loss of the information contained in offset, magnitude and magnitude ratio | Re(z i )|/| Im(z i )|.As a consequence, the slope associated with mainly linear spectra is lost, resulting in many spectra that are close to the diagonal of the associated subfigure in Fig. 2, but might look very different when plotted without rescaling.While Fig. 2 does not show any frequency information, it shows the shape Rs_Ws of the spectra associated with each circuit.The L-R-RCPE and Rs-Ws circuits have shapes that differ significantly from the other classes.Furthermore, the shapes are increasingly diverse, with an increasing number of RC and RCPE elements.Another critical observation is that a significant overlap of shapes can be observed with semi-circle-shaped and linearly-shaped spectra in all classes, indicating potential classification issues.
Visualizations of the data set in lower dimensions with Uniform Manifold Approximation and Projection (UMAP) are included in the Supplementary Information (B).The UMAP analysis shows a significant overlap of spectra between different classes.The amount of overlap, however, depends on the classes that are compared.The fact that UMAP didn't find a lower dimensional manifold that separates the spectra associated with different ECMs well indicates that the supervised learning problem on this data set is challenging, further supporting the intuition gained from Fig. 2.

The Challenge
The purpose of the EIS challenge of the hackathon was to automate the classification of appropriate ECMs based on the data set.In particular, the challenge was to create a model that could predict the ECM class in the test data set as accurately as possible.In this article, we use the F1-score's weighted average to compare the results of the classification task.We also report the unweighted F1-score's average and the unweighted and weighted average of the recall.
In addition, the automation of guesses for ECM parameters was part of the challenge.The guess of the parameters does not need to yield a perfect fit but should be a good initial starting point for more traditional parameter optimization.Due to the difficulty of the classification task, this article focuses entirely on the classification.The Supplementary Information of this article contains more information about parameter estimation and suggests a machine learning approach.
Code for reading the data file, basic EIS modeling, and plotting of EIS models versus the recorded data points was provided to the participants to accelerate their efforts.The EIS model and parameter scoring code are also included in the package so participants can easily self-assess their work.This code can be found in the GitHub repository associated with this article.As well, participants were given examples of how to install the required code environment -Python, Jupyter, and the SciPy stack -using Docker, Anaconda, or Poetry.Jupyter Notebooks containing examples of how to implement the provided code for reading, modeling, plotting, and scoring were provided.

Classification approaches
This section presents the different classification approaches.The models and their performance was studied using a random 80% train split.The prediction accuracies are subsequently reported on the remaining 20% of the data that was held out for testing.

Random Forest: The baseline model
Reliable baseline models are essential to quantify performance gains from more complicated models.For example, Linear Discriminant Analysis (LDA) and Quadratic Discriminant Analysis (QDA) are linear, static classification methods traditionally used for analyzing chemical systems or spectral data.However, these methods do not perform well in classifying EIS data due to the nonlinearity of the task (cf.Here, we present a Random Forest (RF) model that learns from the raw spectra that were preprocessed to a uniform frequency range according to Section A.2. Furthermore, the spectral data is arranged in a matrix format: ) where f i (ω j ) denotes the impedance corresponding to the frequency ω j of a battery with the index i, and Im and Re denote the real and imaginary parts of the impedance, respectively.Each spectrum was scaled by dividing through its maximum real impedance to achieve a consistent scale without decoupling the scale of the real impedance from the scale of the imaginary impedance.
The hyperparameter optimization of the RF was carried out with extensive cross-validation.Further details and parameter ranges can be found in the associated code.
The resulting confusion matrix of the test data in Fig. 3 showcases that most classes are separated well from one another.However, the model struggles to differentiate between the L-R-RCPE, L-R-2RCPE, and L-R-3RCPE circuits.Similarly, the model struggles to distinguish between the 2RCPE, 3RCPE, and 4RCPE models.These errors are physically sensible, as multiple RCPE elements are often used to fit overlapping peaks.Determining the number of RCPE elements required to accurately fit the data without overfitting is a key challenge when analyzing EIS data [40].However, ECM types that should be qualitatively much different from one another, such as L-R-nRCPE circuits and R-Ws circuits, are rarely confused.The best-performing solution treated each EIS spectrum as a multivariate time series, using the log of frequency as a proxy for time.Classification of time series data often uses engineered features to extract information from the raw data, such as the linearity of the trend, the number of obvious peaks, or the magnitude and phase of periodic fluctuations in the data.To simplify the procedure for proposing possible features and developing methods to extract them, the Python library tsfresh was used [41].This library extracts hundreds of possible features from time series data and then uses hypothesis testing to remove irrelevant features prior to model training.The data preprocessing documented in Sec.A.2 ensured that all impedance data were evenly spaced with respect to the log of frequency; many of the features generated by tsfresh assume that data points are evenly spaced in time.The model architecture used was a gradient-boosted tree implemented by the extreme gradient boosting (XGBoost) model architecture, chosen for its high performance in many data science tasks often even without needing substantial hyperparameter optimization or domain expertise [42].We optimized the hyperparameters with random search, yielding minor improvements over the model using the default hyperparameters.
Figure 4 shows the confusion matrix for the predictions on the test set.As noted in the explanation of the data set, there are clear groups of equivalent circuits that are similar to each other, with L-R-nRCPE circuits being easily confused between them but almost never confused with data labeled as R-Ws or RC-G-G circuits, similar to the results of the baseline random forest model but with better performance.The confusion matrix in Fig. 4 shows a clear improvement over the baseline model (Fig. 3), however, qualitatively, the confusion is similar.
Feature importance for the XGBoost classifier model after generation of time series features using tsfresh is investigated using SHapley Additive exPlanations (SHAP) [43].Figure 5 shows the sum of the average SHAP values for all classes for the top 7 features.Of the top 7 features, the importance to each class varies; for instance, the number of peaks in the imaginary impedance has very high importance, on average, for predicting the L-R-RCPE class but almost no importance for predicting the RCPE-RCPE-RCPE class.Another example is the R-value feature of the real impedance (ranked 1st) that has high importance for the diffusion-dominated ECM classes (RC-G-G and Rs_Ws) but little importance to all other classes.This agrees with the physical understanding of diffusion processes generating  approximately linear segments in the impedance spectra that are expected to be fitted well by a linear model.Many of the top 7 features are related to the shape of the impedance spectra.Examples are features related to the linear trend (ranked 1st and 7th) and the number of imaginary impedance peaks (ranked 2nd).A key takeaway from the analysis of SHAP values is that there are features that tend to be important for only one or two circuit types (e.g., features ranked 1st, 2nd, 3rd, and 7th), while other features are important for many circuits (e.g., features ranked 4th, 5th, and 6th).However, no single feature alone can classify all spectra accurately.Last, it should be noted that the SHAP values of the features are relatively close.For example, the mean absolute SHAP value of the 7th ranked feature is almost the same as the mean absolute SHAP value of the 4th ranked feature and the top 3 ranked features.Therefore, it is expected that relatively small changes in the data set can lead to shuffled rankings.Figure 6 shows SHAP values for every observation by class for each of the top 5 features in Fig. 5.This figure helps to explain model behavior in more detail.For instance, for the L-R-RCPE circuit, a high value for the number of peaks Table 3: Description of feature in Fig. 5 according to the tsfresh documentation [44].For more information, we refer to the tsfresh documentation that describes the individual functions that calculate the features.

SHAP Ranking
Feature Name Description, from [44] 1 zreal__agg_linear_trend__attr_"rvalue"__chunk_len_10__f_agg_"max" R-value of linear least-squares regression for values of the time series that were aggregated over chunks versus the sequence from 0 up to the number of chunks minus one, maximum value aggregation 2 zimag__number_peaks__n_1 Number of peaks of at least support 1 in the time series zimag 3 zreal__energy_ratio_by_chunks__num_segments_10__segment_focus_9 Sum of squares of chunk 9 out of 10 chunks expressed as a ratio with the sum of squares over the whole series zreal 4 zreal__ar_coefficient__coeff_1__k_10 First coefficient of an unconditional maximum likelihood of an autoregressive AR(k=10) process.5 zreal__ar_coefficient__coeff_0__k_10 Constant coefficient of an unconditional maximum likelihood of an autoregressive AR(k=10) process.6 zreal__minimum Lowest value of the time series zreal 7 zreal__agg_linear_trend__attr_"rvalue"__chunk_len_10__f_agg_"min R-value of linear least-squares regression for values of the time series that were aggregated over chunks versus the sequence from 0 up to the number of chunks minus one, minimum value aggregation in the imaginary impedance has a very large negative SHAP value.This reflects domain knowledge, suggesting that impedance spectra with multiple obvious peaks should have more than one RC or RCPE element and thus would not be modeled by the L-R-RCPE circuit.Similarly, Fig. 5 outlined that the RC-G-G and Rs-Ws circuits have a strong dependence on the linearity of the real impedance as mentioned previously.Note that the features plotted here may not necessarily correspond to the most important features for each class on their own; rather, we are just plotting the top 5 average features to simplify comparison.

Convolutional Neural Network: The creative approach
Convolutional Neural Networks (CNNs) are commonly used to analyze image data and can learn complex features and relationships.In the past, efforts using artificial neural networks to analyze large amounts of EIS data, without humans having to choose initial parameter values for the equivalent circuits, have been employed.Buteau and Dahn used an inverse model parameterized with a convolutional neural network over a data set containing 100,000 impedance spectra [40].Rastegarpanah et al. [45] developed a rapid neural network starting with a single hidden layer baseline model, optimized by a Gaussian process hyperparameter scheme, to estimate the state of health of Nissan Leaf 2011 battery modules using a data set of 106 samples.
Here we present a CNN model for classifying ECMs.This approach is motivated by the fact that experts also look at impedance spectra visually because the shape of a spectrum is essential to determine an appropriate ECM.Furthermore, the SHAP feature analysis in Sec.4.2 showed that features related to the shape of the impedance spectra are important for ECM classification.The preprocessed impedance spectra were visualized in a Nyquist plot.The x-axis corresponds to the real part and the y-axis to the imaginary part of the impedance.Figure 7 shows a small subset of the generated Figure 7: Different EIS spectra interpolated to a common frequency range visualized in a Nyquist plot.
images.Each spectrum can be interpreted as a battery's signature.While many spectra look very different, similar patterns can be identified.There are similarities between the EIS images and the MNIST digit classification data set for which many proven, easy-to-use architectures exist.For a proof of concept CNN, we decided on a simple network that yielded a high performance on the MNIST data set [46].We modified the kernel and stride sizes of the first layer to account for the image resolution and structure.To keep training time low, we used a resolution of 56×56 pixels.
The confusion matrix shown in Fig. 8 shows a similar pattern to Figs. 3 and 4. The F1-score of 0.33 is lower than for the other models.Nevertheless, this result is a promising proof of concept, given that the network was only slightly adapted, and the frequency and magnitude information is not considered.The same CNN architecture was tested using images with colored lines encoding the frequency information.However, the F1-score improvements were not statistically significant.This suggests that the model with the tested architecture cannot account for the frequency information.How to incorporate the frequency and magnitude information into the model and how to design suitable CNN architectures for classifying ECMs remain open questions.
Lessons from a Transfer Learning Approach Transfer learning in the context of (deep) neural networks refers to using a network with a defined architecture that was trained on one data set for another somehow related application.The idea is that the embeddings learned by the network will also be helpful for the new task.During the BatteryDEV hackathon, a transfer learning approach based on the MobileNetV2 architecture was suggested, see Supplementary Information (D).However, this approach was not (yet) successful.The computational costs to handle a deep network  like MobileNetV2 are high.Consequently, it is costly to experiment and tune the model.Furthermore, the original training data of the MobileNetV2 were color images of objects, and the resulting embeddings generated by the layers close to the final layer of the network, do not work well to classify EIS spectra.One explanation is that the statistics of (natural) images follow special distributions [47], which are very different from the sparse nature of the EIS data.Consequently, the embeddings learned from the training data of the MobileNetV2 do not suit the EIS classification task.
A possible solution for this issue would be to allow for retraining the parameters of the MobileNetV2.However, this is non-trivial given the small amount of fewer than 10k spectra and was thus not pursued further.

Comparison of Classification Results
The classification results show that the highest prediction accuracy was obtained by the tsfresh-XGBoost approach, clearly outperforming the other two models.However, the CNN approach was only investigated as a proof of concept, and there is still potential for further performance improvements.Furthermore, Tab. 4 shows that the models trained on the entire data set without filtering out any spectra performed slightly better than their counterparts that were only trained on the data that passed the filter criteria.First, many removed spectra were associated with the L-R-RCPE and Rs-Ws circuits (c.f.Tab.1).In addition, the filtered-out spectra are quite different from the other spectra.The models based on the entire data thus managed to classify them slightly better on average than the other spectra.However, the filtered-out spectra are mostly unphysical and unlikely to be observed from a real battery.Thus, the models based on the unlabeled data set picked up relationships that are not expected to generalize beyond this data set.
Predicted ECM Given ECM Although very different, the three investigated approaches share similar patterns in their confusion matrices (compare Figs. 3, 4, and 8).All approaches struggle to distinguish the L-R-RCPE, L-R-2RCPE, and L-R-3RCPE circuits.
Similarly, the classification methods struggle to distinguish the 2RCPE, 3RCPE, and 4RCPE circuits.Furthermore, there is high confusion between the L-R-3RCPE and 4RCPE circuit classes.The other combinations of L-R-nRCPE and nRCPE circuits also show higher levels of confusion relative to the combinations not mentioned here.A potential explanation is that the above-mentioned ECMs can generate similar spectra.Figure 9 supports this claim because many misclassified spectra show patterns that also agree well with other circuit types.For example, the spectra classified as L-R-RCPE but associated with RCPE-RCPE and those classified as RCPE-RCPE but associated with L-R-RCPE look similar to a human observer.Also, many of the misclassified spectra have a semi-circle shape which can be generated by different ECMs, hinting at potential identifiability issues.A key observation is that the patterns shared by the columns of Fig. 9 (i.e., the spectra that were classified to be associated with the same circuit) appear to be more similar than the patterns shared by the rows (i.e., the spectra that are associated with the same circuit).However, Fig. 9 suffers from the same drawbacks as Fig. 2 (i.e., loss of magnitude, magnitude ratio, and frequency information).

Discussion
While broad, this EIS data set does not represent the whole variety of impedance measurements observed from LIBs.
The fact that the underlying ECM parameters were drawn from independent distributions results in a data set containing spectra that are unlikely to be observed by a real battery or unphysical.While we addressed this drawback by filtering out spectra, we suspect spectra remain in the data set that would be unlikely to be observed during the R&D of new battery materials.Furthermore, certain parameter combinations of models with many parameters might generate spectra that could likely be modeled by simpler ECMs.
The choice of ECM classes and parameter bounds was informed by the R&D of solid-state batteries.The electrode materials generally used by solid-state and liquid-electrolyte batteries are similar; however, solid electrolytes' diffusivity measurements include grain-boundary and bulk diffusion effects, while liquid electrolytes have no grain-boundary effects, which can lead to differences in impedance spectra.Given the complexity of the systems to which ECMs modeling is typically applied, automating the parameterization of ECMs would be helpful to automate ECM modeling for non-experts or to process big data of impedance spectra.However, it is uncertain how well the trained models presented in this article would perform on different data sets, e.g., measured spectra from solid-state batteries or measured spectra from liquid electrolyte batteries.Nevertheless, the proposed approaches are flexible and can be used to learn from other EIS data sets.
A further limitation of this data set is that it limits the supervised learning problem to predicting one of the nine possible ECM types.A more generally useful result would be the generation of candidate ECMs in an unsupervised learning approach, which could then learn from data sets such as this to then propose useful ECMs on new systems.Furthermore, the model selection and its parameter estimation are preferably performed in one go, as the motivation of ECM analysis is to parameterize and quantify the raw impedance spectra to comparable variables.Although a classification suggests which model to select, it does not provide the parameter values or initial guess for its fitting process.
To this end, the second stage of the BatteryDEV hackathon was supposed to be the parameter estimation of ECMs.Still, the limited duration of the hackathon hindered the complete exploration of this direction.The parameterization was defined to estimate best-fit circuit parameters.Preliminary results of the regression task with the tsfresh-XGBoost approach and comparison to the parameters provided by QS are included in the Supplementary Information (C).Furthermore, a Bayesian inference approach was conceptualized; see Supplementary Information (E).

Conclusion
The EIS classification challenge led to the exploration and development of novel ECM classification methods.The presented approaches cut the time engineers spend on model selection for electrochemical impedance spectra, allowing them to focus on modeling and making better conclusions.The best-performing model used the tsfresh library to automatically calculate features of the impedance spectra and an XGBoost model for the classification of EIS spectra into the appropriate ECM class.The RF model based on the raw spectral data performed slightly worse.The CNN approach showed that CNNs can classify EIS spectra.However, challenges remain to apply CNNs to accurately classify impedance spectra.Future studies can refine and build upon the techniques and benchmarks described in this article.
With this article, we publish the analyzed data set of 9,300 impedance spectra provided by QS.The software and data for this article are available as open source in the corresponding GitHub repository.This work demonstrates how companies can contribute to and leverage open-source innovation.We hope that work will pave the way for more such collaborations.

Data and Code Availability
The data and code are available on the corresponding GitHub repository: https://github.com/BatteryDEV/AutoECM.QuantumScape (QS) provided the EIS data contained in the repository.The first data set comprises approximately 9,300 synthetic spectra with the associated Equivalent Circuit Model (ECM).The second data set contains approximately 19,000 unlabeled spectra consisting of about 80% synthetic and 20% measured data.The parameter ranges for all synthetic data are informed by the R&D of QS.The measured spectra are from a range of 13

B Visualization of Nonlinear Dimensionality Reduction
Data visualization through dimensionality reduction helps to understand the data's structure which can be challenging to observe directly.Figure B.1 shows the entire data set after dimensionality reduction to just two components using UMAP [1] to empower visualization of the entire data set on a single axis.Because the components for each circuit type substantially overlap, the components for each circuit type are plotted as a binned hexagonal grid.Overall, the color-coded shape of the reduced dimensionality space is horseshoe-like, and several trends are visible across the circuits.Some circuits show higher density across the outside edge of the horseshoe (e.g., L-R-RCPE-RCPE), and others show higher density on the inside edge of the horseshoe shape (RCPE-RCPE-RCPE-RCPE).Various circuits are more obviously separable by the side of the horseshoe, with RC-G-G, RC-RC-RCPE-RCPE, and Rs-Ws circuits having almost no samples on the higher right side of the horseshoe and dense clustering on the higher left and the 4 L-R-RCPE-RCPE-RCPE circuit having almost no samples on the upper left side of the horseshoe.The L-R-RCPE circuit has a very high density at the upper right corner and very few spectra associated with the rest of the horseshoe.
Other circuits show similar trends as those discussed, but overall, the clustering problem presented by this data set appears challenging and nonlinear.The overlap of component values after UMAP dimensionality reduction across all circuit types indicates that the EIS measurements are not clearly differentiated by their ECM label, and so identification of the correct ECM label in this supervised learning problem may not be possible to achieve with high accuracy.To help distinguish the density of points, each axis is plotted as a binned hexagonal grid, where bright regions correspond to high bin counts and dark regions correspond to low bin counts.UMAP is conducted after data frequency range preprocessing.

C Regression model
An additional challenge of the hackathon was parameter estimation.While it was suggested that the finetuning of ECM parameters should be done with the scipy optimization framework curve_fit, the reliable suggestion of initial circuit parameters is essential.
In the following, we present machine learning results based on a supervised approach.The results mentioned in this section are based on the original data set without filtering out any spectra as it was provided for the hackathon.We present it mainly to outline challenges and inspire others to develop new approaches.A key challenge is that the values of ECM parameters used to generate the spectra differ by several orders of magnitude because they were mainly drawn from reciprocal distributions.This variation of parameter values across many orders of magnitude makes model training very difficult.The distribution of the values for all of the parameters for any given circuit model may be distributed non-normally.This intuition was validated by training regressors using the tsfresh-XGBoost pipeline and comparing it with a median dummy model.Here we use the same 80%/20% train/test split as used for the classification model.Separate models were trained for each circuit model, and multiple parameter values for each circuit model were predicted using the MultiOutputRegressor from sklearn.Comparing this broad set of predictions, the dummy model often performed substantially better on the test data than the tsfresh-XGBoost pipeline.
Several methods for normalizing the distributions of the target variables were attempted: logarithmic transform, Yeo-Johnson power transform, and quantile transform using ten quantiles.Only the quantile transformation performed reliably better than the dummy model across the circuit types and parameters.Table C.1 reports mean absolute errors for regression models using the dummy model, the tsfresh-XGBoost model without any target variable transform, and the tsfresh-XGBoost model with quantile target transformation are reported for each circuit type and each parameter on the test split using.
Furthermore, the results of the tsfresh-XGBoost models with and without quantile transformation change with changing random seed, suggesting that the regression task is brittle, i.e., minor changes in features and model can lead to considerable changes in prediction accuracy.The results in Tab.C.1 showcase thus only trends and difficulties with this task.Another question is how well the predictions perform as initial guesses in the subsequent ECM parameter optimization.Further investigation and improvements or novel approaches are needed to tackle the abovementioned challenges.During the BatteryDEV hackathon, one team employed the MobileNetV2 architecture, available as part of the TensorFlow-Slim model library.MobileNetV2 is a neural network architecture with a lower computational cost at deployment relative to other CNNs with similar performance.It has been widely used for mobile and embedded vision applications.This neural network works based on a depthwise separable convolution, which has two steps.In the first step, a depthwise convolution is applied to the input layer, whose output acts as an intermediate set of values that will be the input of a second step, which consists of a pointwise convolution [2].
In this case, we used interpolated Nyquist plots obtained from the data set as the input layer for the MobileNetV2, as seen in the first layer of The preprocessing step of this approach was similar to that described in Section A.2 for the XGBoost model.The spectra were interpolated to the shared frequency range (10 1 Hz -10 5 Hz).In addition, as the main reason to use a deep learning CNN approach is to extract features from images, we constructed Nyquist plot figures (with real impedance at the x-axis and imaginary impedance at the y-axis) with an added color feature that could represent the associated frequency (ranging from yellow tones for high-frequencies to violet tones for low-frequencies) as can be seen in the example Nyquist plots in Fig. D.1.Finally, all the images were created in the same size of 128×128 pixels.
Some potential reasons for this CNN approach's low and fluctuating accuracies compared to the other methods explored in this article could be the use of a scattered Nyquist plot instead of solid lines because it could make it harder for the CNN to extract features of the images.In addition, another challenge with colored images is to have all the RGB information in a unique image; some authors have proposed an alternative approach to enhance the performance of CNN approaches.This alternate method involves achieving augmentations in the color space of the channels.Separating a channel of a certain color -such as Red, Green, or Blue -is a simple way to encode information in color [3].Furthermore, the architecture of CNNs, can be sensitive to the thickness of the line or dots that represent the EIS spectra.Last the embeddings/features that we hope to extract from the CNNs are very supposedly very different from those of the original image classification task of the MobileNETV2.Last, the amount of data that was available during this competition might not be sufficient to learn these features reliably.

E Bayesian Approach
The following Bayesian approach was not implemented during the hackathon and is presented here as an idea for future work.Future development in this direction is also desired as it can answer the regression and classification tasks in an unsupervised manner.Other metrics can be adopted to overcome this, such as Occam's razor [4], which can be computed as marginal likelihood with the Bayesian paradigm.
Bayesian inference In the context of Bayesian inference, the objective can be formulated as a parameter estimation task with y noise ∼ N (y; 0, σ n ), (6) y = ECM(X) + y noise , (7) (x) = N (y * ; y, σ n I), Z = (x)π(x)dx, (10) where X is the parameter of the ground truth, y is the observed EIS, σ n is the experimental noise variance, I is the identity matrix, (x) is the likelihood, π(x) is the prior, p(x|y) is the posterior, and Z is the model evidence.Therefore, the estimation of the parameter is the same as inferring posterior in Eq. ( 9).The classification criterion is given by the model evidence in Eq. (10).Such inferences can be simultaneously made with nested sampling [5] or Bayesian quadrature [6][7][8].However, inferring the evidence from 10,000 models is computationally expensive.Bayesian quadrature can help to perform such inference tasks.

Figure 1 :
Figure1: (a)-(d) four selected electrical impedance spectra from the data set.The Bode plot on the left of each subplot shows the magnitude in black and the phase shift in green.The Nyquist plot on the right of each subplot shows the impedance response to each frequency used to excite the system, with each data point in the Nyquist plot corresponding to a distinct frequency.The dots are experimental recordings, and the lines are from equivalent circuit models using circuits and parameters provided by QS.

Figure 2 :
Figure 2: Visualization of normalized impedances of the data set for each circuit class.

Figure 3 :
Figure 3: Confusion matrix of predictions on the random 20% data held out for testing for the RF baseline classification model.Weighted F1-score: 0.38

Figure 4 :
Figure 4: Confusion matrix of predictions on the random 20% data held out for testing for the tsfresh-XGBoost classification model.Weighted F1-score: 0.50

Figure 5 :
Figure 5: Average feature importance for each class calculated using SHAP on test set predictions for the tsfresh-XGBoost classification model.

Figure 6 :
Figure 6: Feature-specific SHAP values from the top 5 average features in Fig. 5 segregated by class for the tsfresh-XGBoost classification model.Each data point corresponds to an observation from the test split.Overlapping points are dispersed to represent the density of values.The x-axis of each plot is the SHAP value for the feature denoted on the y-axis.The features on the y-axis are numbered by their order in Fig. 5. Points are colored by the value of the feature, with blue corresponding to low values and pink corresponding to high values.

Figure 8 :
Figure 8: Confusion matrix of predictions on the random 20% data held out for testing for the CNN classification model.Weighted F1-score: 0.32

Figure 9 :
Figure 9: Confusion matrix of normalized impedance spectra associated with the XGB-tsfresh model.

Figure A. 1 :
Figure A.1: Impedance spectra associated with the L-RCPE circuit class that were filtered out based on described in Tab.A.1, 150 spectra were randomly sampled from the 332 spectra that were filtered out in total.

Figure A. 3 :
Figure A.3: Frequency ranges of the various ECM classes.

Figure A. 4 :
Figure A.4: Number of measured frequencies of spectra associated with the various ECM classes.The circles are scaled by the number of spectra that have the same number of measured frequencies in the respective ECM class.

Figure B. 1 :
Figure B.1: Two-component UMAP reduction of the data set.Because clusters are substantially overlapping, component values for each circuit type in the data set are plotted on separate axes.To help distinguish the density of points, each axis is plotted as a binned hexagonal grid, where bright regions correspond to high bin counts and dark regions correspond to low bin counts.UMAP is conducted after data frequency range preprocessing.

Figure D. 1 :
Figure D.1: Architecture of MobileNetV2.MobileNetV2 works based on a depthwise separable convolution.The bottleneck block increases the size of the input layer's representation, allowing the neural network to learn more abstract and complex relationships.

Table 1 :
The predefined ECM configurations, see Table2for detailed descriptions of each element.
NameNumber of parameters Number of spectra (without filtering)

Table 2 :
The circuit elements

Table 4 :
Classification results, (results for unfiltered data).The reported accuracies for the CNN are average accouracies of ten trained networks.

Table C .
1: Mean absolute error of parameter regression models on test splits for each ECM type, compared between dummy models that use the median values for each parameter in the training split, tsfresh-XGBoost regression models without any target data transformation, and tsfresh-XGBoost regression models using a quantile transformation on the target data.Bold entries correspond to the lowest value for each row.