A Data-Driven Convolutional Neural Network Approach for Power Quality Disturbance Signal Classiﬁcation (DeepPQDS-FKTNet)

: Power quality disturbance (PQD) signal classiﬁcation is crucial for the real-time monitoring of modern power grids, assuring safe and reliable operation and user safety. Traditional power quality disturbance signal classiﬁcation approaches are sensitive to noise, feature selection, etc. This study introduces a novel approach utilizing a data-driven convolutional neural network (CNN) to improve the effectiveness of power quality disturbance signal classiﬁcation. Deep learning has been successfully used in various ﬁelds of recognition, yielding promising outcomes. Deep learning is often characterized as a complex system, with its ﬁlters and layers being determined through empirical investigations. A deep learning model was developed for the purpose of classifying PQDs, with the aim of narrowing down the search for unidentiﬁed PQDs to a speciﬁc problem domain. This approach demonstrates a high level of efﬁciency in accelerating the process of recognizing PQDs among a vast database of PQDs. In order to automatically identify the number of ﬁlters and the number of layers in the model in a PQD dataset, the proposed model uses pyramidal clustering, the Fukunaga–Koontz transform, and the ratio of the between-class scatter to the within-class scatter. The suggested model was assessed using the synthetic dataset generated, with and without the presence of noise. The proposed models outperformed both well-known pre-trained models and state-of-the-art PQD classiﬁcation techniques in terms of classiﬁcation accuracy.


Introduction
Power quality (PQ) means the state of the energy being consumed.The term "Power Quality" (PQ) refers to the properties of electricity at a specific location in an electrical system compared with a standard set of values.Power quality disturbances (PQDs) are, thus, detectable by electrical power providers and consumers as variations in these characteristics from the reference parameters.As a result, PQDs are measured and graded in terms of both voltage and current quality.These disruptions may be caused by a number of factors: Power outages can occur as a result of natural causes such as lightning strikes, severe weather, or earthquakes [1].Disturbances to power quality can also be caused by human activity, such as when machinery fails, switches are activated, or the grid is overloaded [2].Power quality issues might arise due to the progressive degradation of power equipment as it ages.One common form of power interruption is sags, which are characterized by voltage decreases.These occurrences can be attributed to several factors such as lightning strikes and mechanical failures.Voltage surges, also known as voltage swells, are seen.These swells are further influenced by the actions of switching and the grid's overload.A complete cessation of electrical power can occur as a result of three distinct disruptions, which can be attributed to either natural calamities or the malfunctioning of machinery.The illumination inside the designated area experiences an abrupt and intermittent fluctuation.Flicker is a phenomenon that arises due to the presence of sagging, swelling, and harmonics.The harmonics of a power signal consist of multiples of the fundamental frequency.Harmonics can arise as a consequence of electronic equipment and various other causes [3].
It is possible for electronic equipment to be damaged by fluctuations in the power supply.Disruptions in power quality can erase information stored on computers and other electronic devices.Problems with the power supply could result in brownouts or complete blackouts, disrupting service.There are a variety of countermeasures available.Your electronics can be safeguarded by using surge protectors, filters, and an uninterruptible power supply (UPS) [4].According to data gathered in the USA, it is estimated that customers are responsible for approximately 70% of PQ interruptions, while network operators are to blame for the other 30% [5].Every country has its own unique PQ challenges.In both European and American countries, harmonics accounts for less than a fifth of all PQ issues, while it accounts for approximately a quarter of all PQ issues in the United States [5].As a result, not every PQ problem can be solved with a single formula.There must be a more detailed and precise estimate of the price.Therefore, PQ monitoring systems for detecting and classifying PQDs are crucial in the smart grid paradigm.The time and location of voltage and current fluctuations can be gleaned from the detection phase, while the classification phase aids in the identification of disturbances and their causes [6].
Several approaches to the problems of PQD detection and classification in online and real-time systems have been developed.Handcraft methods for feature extraction review are presented in [7,8]; different artificial intelligence (AI) methods for categorizing PQ events are discussed in [9]; and deep learning algorithms and transformers can detect and categorize power quality issues.High-accuracy classification has been achieved with the use of deep recurrent neural network (DRNN) classifiers such as bidirectional long short-term memory (BiLSTM) architectures [10].Robust feature extraction from power measurement data can also be achieved with the use of transformers, such as the univariate temporal convolutional denoising autoencoder (UTCN-DAE) [11].Fault prediction in power distribution networks has also made use of machine learning approaches, such as linear and non-linear classifiers [12].Power quality disturbance identification has also been improved with a hybrid detection method that combines wavelet transform and a convolutional neural network (CNN) [13].S-transform-and LeNet-5-based power quality disturbance categorization is proposed in [14].The suggested algorithm can accurately categorize single disturbance signals with varying signal-to-noise ratios and composite disturbance signals made of single disturbance signals.It also has strong noise immunity.The LeNet-5 input form distinguishes this method from others.The disturbance signal's gray picture is input via traditional means.
The suggested technique in [15] is compared with many current methods for the classification of PQDs from two types of data sources.Datasets from the IEEE Work Group P1159.3 and P1159.2 comprise seven types of individual power quality disturbances and eleven types of combined disturbances, and the findings show that the new method can more accurately classify both single and combined PQDs.In the research in [16], an adaptive neuro-fuzzy algorithm based on the discrete packet wavelet transform and the Kalman filter is proposed for detecting and categorizing power quality events in distributed generation systems (DGs).The suggested method outperforms state-of-the-art classification techniques in terms of classification accuracy, convergence time, and error prediction.This technique outperformed both a fuzzy logic adaptive system based on the discrete wavelet transform and an artificial neural network based on the Fourier transform when constructed and evaluated in MATLAB.They used artificially produced power quality indications using MATLAB, including voltage sag, voltage swell, flicker, and harmonics, to assess the effectiveness of their system and obtained an accuracy of 98%. Figure 1 delineates an expansive flowchart categorizing power quality issues into distinct classifications, encompassing transients, long-and short-duration voltage variations, voltage imbalance, waveform distortions, flicker, and their repercussions on end-user devices.Each category includes specific issues such as sags, swells, harmonics, and noise, which are further explained.generation systems (DGs).The suggested method outperforms state-of-the-art classification techniques in terms of classification accuracy, convergence time, and error prediction.This technique outperformed both a fuzzy logic adaptive system based on the discrete wavelet transform and an artificial neural network based on the Fourier transform when constructed and evaluated in MATLAB.They used artificially produced power quality indications using MATLAB, including voltage sag, voltage swell, flicker, and harmonics, to assess the effectiveness of their system and obtained an accuracy of 98%. Figure 1 delineates an expansive flowchart categorizing power quality issues into distinct classifications, encompassing transients, long-and short-duration voltage variations, voltage imbalance, waveform distortions, flicker, and their repercussions on end-user devices.Each category includes specific issues such as sags, swells, harmonics, and noise, which are further explained.As they now stand, deep learning models are a mystery.There is no hard and fast rule for selecting which layers and filters to utilize; rather, they are determined experimentally.We applied these data in a novel approach to develop an adaptable deep learning model motivated by the PQD dataset.we derived the layer filters using the Fukunaga-Koontz transform (FKT) [18].To control the depth of the CNN model, we computed the ratio between the trace between scatter matrix Sb and within scatter matrix Sw.The Deep-FKTNet model [19] was developed for fingerprint classification.DeepFKTNet extracts LGDBP [20] features from fingerprints and then clusters them using the K-medoids [21] clustering algorithm.It uses the eigenvectors as filters for the CNN layers.Its architecture works with 2D fingerprints, whereas our PQD data are 1D.
The proposed PQD CNN classification system was evaluated against the state-of-theart PQD classification schemes utilizing the synthetic dataset generated based on IEEE Std-1159-2009.Our technique makes the following significant contributions: a.An intelligent computer method for classifying PQDs has been developed.b.A constructive method is proposed for automatically constructing a data-driven CNN model with a custom-designed architecture by utilizing clustering, FKT, and the ratio of the traces of the between-class scatter matrix and the within-class scatter matrix to extract discriminative information from the 1D PQD dataset.c.The obtained results reveal that the proposed PQDs classification scheme is quick, accurate, and performs well.
This paper is organized as follows: Section 1 contains the introduction, Section 2 contains the proposed method, Section 3 contains the experimental results, and Section 4 contains the conclusion.As they now stand, deep learning models are a mystery.There is no hard and fast rule for selecting which layers and filters to utilize; rather, they are determined experimentally.We applied these data in a novel approach to develop an adaptable deep learning model motivated by the PQD dataset.we derived the layer filters using the Fukunaga-Koontz transform (FKT) [18].To control the depth of the CNN model, we computed the ratio between the trace between scatter matrix S b and within scatter matrix S w .The DeepFKTNet model [19] was developed for fingerprint classification.DeepFKTNet extracts LGDBP [20] features from fingerprints and then clusters them using the K-medoids [21] clustering algorithm.It uses the eigenvectors as filters for the CNN layers.Its architecture works with 2D fingerprints, whereas our PQD data are 1D.
The proposed PQD CNN classification system was evaluated against the state-of-theart PQD classification schemes utilizing the synthetic dataset generated based on IEEE Std-1159-2009.Our technique makes the following significant contributions: a.
An intelligent computer method for classifying PQDs has been developed.b.
A constructive method is proposed for automatically constructing a data-driven CNN model with a custom-designed architecture by utilizing clustering, FKT, and the ratio of the traces of the between-class scatter matrix and the within-class scatter matrix to extract discriminative information from the 1D PQD dataset.c.
The obtained results reveal that the proposed PQDs classification scheme is quick, accurate, and performs well.
This paper is organized as follows: Section 1 contains the introduction, Section 2 contains the proposed method, Section 3 contains the experimental results, and Section 4 contains the conclusion.

Adaptive CNN Model
The search for the optimal model configuration for a given application is a challenging optimization issue because of the large parameter space that must be explored.A convolutional (CONV) layer is the backbone of any convolutional neural network (CNN) model.The CONV layer uses a predetermined number of filters to perform convolution operations on the input signal, thereby extracting discriminative features.For a CNN model to derive a feature hierarchy, the CONV layers must be layered.Among the most difficult hyperparameters to tune for a given application are the number of CONV layers and the number of filters in each layer.Model performance is highly sensitive to the initialization of learnable parameters when using iterative optimization approaches like the Adam optimizer.Adaptive model design can be determined with relative ease by utilizing the discriminative content of PQDs.To begin, we cluster each type of PQD in the dataset to find suitable examples from which to construct a CNN model.Each CONV layer's breadth (number of filters) and depth (number of CONV layers) are set with the information that identifies the main trends and patterns and differentiates chosen PQDs.The overall design procedure is depicted in Figure 2.  We offer a straightforward approach to adaptively determining the optimal model configuration by exploiting the discriminative content of PQDs.To begin, we choose exemplary PQDs to serve as our pointers while we develop our CNN model.Data-dependent initialization of CONV layer filters is performed using the discriminative information in these PQDs to establish the model's width (the number of filters in each CONV layer) and depth (the number of CONV layers).An overview of the design process is shown in Figure 2. To select the representative PQDs, we use clustering.To select the number of filters in a CONV layer, we use the Fukunaga-Koontz transform (FKT) [18], which makes use of class-discriminative information, and we use the ratio of the between-class scatter matrix S b to the within-class scatter matrix S w to select the suitable depth (i.e., the number of CONV layers) of the CNN model.In order to reduce the amount of trainable parameters and prevent overfitting, global pooling layers are implemented.This fits very well with the CONV architecture since it ensures uniformity in feature maps and classes [22] and feeds its results straight into SoftMax layers.In the sections that follow, we will discuss the specifics of the design process, and Figure 2 provides a high-level view.

Selection of Representative PQDs
In order to adaptively specify the CONV layers and the depth of the CNN model, we choose the representative PQDs.In step 2 of Algorithm 1, we carry this out by identifying the most representative PQDs of each class by clustering the training set.K-medoids [21] is used for clustering to determine the representative PQDs since it is appropriate for finding the representative subset of the training set, and it picks the instances as cluster centers.The PQDs that are located in the centers of the clusters are selected for this purpose.Using silhouette analysis [23], the K-medoids algorithm's number of clusters for each class is given.

Design of the Main DeepPQDS-FKTNet Architecture
State-of-the-art CNN models typically have set, extremely intricate topologies that are not derived from the data.Instead, we establish a data-dependent framework for DeepPQDS-FKTNet.Its fundamental structure is determined by how many CONV layers the model needs and how many filters should be used in each of those layers.An iterative technique is developed to answer these questions.It calculates the number of filters in a CONV layer, adds that layer iteratively to the model, and stops when some condition is met.The number of filters in a CONV layer and how they are initially set are both determined by the discriminative information included in PQDs.Algorithm 1 provides the specifics.In the next paragraphs, we provide an explanation of the algorithm and its rationale.
Initially, the set of PQD: PS = (PS 1 , PS 2 , . .., PS C ), is used to determine the number of filters in the first CONV layer and initialize them.Unlike the filter size of the first CONV layer in state-of-the-art CNN models like ResNet [24], DenseNet [25], and Inception [26], we fixed the filter size of the first layer to 3 × 1.Using a filter of size 3 is usually best for 1D PQD data.This captures less input data but produces less output data.This simplifies model training.After extracting the representative PQDs in step 2, we specify the discriminated patches of the current layer by choosing the patches P i 1 , P i 2 , . . ., P i m i of size 3 × 1 from each PQD and then cluster them using the procedure in step 3 and select the patches in the clusters' centers to form the covariance matrix in the fourth step of the method.The 1D representative patches from each PQD, where P = P 1 1 , P 2 2 , . . ., P n m n , such that P I 1 ∈ R d , are combined in such a way that FKT makes use of the distinct features of the patches in the set P to eliminate overlapping elements and count the number of occurrences of each filter type.In stages 2-3 of the Algorithm 1, we pick patches from the representative PQDs with a size of w × 1, and recast the problem of selecting the filters (u k , k = 1, 2, . . .N) as finding the optimal projection direction vectors, u l , l = 1, 2, . . .d, by addressing the optimization problem below: where the scatter matrices across classes (S b ) and within classes (S w ) (as computed in step 7 of the Algorithm 1) are revealed with a discriminant function of Fukunaga and Koontz (FKT) [18].The optimal projection direction vectors u i are the eigenvectors of S b , i.e., where S b = P T S b P, P = QD −1/2 , and Q and D are computed by diagonalizing the total S b + S w , i.e., S b + S w = QDQ T (steps 5-6 of the Algorithm 1).Suitable and optimal vectors are given using Equation (2) to maximize tr U T S b U and minimize tr U T S w U .This method can handle very high-dimensional data since, unlike LDA, the inversion of S w is not required.Furthermore, the orthogonal best-possible vectors are sought after using this method.This method is appropriate for our architecture since the representative patch vectors, RP i , associated with the intermediate CONV layers have a high dimension, and we need filters that are decoupled and capture discriminating, not repeated, features.
The problem of selecting the number of filters in the convolutional layer is to select the eigenvectors u k , k = 1, 2, . . .K so that the ratio γ k = Trace(SPQD b ) Trace(SPQD w ) attains the maximum value.Herein, the between-class scatter matrix SPQD b and within-class matrix SPQD w are computed for each u k by projecting all activations a i j in the space spanned by u k (steps 7-8 of the Algorithm 1).This ensures the selection of the filters that extract discriminative features (15 filters, as shown in Figure 3).After selecting u l , k = 1, 2, . . .L, the CONV block with L filters u l , l = 1, 2, . . ., L initialized with u l is introduced into DeepPQDS-FKTNet.Then, a pooling layer is added if needed (steps 9-10 of the Algorithm 1).
Using the current architecture of DeepPQDS-FKTNet, the set of activations Z = (Z 1 , Z 2 , . . . ,Z C ) of PS = (PS 1 , PS 2 , . . . PS C ) is computed.These activations are used to determine whether to add more layers to the net.This is decided by calculating the trace ratio TR = Trace(S b ) Trace(S w ) , where S b and S w are the between-class and within-class scatter matrices of the activations Z.If the current TR is higher than the pre-current TR (PTR), then the current block of layers contributed to the network's discriminative structure.This metric guarantees that DeepPQDS-FKTNet's output features exhibit low intra-class dispersion and high inter-class variation.To add another CONV block, steps 3-8 are repeated with Z.To improve computational efficiency, pooling layers are placed after the first and second CONV blocks to lower the size of feature maps.Each layer can have a different set of filters due to the PQDs being used to determine the number of kernels.
It is important to keep in mind that the eigenvector u l used to determine the kernels of a CONV layer has the maximum γ k and captures most of the variability in input PQD signals without redundancy in the form of independent features.
The complexity of a CNN model is heavily dependent on its depth (the number of layers) and the number of kernels (the number of kernels for each layer).Steps 7-8 of Algorithm 1 determine the best kernels that ensure the preservation of maximum energy of the input data and initialize these kernels to be suitable to the PQD domain.The selected kernels extract the features from PQDs so that the variability in the structures in the PQD domain is maximally preserved.As we delve deeper into the network, it becomes increasingly critical that the features be discriminative, i.e., have high inter-class variance and low intra-class scatter.This is ensured using the trace ratio TR = Trace(S b ) Trace(S w ) in step 12, where the larger the value of the trace ratio, the larger the inter-class variance and the smaller the intra-class scatter [27].Step 12 in Algorithm 1 allows us to add CONV layers as long as TR is increasing and determines the data-dependent depth of DeepPQDS-FKTNet.Step 1: Initialize DeepPQDS-FKTNet with the input layer and set w = 3, h = 1, d = 1, and m (the number of filters) = 0 for the first layer and PTR (previous TR) = 0.

•
Compute Z i = a i j = RPQD j where RPQD j is the representative PQDs (centers of clusters) extracted using the K-medoid clustering algorithm from PS.

Step 4: Using
, where J i is an n i × n i matrix with all ones.

•
Within-class scatter matrices Step 5: Diagonalize the sum ∑ = S b + S w i.e., ∑ = QDQ T and transform the scatter matrices using the transform matrix P = QD − 1 2 , i.e., S b = P T S b P, S w = P T S w P.

•
Compute the between scatter matrix SPQD b and within scatter matrix SPQD w from Y.
Step 10: If m = 1 or 2, add a max pool layer with a pooling operation of size 2 × 1 and stride 2 to DeepPQDS-FKTNet.

•
Compute the ratio TR = Trace(S b ) Trace(S w ) , where S b and S w are the between-class and within-class scatter matrices of the activations Z.  , where  and  are the between-class and within-class scatter matrices of the activations .If the current TR is higher than the pre-current TR (PTR), then the current block of layers contributed to the network's discriminative structure.This metric guarantees that DeepPQDS-FKTNet's output features exhibit low intra-class dispersion and high inter-class variation.To add another CONV block, steps 3-8 are repeated with Z.To improve computational efficiency, pooling layers are placed after the first and second CONV blocks to lower the size of feature maps.Each layer can have a different set of filters due to the PQDs being used to determine the number of kernels.
It is important to keep in mind that the eigenvector  used to determine the kernels of a CONV layer has the maximum  and captures most of the variability in input PQD signals without redundancy in the form of independent features.
The complexity of a CNN model is heavily dependent on its depth (the number of layers) and the number of kernels (the number of kernels for each layer).Steps 7-8 of Algorithm 1 determine the best kernels that ensure the preservation of maximum energy of the input data and initialize these kernels to be suitable to the PQD domain.The selected kernels extract the features from PQDs so that the variability in the structures in the PQD domain is maximally preserved.As we delve deeper into the network, it becomes increasingly critical that the features be discriminative, i.e., have high inter-class variance and low intra-class scatter.This is ensured using the trace ratio  = where the larger the value of the trace ratio, the larger the inter-class variance and the smaller the intra-class scatter [27].Step 12 in Algorithm 1 allows us to add CONV layers as long as TR is increasing and determines the data-dependent depth of DeepPQDS-FKT-Net.

Problem Formulation
As shown in Table 1, the PQDs are categorized into nine distinct PQDs: normal, sag swell, interruption, flicker, sag with harmonics, swell with harmonics, interruption with harmonics, and flicker with harmonics.Identifying the type of a PQD is considered a multiclass classification problem.Let there be K PQDs generated.These PQDs are categorized

Problem Formulation
As shown in Table 1 Figure 2 depicts the design process, and the rest of this section provides further information.

Disturbance
Characteristics Equation Parameters Four different optimizers, namely, SGD, Adam, Adagrad, and RMSprop, were evaluated.The learning rate was varied within the range of 1 × 10 −5 to 1 × 10 −1 .Additionally, the patch size was explored using values of 8, 16, 24, and 48.Different activation functions, including Relu6, Sigmoid, Relu, and LRelu were also considered.Finally, the dropout rate was adjusted between 0.25 and 0.75.Following the completion of a training process spanning 10 epochs, the optimal hyperparameters for the dataset were documented and are presented in Table 2.

Evaluation Procedure
The synthetic PQD dataset both with and without noise consisting of 9 classes, as depicted in Table 1, was utilized for evaluation purposes.Each dataset was partitioned into two distinct sets, with 80% of the data allocated for training purposes and the remaining 20% reserved for testing.In order to assess performance, we employed four widely utilized metrics: accuracy (ACC), sensitivity, specificity, and Kappa [31][32][33][34].The overall averages of the metrics were computed.The metrics [35,36] used to evaluate the proposed system were: where TP, TN, FP, and FN are the numbers of true positives, true negatives, false positives, and false negatives consecutively, and P 0 and P e are calculated from the confusion matrix (the details are given in [37]).In order to calculate the true positives (TPs), true negatives (TNs), false positives (FPs), and false negatives (FNs), a sequential approach was employed, where one class was designated as the positive class, while the remaining classes were considered negative.Subsequently, the sensitivity and specificity measures were computed.Ultimately, the mean sensitivity and specificity were determined by computing the average values of sensitivity and specificity across all classes.The reported results included the mean sensitivity and specificity.

Experimental Results
In this section, we present the experimental results of the DeepPQDS-FKTNet models designed for the generated datasets with and without noise.

Discussion
The present study focused on the issue of PQD classification and introduced an innovative approach for constructing a customized DeepPQDS-FKTNet model based on the specific dataset under consideration.The selection of the number of layers and filters for each layer was not arbitrary; rather, it was based on the optimal representative PQDs identified via the utilization of the K-medoids clustering algorithm in the PQD datasets.The DeepPQDS-FKTNet models produced in this study exhibit a shallower architecture compared with the current state-of-the-art models.Despite their reduced depth, these models demonstrate robustness and are characterized by a relatively limited number of learnable parameters.Furthermore, their design renders them ideal for PQD classification tasks.The results from applying the DeepPQDS-FKTNet models to the synthetic PQD dataset (shown in Table 3) show that these models outperform those that have already been pre-trained (GoogleNet and ResNet50) when fed the same synthetic PQDs, both with and without noise.In order to accommodate 1D PQD data with an input size of 1 × 1000 and nine classes, various adjustments were implemented to the GoogleNet and ResNet50 models.The input layers of both models were modified to accommodate one-dimensional data, as opposed to their original configuration for processing two-dimensional images.The 2D convolutional layers were substituted with 1D counterparts.The inception modules in GoogLeNet were modified from their initial design, which involved using numerous concurrent branches with distinct 2D kernel sizes, to instead utilize 1D operations.In a similar vein, the residual blocks in ResNet50 were altered to use 1D convolutions instead of 2D convolutions, while also making necessary modifications to the skip connections to ensure compatibility in terms of dimensions.When all was carried out, both architectures were fine-tuned using the synthetic PQD datasets to produce outputs for a total of the nine classes.The architectural configuration of a DeepPQDS-FKTNet model was derived directly from the dataset, with its design being influenced by the inherent structures present within the data.DeepPQDS-FKTNet models, despite being extremely compact, provide superior classification capabilities.In addition, the proposed method avoids the overfitting problem by employing a modest set of trainable parameters, as shown in Table 3.Both the DeepPQDS-FKTNet-5 and DeepPQDS-FKTNet-6 models outperform the fin-tuned customized pre-trained models (GoogleNet and ResNet50), with the former requiring fewer giga of FLOPs and the latter fewer mega of parameters.In cases where the number of trainable parameters greatly exceeds the number of training examples, it becomes impossible to mitigate the problem of overfitting.The utilization of training and validation sets for the design and refinement of the DeepPQDS-FKTNet model, followed by its evaluation in a separate test set, guarantees the mitigation of overfitting issues.
By examining the accuracy of the model in both the training and testing datasets, with and without noise, as shown in Figure 5a,b, it can be concluded that the model does not exhibit overfitting.The confusion matrix presented in Figure 6a demonstrates a remarkably consistent accuracy rate of 99.5% for all nine classes: normal, sag, swell, interruption, flicker, sag with harmonics, swell with harmonics, interruption with harmonics, and flicker with harmonics with a noiseless dataset.Each class exhibits only one incidence of misclassification, distributed among many categories, indicating that the classifier does not display a bias toward any given class, and its errors are not focused on particular misinterpretations.Overall, the classifier demonstrates a robust and balanced performance across all the classes.Despite the presence of noise in the dataset in Figure 6b, the classifier consistently maintains a high level of accuracy for all classes, with most classes obtaining a true positive rate of approximately 98.5%.Significantly, the misclassifications exhibit a slightly greater range, indicating the impact of noise.The interruption with harmonics class has a wider variety of misclassifications in comparison with the noiseless dataset.In general, despite the presence of noise, the classifier consistently demonstrates remarkable performance.However, certain classes such as interruption with harmonics and flicker with harmonics seem to be more vulnerable to errors caused by noise.with the noiseless dataset.In general, despite the presence of noise, the classifier consistently demonstrates remarkable performance.However, certain classes such as interruption with harmonics and flicker with harmonics seem to be more vulnerable to errors caused by noise.
(a) (b)  To obtain a more thorough evaluation of the efficacy of the proposed methodology, it was juxtaposed with recently proposed state-of-the-art methodologies.Table 4 displays the outcomes of the comparative analysis, particularly when subjected to significant levels of disruptive noise interference.The approaches discussed above exhibited notable degrees of precision.Nevertheless, it is important to acknowledge that the existing techniques have a very restricted range of categories related to PQ disturbance signals in contrast with the comprehensive model we have proposed.The DeepPQDS-FKTNet model achieved competitive performance in relation to the current leading approaches.The improved performance of DeepPQDS-FKTNet can be attributed to its bespoke design, which takes into consideration the intrinsic discriminative structures of PQDs.In contrast, other methods are manually constructed and do not rely on data-dependent approaches.The DeepPQDS-FKTNet-6 model has a commendable level of performance, with an accuracy rate of 98.5%.
The utilization of an auto-deep-learning-based strategy, in conjunction with its capacity to effectively function in the presence of elevated levels of noise, renders it a resilient methodology.Although there may exist alternative approaches with marginally superior accuracy, it is noteworthy that DeepPQDS-FKTNet-6 exhibits a commendable performance.This is particularly impressive given the inherent difficulties associated with constructing an automated model derived from data including shallow architecture and high performance.To obtain a more thorough evaluation of the efficacy of the proposed methodology, it was juxtaposed with recently proposed state-of-the-art methodologies.Table 4 displays the outcomes of the comparative analysis, particularly when subjected to significant levels of disruptive noise interference.The approaches discussed above exhibited notable

Conclusions
An automated technique was developed to generate a personalized deep learning model for PQD categorization.The FKT strategy was employed in order to construct a CNN model that was specifically designed for the target PQD dataset, taking into consideration the substantial number of parameters and random initialization often associated with CNN models.This approach was chosen to ensure the development of a cost-effective and efficient model with enhanced speed.To commence, the initial step involved the selection of the most representative PQD data through the utilization of the K-medoids clustering algorithm.Subsequently, Algorithm 1 was employed to choose appropriate kernels for the purpose of initializing the layers of the model.This facilitates the capture of more discriminative structures within the PQD dataset and allows for control over the depth of the model.The DeepPQDS-FKTNet model that was obtained exhibits a data-centric nature, characterized by a unique architectural design specifically tailored for the dataset.The DeepPQDS-FKTNet model demonstrates a comparable performance to state-of-theart approaches in the PQD dataset while exhibiting a simpler complexity and parameter count.In subsequent research, we intend to augment DeepPQDS-FKTNet and tailor and incorporate our method into the transformer architecture in order to tackle the issue of energy forecasting while considering power quality disturbances (PQDs).

Mathematics 2023 , 16 Figure 2 .
Figure 2. Design procedure of DeepPQDS-FKTNet; (a) The core architecture of DeepPQDS-FKT-Net, and (b) global pooling and softmax layers are added to the model.2.1.1.Selection of Representative PQDs In order to adaptively specify the CONV layers and the depth of the CNN model, we choose the representative PQDs.In step 2 of Algorithm 1, we carry this out by identifying the most representative PQDs of each class by clustering the training set.K-medoids [21] is used for clustering to determine the representative PQDs since it is appropriate for find-

Figure 2 .
Figure 2. Design procedure of DeepPQDS-FKTNet; (a) The core architecture of DeepPQDS-FKTNet, and (b) global pooling and softmax layers are added to the model.

Algorithm 1 :
Design of the main DeepPQDS-FKTNet architecture Input: The set PS = (PS 1 , PS 2 , . .., PS C ), where c is the number of classes and PS i = (PQD j , j = 1, 2, 3, . .., n i ) is the set of PQD signals of the i th class.Output: The main DeepPQDS-FKTNet architecture.

•
If PTR ≤ TR, set PTR = TR, d = L, and go to Step 3; otherwise, stop.

Figure 3 .
Figure 3. Selection of best filters for layer 1 of DeepPQDS-FKTNet model for synthetic PQD dataset.Using the current architecture of DeepPQDS-FKTNet, the set of activations  = ( ,  , … ,  ) of PS = (PS1, PS2, …, PSC) is computed.These activations are used to determine whether to add more layers to the net.This is decided by calculating the trace ratio  = ( ) ( )

Figure 3 .
Figure 3. Selection of best filters for layer 1 of DeepPQDS-FKTNet model for synthetic PQD dataset.
, the PQDs are categorized into nine distinct PQDs: normal, sag, swell, interruption, flicker, sag with harmonics, swell with harmonics, interruption with harmonics, and flicker with harmonics.Identifying the type of a PQD is considered a multiclass classification problem.Let there be K PQDs generated.These PQDs are categorized into C classes.Let PQ = PQ ij 1 ≤ i ≤ K, , where PQ ij represents the ith PQD of the jth class c and c = (1, 2, . .., C), where C is the number of distinct PQDs classes.predicting the type of Power Quality Disturbance (PQD), denoted as PQ ij to develop a function ψ that maps from the PQD space to a set of categories C.This involves taking a specific PQD, PQ ij , from the set PQ and assigning it a category label c from C, expressed as (PQ ij , θ) = c.In this expression, θ represents the parameters of the function.Herein, we use a convolutional neural network (CNN) model to craft the function ψ (which, in this case, represents the model's weights and biases, and the model is constructed adaptively).

Figure 4 .
Figure 4. (a) FKTNET architecture for a noiseless synthetic dataset and (b) FKTNET architecture for a noisy synthetic dataset.

Figure 4 .
Figure 4. (a) FKTNET architecture for a noiseless synthetic dataset and (b) FKTNET architecture for a noisy synthetic dataset.

Figure 5 .
Figure 5. Train and test ACC for DeepPQDS-FKTNet model for (a) noiseless and (b) noisy synthetic PQDs.Figure 5. Train and test ACC for DeepPQDS-FKTNet model for (a) noiseless and (b) noisy synthetic PQDs.

Figure 5 .
Figure 5. Train and test ACC for DeepPQDS-FKTNet model for (a) noiseless and (b) noisy synthetic PQDs.Figure 5. Train and test ACC for DeepPQDS-FKTNet model for (a) noiseless and (b) noisy synthetic PQDs.
, such that ce i is the number of cluster centers of the ith representative • Combine the representative patches RP i l : l is the length o f PQD and append to A i .

Table 3 .
Comparison between DeepPQDS-FKTNet models and the fine-tuned customized pre-trained models for noisy and noiseless synthetic PQDs.G, M, and K stand for giga, mega, and kilo.