On the Explainability of Black Box Data-Driven Controllers for Power Electronic Converters

This paper proposes to explain the black-box feature of data-driven machine learning (ML) models used for controlling power electronic converters for the first time. As the name suggests, their ”black box” feature prevents a clear understanding of the physical insights behind these ML models. It remains a fundamental aspect, if one plans to take action based on a prediction, or deploy a new ML model. Moreover, leaked and corrupted data during the training process can easily augment unexplainable actions from them. To address these issues, we first interpret the actions of the black box models by calculating a conditional entropy for each input with respect to an output. Using this metric, the averaged relationships between each inputoutput can be mapped and representative conclusions are firstly drawn on identifying erroneous data. Finally, these abnormal data are then removed from the training database to improve the interpretability & classification abilities of the ML model. We illustrate our findings on the performance of a regression based learning tool used for controlling a grid-connected voltage source inverter (VSI).

Abstract-This paper proposes to explain the black-box feature of data-driven machine learning (ML) models used for controlling power electronic converters for the first time. As the name suggests, their "black box" feature prevents a clear understanding of the physical insights behind these ML models. It remains a fundamental aspect, if one plans to take action based on a prediction, or deploy a new ML model. Moreover, leaked and corrupted data during the training process can easily augment unexplainable actions from them. To address these issues, we first interpret the actions of the black box models by calculating a conditional entropy for each input with respect to an output. Using this metric, the averaged relationships between each inputoutput can be mapped and representative conclusions are firstly drawn on identifying erroneous data. Finally, these abnormal data are then removed from the training database to improve the interpretability & classification abilities of the ML model. We illustrate our findings on the performance of a regression based learning tool used for controlling a grid-connected voltage source inverter (VSI).
Index Terms-Machine learning, artificial intelligence, power electronics, explainability, black box controller

I. INTRODUCTION
V OLTAGE source inverters (VSIs) are an integral asset in the power electronic energy paradigm, as they serve as one of the most common energy conversion interfaces between renewable energy sources and the grid [1]. They have been valued as a substantial resource in improving the flexibility and sustainability of the power grid. In this regard, the advent of machine learning (ML), artificial intelligence (AI) techniques and communication infrastructures has been a key enabling technology for power electronics offering new features, such as enhanced accuracy and cognitive reasoning [2]- [3]. Apart from energy conversion, AI has been applied across various sectors, such as image & speech recognition, computer vision, etc. Meanwhile, research in related aspects on data science and edge computing by extorting qualitative data has laid a solid foundation for AI & ML in power electronics [4]- [6].
To facilitate key drivers such as controllability and energy efficiency, data-driven ML algorithms are seen as an emerging trend by solving and determining non-deterministic variables [7]- [9]. While the accuracy of these algorithms is highly dependent on training data adequacy and availability, another intricate feature is the quality of data, which can serve multiple purposes by providing in-situ information. However, these data-driven algorithms provide no explanation for variation in output due to the abnormal class of data. This abnormality could result from manipulation via an adversary or even corrupted due to unfortunate accidents [10]. As a result, it creates many uncertainties and brings critical limitations on the deployment of these algorithms for power electronic converters. Hence, multi-fold challenges are raised, which can be summarized using the following questions: 1) How can the prediction of an AI/ML algorithm be trusted for power electronics? 2) How can the physical insights behind these black box tools be explained for power electronics? To answer these questions, we propose an explainable framework for data-driven controllers for the first time in the realm of power electronics. Firstly, we map the conditional entropy to show the marginal effects each input has on the predicted output. This entropy plot can identify the relationship between the input and output, either linear, monotonic or complex. Using these conditional plots, the pattern conforming to the physical insights can be formalized. Finally, any perturbed/corrupted data, which falls outside the operational bounds of the said plot, will then be removed from the training database to minimize its sensitivity on the data-driven tool. We validate our studies using a data-driven regression tool deployed for active and reactive power control of gridconnected VSI. We illustrate various explainability aspects of the regression controller and how its operation is affected using multiple case studies with random perturbations in the training data.

II. PROBLEM FORMULATION
To illustrate the efficacy of the proposed explainable framework, we consider a simple example of controllability of a 2level, 3 phase grid-tied VSI using a machine learning model. As shown in Fig. 1, the control structure has been implemented in the dq0 frame. Using the Park's transformation, the measured voltage and current signals are transformed into {v d , v q } and {i d , i q }, respectively. Moreover, the phase angle information θ is obtained through a SRF-PLL. As the grid-tied VSI operates with different active and reactive power reference points given by i dref and i qref respectively, the corresponding data have been obtained from the control platform to train an ensemble regression based learning model to imitate the control response. Finally, the predicted targets in the form the modulation indices for the d and q axes given by {m d , m q }, respectively are obtained from the data-driven controller and is ultimately fed into the PWM stage. The system and control parameters (used in the physics guided approach for data extraction) can be found in Table I.
Following up on the control schematic in Fig. 1, the filter plant can be represented by: where, L f and R f denote the filter inductance and resistance, respectively. To compensate for these dynamics, a PI based  current controller is designed based on the following equations in dq frame: where ω is the angular frequency. It is worthy notifying that the cross coupling terms (2) and (3), thereby making them non-linear. To decouple and linearize the dynamics [11], m d and m q are determined based on the following control laws: where, v di and v qi are the inverter terminal voltages in dq frame respectively. Encompassing (2)-(5) to imitate the current controller employed for the grid-tied VSI using a data-driven  Fig. 4. Explaining the predictions of data-driven algorithms and their physical insights for power electronics -this method will not only improve the accuracy, but will also interpret the uncertainties behind erroneous results. tool, we first obtain data corresponding to the inputs under a wide range of operation, which has been shown in Fig. 2. Further, the regression curves by fitting the inputs and outputs using a neural network are obtained. This operation is carried out by firstly training the network with a majority of the available data and then validating them with the rest to finalize the regression task. It is worth notifying that the number of data used for training, validation and testing remains uniform throughout the paper.
The regression analytics of the derived ML tool are as follows: a total of 700001 samples (sampled at a frequency of 100 kHz) are obtained for each input defined in Fig. 2 to obtain a formidable regression map in the prediction surface. It is worth notifying that the dataset is obtained under different operating conditions to establish the robustness and reliability of the ML tool to cover a wide range of actions. Finally, 70% of the obtained data is used for training the network and the rest is used for both validation and testing purposes. A neural network model is then achieved with 10 hidden neurons, 6 inputs and 2 outputs (as shown in Fig. 2) to test its accuracy and performance.
Although there are many efficient learning algorithms that can decimate the behavior of non-linear and complex systems quite easily, they are always projected as a black box model, since their prediction analytics can not really be explained. As a result, there are various ways in which a black box model or its evaluation can go wrong. Some of the typical ones are enlisted here: • Data leakage [12] • Adversarial data [13] • Insufficient data [14] Data leakage can be defined as an unintentional leakage of data from the dataset during the training/validation stage, which goes missing when deployed. Further, adversarial data is the injection of random signals into the dataset that can be put by any adversary. This issue is quite relevant in the cybersecurity investigations for power electronic converters [15]. The third category is very common, which entails missing data from various set of operation modes. For example, if the obtained data in Fig. 1 have not accounted the operation of grid-tied VSI under voltage sags/faults, then the qualitative assessment of the ML tool can be poor.
In general, the designed artificial neural network (ANN) to imitate the current controller in Fig. 1 can be represented as a hypothesis space, which comprises all functions that are obtained from compositions of matrix operations and associated non-linearitieis. This hypothesis space can be written as: where, h(x) is a linear predictor and w is a weight matrix. Moreover, each element h (w) of the hypothesis space H in (6) is a function from R n to R, which maps from x to the value w T x. Based on the hypothesis space used for regression, a loss function L can be calculated, which specifies the loss of using the defined predictor map h to predict the output y based on the input x. This loss function can be denoted by: To illustrate the research gap in the explainability of black box models, we consider a simple example where one of the inputs in x, i.e., v d is subjected to random perturbed values in Z = {z} 700001 x 1 , which are bounded within [-0.05,0.05]. It should be noted that the non-zero values are randomly allocated in Z, where the number of non-zero values considered for this test case are only supp(Z) = 5000. Finally, the perturbed input matrix is denoted by x', which includes the perturbed information z in v d . Using the perturbed inputs, another predictor space h is designed for the system in Fig. 1. Finally, the regression curve for both the predictors h (using unperturbed inputs x in Fig. 3(a)) and h (using perturbed inputs x in Fig. 3(b)) are compared in Fig. 2 large margin. As compared to the balanced voltage v di in Fig.  3(a), the performance is drastically affected with unbalancing among the three phase voltages due to the perturbed inputs in Fig. 3(b). Moreover, when a voltage sag disturbance of 50% is introduced at t = 0.2 sec, it can be seen that the voltage unbalancing factor (VUF) for v di increases in Fig.  3(b). This becomes a very common discrepancy where the performance metrics of the power electronic system for the designed black box tool do not accord with their corresponding regression principles. As a result, the missing physical insight and lack of understanding for the said black box tool makes it unexplainable. This problem has also been highlighted in Fig. 4, where it mandates the need for an explainable framework for the black box model. For example, although it can be seen in the zoomed regression curve in Fig. 3(b) that there is a slight deviation in regression between the obtained data and the fitness line, it is not enough to predict this behavior, which could be either due to model inaccuracy or erroneous data. Power electronics practitioners often select and assess an ML model based on their prediction accuracy and computational time. However, the previous case study mandates that considerable attention needs to be provided to analyze and interpret both the data and model. Hence, this paper proposes an explainability diagnostics for the first time, namely a conditional entropy mechanism, which calculates the marginal effects between each input-output of the black box ML model. More details regarding this framework are discussed in the next section.

III. PROPOSED EXPLAINABILITY FRAMEWORK FOR POWER ELECTRONIC CONVERTERS
In this section, the black box data-driven models designed for power electronic converters will be explained. A detailed explainability framework can be seen in Fig. 5. It should be further clarified that the term "conditional" has been used in this paper to explore interpretability using conditional probability density functions of the elements in x. As discussed in Section II, the coupling between d and q xes for a given system determines the system non-linearity. Based on the given case study where the active and reactive power inputs co-exist together in the input data, the conditional probability density function will be an effective way to assess their individual impact on the otuput based on the degree of decoupling. The explainability stages in relation to Fig. 5 are discussed below.

A. Conditional Entropy
This stage calculates the conditional entropy any specific input may have on the predicted outcome of a learning based model. It can be calculated using: where, P ·|· (·|·) denotes the conditional probability density function for x, with the subscripts indicating its specific elements. An estimate of (8) for a range of given values in x i is written as:ĥ where, n is the number of data points. In Fig. 5, the estimate for m d in (9) in the conditional entropy stage, illustrated as the solid red line, is actually the average of all the data-points obtained for different values of v d . It is worth notifying that each grey line in the figure represents individual prediction. As a result, a visual representation of the dependence for different values of v d .

B. Conditional Entropy Weights
This stage describes how the extracted features influence the predicted output of an ML model on average by returning conditional prediction weights. Hence, the impact of coupling interactions between each input can be assessed via their respective entropy weights. This is done by calculating the node risk probability, K i for i th input: where, MSE is the mean squared error, given by: Using the node risk probabilities calculated in (10), the partial weights b i for i th input can finally be given by: Finally, the weights obtained in (12) can be normalized to obtain the conditional entropy weights c i for i th input using: Using (13), the impact of co-related features from the black box model is formalized using the condition entropy weights. In a similar manner, it can be seen in Fig. 5 that the weights corresponding to each data point have been plotted for {v d ,i d ,i q } in relation to the output m d . Additionally, this stage will provide a guideline on critical deviation in the prediction by pursuing the input data with the highest weight.

C. Outliers Determination
This stage aims to remove the corrupt data in the training dataset, which complicates the interpretability of the datadriven tools. As enlisted in Section II, the prediction may go wrong due to erroneous inputs in the form of missing or adversarial data. Hence, to remove the heterogeneity, we consider having a visual representation for identifying the outliers among the training data. For example, if a particular perturbed data point x p (which is perturbed) does not interact with the identified feature in the hypothesis space, the predictor h can then be written as: so that, ∂h(x) ∂xp = h'(x c ). As a result, it can be concluded that the relationship between x c (= x -{x p }) and h does not depend on x p . Hence, the conditional entropy plot for x c and would display a set of n − 1 curves with a common pattern, however one outlier will differ by a level shift according to the perturbed values in x p .
In this way, the outliers are removed from the training dataset to furnish the black box data-driven model with enhanced interpretability and accuracy.

IV. RESULTS
In this section, the validation of the proposed explainability framework employed for the black box data-driven controller in the test system is presented. Two test cases have been accounted in this section to illustrate the efficacy of the proposed framework to provide a visual and logical representation of the training data. In the first test case, the inefficacy of prediction capability of the black box controller is demonstrated under insufficient data. Whereas in the second test case, its performance is validated under erroneous data, where it is randomly perturbed at multiple points by an adversary. Finally, when the dataset is equipped for a voltage sag of 50%, it can be seen in Fig. 6(c) that the feature mapping is more authentic with different levels of predictions at each voltage level. As a result, the proposed explainability framework not only justifies the non-trivial logic that multi-featured training data will provide the most accurate prediction/imitation but also provides a visual representation of the feature mapping between each input and output.

A. Test Case I
In this scenario, training datasets under different conditions have been obtained from the system shown in Fig. 1. These conditions can be enlisted here: 1) No voltage sag (as shown in Fig. 6(a)) 2) A voltage sag of 20% (as shown in Fig. 6(b)) 3) A voltage sag of 50% (as shown in Fig. 6(c)) As it can be seen in Fig. 6, the condition entropy plots justify that the unavailability of sufficient training data will affect their interpretability. In Fig. 6(a), since the training data are captured at only 1 p.u. voltage, it can be seen that the predicted output m d remains constant even though the voltage drops to 0.5 p.u. As a consequence, the systen runs in an open loop during voltage sags with the first set of training data. Further,  (14), resulted due to perturbations in the training data. Fig. 8. Test case II -Performance of the designed neural network in Fig. 1 after removal of outliers (in Fig. 7) from the training data. when the second dataset is considered in Fig. 6(b), it can be seen that m d changes accordingly as per (4), however this hypothesis can be guaranteed for only up to a voltage sag of 20% and not beyond that.

B. Test Case II
This test case aims to investigate the problem of erroneous data and its impact in Section II using Fig. 2. As mentioned before, v d is subjected to a randomly distributed set of perturbed values in Z = {z} 700001 x 1 . which are bounded within [-0.05,0.05]. It should be noted that the non-zero values are randomly allocated in Z, where the number of non-zero values considered for this test case is only supp(Z) = 5000. Finally, the perturbed input matrix is denoted by x', which includes the perturbed information z in v d . Using the perturbed inputs, another predictor space h is designed for the system in Fig.  1.
As shown in Fig. 7(a), no outliers were detected as per (14) for the predictor h without any perturbed inputs. However in Fig. 7(b), subjecting the perturbed dataset Z into v d disorients the mapping, outlaying a constant prediction ranging from 0.4-0.8 p.u. values of v d . Moreover, few predicted trajectories of m d are close to the modulation limits, which may trigger unnecessary clipping of capacitor voltages. Another interesting observation in Fig. 7(b) is that some data for v d have been captured for values larger than 1 p.u., which can be typically attributed to the magnitude of the perturbed data. Using (14), these outliers can be removed from the training data by sighting the scatter plots.

V. CONCLUSION
In this paper, we propose a comprehensive framework to explain the physical insights behind a black box data-driven controller for the first time in the realm of power electronic converters. As often reported, their predictions may go wrong even with the slightest involvement of any abnormal data. To address this issue, we devise a conditional entropy stage that maps the feature between each input and output. Based on the accepted norms for applications such as control, design or maintenance, we authenticate the said mapping, determine the entropy weights and then identify the abnormal data based on a derivative policy of the conditional entropy mechanism. In sum, this paper provides a visual and logical representation of the black box data-driven controller for power electronics. The proposed mechanism offers several advantanges: 1) It reduces the dimensionality and size of the training dataset by removing abnormal setpoints 2) It increases the quality of data 3) It provides an offline diagnosis platform for the predicted values from data-driven tools based on acknowkedged norms of physics 4) It can act as an exemplary guideline to understand the system uncertainties and data requirements As a future scope of work, we aim to study the explainablity of data-driven tools for power electronic applications having multiple features.

VI. ACKNOWLEDGEMENT
This work was partly supported by the VELUX FOUN-DATIONS under the Villum Investigator Grant -Reliable Power Electronic-Based Power Systems (REPEPS) and partly by the Villum Synergy Grant on Light-AI for cognitive power electronics.