Power-social feature association identification method based on time-frequency attention model
By using an adaptive time-frequency analysis based on the time-frequency Transformer-in-Transformer framework and the Butterworth Phase-Adaptive Attention Mechanism, the non-stationarity and multi-scale periodicity of electricity consumption data in smart grids are addressed, achieving high-precision identification of the correlation between electricity and social features and improving the stability and adaptability of the model.
Patent Information
- Application Number
- CN202511738073.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-25
- Publication Date
- 2026-02-24
AI Technical Summary
Existing technologies struggle to effectively handle the non-stationarity and multi-scale periodicity of residential electricity consumption data in smart grids. Traditional models are susceptible to noise interference from individual electricity consumption behavior, deep learning models cannot capture long-range temporal dependencies, and imbalanced samples lead to decreased recognition performance. Time-frequency attention mechanisms lack the ability to model statistical regularities in power data.
By adopting a time-frequency Transformer-in-Transformer (TNT) framework and combining it with the Butterworth Phase-Adaptive Attention Mechanism (BMPPA), the adaptive time-frequency analysis framework integrates dynamic and static features to achieve the identification of power-social feature associations, suppress high-frequency noise, retain low-frequency trends, and adapt to unbalanced data.
It significantly improves classification accuracy and noise robustness, enhances the model's stability under non-stationary signals and its ability to identify small sample classes, optimizes the adaptability to imbalanced sample scenarios, and provides an efficient and reliable theoretical basis.
Smart Images

Figure CN121561631A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of power-social feature association recognition technology, and particularly relates to a power-social feature association recognition method based on a time-frequency attention model. Background Technology
[0002] In smart grid user-side management, utilizing smart meter data to identify residents' social characteristics is crucial for improving load forecasting accuracy and developing differentiated electricity pricing strategies. Current research methods face three main challenges: Data complexity: Residential electricity consumption data exhibits both non-stationarity and multi-scale periodicity, making it difficult for traditional time-domain models to separate key frequency band features. Sample analysis reveals significant differences in electricity consumption behavior among different households; traditional models do not analyze electricity data patterns from a statistical perspective, making them susceptible to noise interference from individual electricity consumption behaviors. Model limitations: Machine learning methods rely on manually defined features, and their generalization ability is constrained by expert experience; in deep learning models, CNNs cannot capture long-range temporal dependencies due to their local receptive fields, while RNNs suffer from gradient vanishing and low parallel efficiency; while the standard Transformer can model long sequences, it lacks optimization for the multi-periodic characteristics of electricity data and is highly sensitive to high-frequency noise. Sample deficiencies: Social characteristic data is severely imbalanced due to voluntary user disclosure, causing traditional methods to experience a sharp drop in performance on minority classes.
[0003] To address the aforementioned issues, time-frequency fusion methods have become a research focus, but significant shortcomings remain: At the feature engineering level: While wavelet transform and Fourier analysis can extract time-frequency features using machine learning and other methods, manually designed features lack robustness and cannot adapt to different scenarios. At the deep learning level: Existing models analyze data features across different periods through frequency domain decomposition, but ignore statistical regularities and are susceptible to high-frequency noise. Using Fourier filtering layers and hard thresholding can easily lead to the loss of some frequency band details due to over-smoothing. A fundamental flaw: Existing time-frequency attention mechanisms lack the ability to model statistical regularities in power data and cannot adaptively balance high-frequency noise suppression with low-frequency trend preservation based on covariance decay characteristics, resulting in poor model stability in small-sample and non-equilibrium scenarios. Therefore, there is an urgent need to develop a statistically driven adaptive time-frequency analysis framework to solve the balance problem between feature selection and noise suppression. Summary of the Invention
[0004] To address the aforementioned technical issues, this invention proposes a power-social feature association recognition method based on a time-frequency attention model. The proposed TNT improvement framework, which integrates a time-frequency adaptive mechanism and static social features, achieves breakthrough improvements in classification accuracy, noise robustness, and adaptability to imbalanced data in the power-social feature association recognition task.
[0005] To achieve the above objectives, this invention provides a method for identifying the association between electricity and social features based on a time-frequency attention model, comprising: The input consists of daily-week multi-timescale electricity consumption data recorded by smart meters, representing dynamic attributes, and partially known basic social features representing static attributes. The unknown social features are classified using a time-frequency Transformer-in-Transformer framework based on BMPPA. The data preprocessing module is used to fill in missing values and eliminate the impact of differences in absolute power consumption levels and fluctuation ranges on the extraction of unified power features. The Inner-transformer module was used to extract intraday features from the electricity consumption data; The Inner-transformer output features and basic social features are input into the Butterworth Phase-Adaptive Attention Mechanism as the Outer-transformer module to differentiate and mimic the statistical correlation characteristics of different subclasses for daytime feature extraction. By integrating intraday features, interday features, and basic social features, and mapping them to probability distributions through a fully connected layer for classification, the association between electricity and social features is identified.
[0006] Optionally, the preprocessing module can be used to process the power time-series data and basic social characteristic inputs, including: The mean and standard deviation of power time series data are calculated along the time dimension. First, a centering operation is performed to eliminate the difference in absolute power consumption level represented by the mean of the input power data. The standard deviation of power time series data is used to adjust the ratio of the position encoding amplitude to the signal amplitude. The mode is used to fill in the missing values of discrete basic social features.
[0007] Optionally, intraday feature extraction in the Inner-transformer module includes: The embedding layer is used to augment single-dimensional power data to a preset dimension. The query matrix, key matrix, and value matrix are generated through three independent linear transformations. A multi-head attention mechanism is used to divide the query matrix, key matrix, and value matrix into subspaces according to the number of attention heads and compute them in parallel. The output features are represented by residual connections, layer normalization, and feedforward layers.
[0008] Optionally, the daytime feature extraction of the Outer-transformer module includes: The output of the Inner-transformer is adjusted through a fully connected layer and dimensional transformation. Time-frequency transformation generates time-domain and frequency-domain features. The time-domain and frequency-domain signals, along with basic social features, are input into the Butterworth Phase-Adaptive Attention Mechanism as dynamic and static covariates.
[0009] Optionally, the processing of the Butterworth Phase-Adaptive Attention Mechanism includes: Construct a relative position phase, and use Fourier transform to map the interval size of the data corresponding to the daily time dimension during the attention extraction process into cross-spectral phase difference; A dynamic phase is constructed, and the correlation coefficient matrix is used to supplement the missing information of the relative position phase during the feature extraction process of the attention mechanism. The relative position phase and dynamic phase are input into the improved Butterworth filter function; Construct a method for extracting differentiated features between subclasses.
[0010] Optional improvements to the Butterworth filter function include: Define a filtering function, and continuously and adjustablely switch between low-pass and high-pass BMPPA attention modes in the time and frequency domains by adjusting the scaling coefficients in the filtering function. Selectively extract specific time and frequency band features based on the cutoff frequency and order in the filtering function.
[0011] Optionally, methods for generating differential features between subclasses include: Decompose the result of multiplying the basic social feature vector with the matrix into positive and negative components; The positive and negative components are respectively input into an improved Butterworth filter function with opposite scaling factors; The output of the reconstructed filtering function is used as the attention matrix for daytime feature fusion.
[0012] Optionally, the classification process includes: The time-frequency features and static features output by the Butterworth Phase-Adaptive Attention Mechanism are fused with cross-attention to obtain the fused features; Add the fusion feature to the feature characterizing the power consumption level; The summation result is processed by layer normalization and residual connection; The input to the fully connected layer is mapped to the class probability space, and the classification result is output through the Softmax function.
[0013] Technical Effects of this Invention: This invention discloses a power-social feature association recognition method based on a time-frequency attention model. The proposed TNT+S+BMPPA framework achieves breakthrough progress in power-social feature association recognition: its pioneering time-frequency adaptive attention mechanism significantly improves classification accuracy by dynamically adjusting the ratio of high-frequency noise suppression to low-frequency feature retention, outperforming existing advanced models in multiple residential social feature recognition tasks. This framework effectively solves the problem of high-frequency interference and multi-period coupling in electricity consumption data, enhancing the model's stability under non-stationary signals. By integrating a differentiated attention mechanism guided by static social features, it significantly optimizes adaptability to imbalanced sample scenarios, narrows the gap in key evaluation indicators, and achieves accurate capture of small sample categories. Simultaneously, the improved Butterworth filter function places the sample input feature extraction process under the statistical regularity of power data, balancing feature selection and noise suppression, and avoiding interference from individual electricity consumption behavior on social feature classification. This technology provides an efficient and reliable theoretical foundation and practical support for application scenarios such as distribution network user profile construction and time-of-use pricing strategy formulation. Attached Figure Description
[0014] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings: Figure 1 This is a flowchart illustrating a power-social feature association recognition method based on a time-frequency attention model according to an embodiment of the present invention. Figure 2 This is a schematic diagram of the calculation process of the Butterworth phase adaptive attention mechanism in an embodiment of the present invention; Figure 3 This is a schematic diagram illustrating the daytime correlation of electricity data for different categories of households in the Age of Person dataset, as described in an embodiment of the present invention. Figure 4 This is a schematic diagram of the improved Butterworth filter function under different combinations of scaling factors and cutoff frequencies according to an embodiment of the present invention. Figure 5 This is a comparison chart of the frequency domain characteristics of weekly power data after feature extraction using the BMPPA mechanism of this invention and the standard self-attention method. Figure 6 This is a graph showing the energy percentage of different frequency bands in the Age of House dataset for the implementation of this invention; Figure 7 This is a graph showing the energy percentage of different frequency bands in the Social class dataset, representing an embodiment of the present invention. Figure 8 This is a diagram showing the energy percentage of different frequency bands in the Children dataset for implementing the present invention; Figure 9 This is a diagram showing the energy percentage of different frequency bands in the House dataset for implementing the present invention; Figure 10 This is a graph showing the energy percentage of different frequency bands in the Age of Person dataset, based on the implementation of this invention. Figure 11 This is a graph showing the energy percentage of different frequency bands in the Lightbulbs dataset for the implementation of this invention; Figure 12 This is a diagram showing the energy percentage of different frequency bands in the Floor area dataset for implementing the present invention. Figure 13 This is a schematic diagram of the confusion matrix in a two-class dataset (Age of house, Lightbulbs, Children, House) according to an embodiment of the present invention; Figure 14 This is a schematic diagram of the confusion matrix in a three-class dataset (Floor area, Social class, Age person) according to an embodiment of the present invention; Figure 15 This is a schematic diagram of the anti-interference ability reflected by the accuracy oscillation amplitude of the BMPPA mechanism in different rounds of the Age of person dataset in the embodiments of the present invention, wherein (a) is the result of using the BMPPA attention mechanism and (b) is the result of using the standard attention mechanism. Figure 16 This is a schematic diagram of the anti-interference ability reflected by the accuracy oscillation amplitude of the BMPPA mechanism in different rounds of the Social class dataset in the embodiments of the present invention, wherein (a) is the result of using the BMPPA attention mechanism and (b) is the result of using the standard attention mechanism. Detailed Implementation
[0015] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0016] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.
[0017] like Figure 1 As shown, this embodiment provides a method for identifying the association between electricity and social features based on a time-frequency attention model, including: The input consists of daily-week multi-timescale electricity consumption data recorded by smart meters, representing dynamic attributes, and partially known basic social features representing static attributes. The unknown social features are classified using a time-frequency Transformer-in-Transformer framework based on BMPPA. The data preprocessing module is used to fill in missing values and eliminate the impact of differences in absolute power consumption levels and fluctuation ranges on the extraction of unified power features. The Inner-transformer module was used to extract intraday features from the electricity consumption data; The Inner-transformer output features and basic social features are input into the Butterworth Phase-Adaptive Attention Mechanism as the Outer-transformer module to differentiate and mimic the statistical correlation characteristics of different subclasses for daytime feature extraction. By integrating intraday features, interday features, and basic social features, and mapping them to probability distributions through a fully connected layer for classification, the association between electricity and social features is identified.
[0018] Furthermore, the preprocessing module process for inputting power time-series data and basic social characteristics includes: The mean and standard deviation of power time series data are calculated along the time dimension. First, a centering operation is performed to eliminate the difference in absolute power consumption level represented by the mean of the input power data. The standard deviation of power time series data is used to adjust the ratio of the position encoding amplitude to the signal amplitude. The mode is used to fill in the missing values of discrete basic social features.
[0019] Furthermore, the intraday feature extraction of the Inner-transformer module includes: The embedding layer is used to augment single-dimensional power data to a preset dimension. The query matrix, key matrix, and value matrix are generated through three independent linear transformations. A multi-head attention mechanism is used to divide the query matrix, key matrix, and value matrix into subspaces according to the number of attention heads and compute them in parallel. The output features are represented by residual connections, layer normalization, and feedforward layers.
[0020] Furthermore, the daytime feature extraction of the Outer-transformer module includes: The output of the Inner-transformer is adjusted through a fully connected layer and dimensional transformation. Time-frequency transformation generates time-domain and frequency-domain features. The time-domain and frequency-domain signals, along with basic social features, are input into the Butterworth Phase-Adaptive Attention Mechanism as dynamic and static covariates.
[0021] Furthermore, the Butterworth Phase-Adaptive Attention Mechanism includes the following processing: Construct a relative position phase, and use Fourier transform to map the interval size of the data corresponding to the daily time dimension during the attention extraction process into cross-spectral phase difference; A dynamic phase is constructed, and the correlation coefficient matrix is used to supplement the missing information of the relative position phase during the feature extraction process of the attention mechanism. The relative position phase and dynamic phase are input into the improved Butterworth filter function; Construct a method for extracting differentiated features between subclasses.
[0022] Further improvements to the Butterworth filter function include: Define a filtering function, and continuously and adjustablely switch between time-domain and frequency-domain BMPPA low-pass (short-term) and high-pass (long-term) focus modes by adjusting the scaling coefficient in the filtering function. Selectively extract specific time-frequency band features based on the cutoff frequency and order in the filtering function.
[0023] Furthermore, methods for extracting differentiated features between subclasses include: Decompose the result of multiplying the basic social feature vector with the matrix into positive and negative components; The positive and negative components are respectively input into an improved Butterworth filter function with opposite scaling factors; The output of the reconstructed filtering function is used as the attention matrix for daytime feature fusion.
[0024] Furthermore, the classification process includes: The time-frequency features and static features output by the Butterworth Phase-Adaptive Attention Mechanism are fused with cross-attention to obtain the fused features; Add the fusion feature to the feature characterizing the power consumption level; The summation result is processed by layer normalization and residual connection; The input to the fully connected layer is mapped to the class probability space, and the classification result is output through the Softmax function.
[0025] Specifically, one implementation process of this embodiment includes: The association between electricity data and social characteristics is essentially a multi-classification problem, which uses time-series electricity consumption data recorded by smart meters and some prior social characteristics to jointly identify other unknown household characteristics. This embodiment can assist in formulating time-of-use pricing strategies and tapping into the potential of residential electricity consumption.
[0026] Assumption k The set of family characteristics is ,right Discrete encoding and calculation of the Kendall rank correlation coefficient revealed that some features exhibited strong correlation. To prevent endogeneity effects, this embodiment divides social features into two parts. A subset of social features with complete labels and strong correlation to electricity data is selected as the basic social features, forming the following set. , representing the static input attributes used for classification; user electricity consumption data represents the dynamic attributes of residents, and the electricity dataset is . , Electricity data for each user. For the electricity classification model function, it maps electricity consumption data and basic social characteristics to target household characteristics: (1); in, These are the model weight parameters obtained during training.
[0027] In summary, the key to identifying the correlation between household characteristics lies in determining a classification model that can fully extract the characteristics of electricity data with intraday-interday multi-scale periodicity, fully consider the dynamic and static attributes of residents, and determine an identification framework with good generalization ability.
[0028] The core of identifying the correlation between household characteristics lies in constructing a classification model that can fully exploit the intraday-interday multi-scale cyclical characteristics of electricity data. This model needs to simultaneously integrate residents' static and dynamic attributes to construct multimodal input data, thereby establishing an identification framework with strong generalization ability.
[0029] The publicly available dataset uses smart meter data and social characteristic data collected by the Commission for Energy Regulation. The dataset contains 536 days of electricity consumption data from 4232 Irish residents, with a sampling rate of 30 minutes per day. Based on the principle of user voluntariness, this dataset incompletely includes some residents' social characteristic information, including residential profiles, sociodemographic data, attitudes towards energy conservation, and appliance information. The social characteristic data selected in this embodiment is shown in Table 1: Table 1
[0030] In this embodiment, "retired" and "cooking" are selected as two basic social characteristics to assist in the classification of electricity data. The household electricity consumption dataset containing these basic social characteristics is divided into samples according to household units and weekly time scales. The sample size of different categories for different characteristics to be classified is shown in Table 2.
[0031] Table 2
[0032] As shown in Table 2, the classification task in this embodiment relies on significantly imbalanced datasets. The effectiveness of the improved framework will be discussed in this scenario.
[0033] like Figure 1 As shown, the model framework in this embodiment is built based on Transformer in Transformer (TNT). Its core application task is to classify the target social characteristics of users based on smart meter data and basic social characteristics. Figure 1 The overall structure of the framework is clearly presented, comprising three modules: Module 1 is the improved TNT framework, serving as the backbone network for the classification method. It not only constructs a two-layer feature extraction mode for "intraday-interday" power data but also introduces basic social features to strengthen inter-class boundaries and improve feature discriminativeness. Module 2 is the time-frequency Butterworth phase-adaptive attention mechanism. During the power data feature extraction process, this module maps the relative positions and correlation coefficients of sequences from different time periods and frequency bands under multi-head attention to complex phases RPE and DAB. Subsequently, by adjusting the improved Butterworth filter function, it specifically mimics the statistical regularity of power data at the time and frequency domains, thereby guiding the framework to focus on key information in specific time and frequency bands and effectively reducing the risk of model overfitting. Module 3 completes the final feature classification through a feedforward network (Fully Connected Layer) and a softmax layer, outputting the classification results of the user's target social features.
[0034] 1. Introduction to Module 1 The framework input consists of two parts: electricity data and basic social characteristics. The electricity data... Data was collected for each household in 30-minute intervals. B Indicates the batch size (batch_size). L Indicates the number of days the smart meter has recorded data. S Corresponding number of sampling points per day. Basic social characteristic sequence. For auxiliary model classification, this embodiment uses Retired and Cooking, which are highly correlated with electricity characteristics, to constitute the basic social characteristics. Set to 2. The framework mainly consists of four parts: 1. Electricity feature regularization module; 2. The second and third parts are Inner-transformer and Outer-transformer modules based on the multi-scale sequence modeling idea; 3. The output module concatenates the extracted electricity features and basic social features to enhance the class center discrimination.
[0035] 1.1 Power Characteristic Regularization Module: Along Dimensional calculation of the mean of power data and standard deviation The former represents the typical power consumption level of a user, while the latter reflects the intensity of fluctuations in user electricity consumption. First, a centralized operation is performed, subtracting the mean of the power data from the input electricity consumption sequence to convert it into a zero-mean fluctuation form. This eliminates the impact of absolute power consumption differences between individuals on the model. Simultaneously, the output... Adjust the proportion of positional encoding in the input features of the Inner-transformer module to reduce the representation bias caused by the large proportion of positional encoding when the electricity consumption sequence fluctuates little, thus ignoring the actual electricity consumption features.
[0036] 1.2 Inner-transformer: To extract intraday power data features, the following steps are first adjusted. Dimensions from Turn to Then, an embedding layer is used to map the one-dimensional power data to... Enhance the nonlinear fitting ability of the model in dimensionality, while using Adjusting the position encoding ratio is used to incorporate intraday time-series location information from the power data.
[0037] (2); Mapped to the query matrix through three independent linear transformations. Key-value matrix Numerical matrix To further enhance the model's representational ability, a multi-head attention mechanism is typically employed, which divides the above matrix according to the number of attention heads (…). H Divide into multiple dimensions as subspaces Attention weights are computed in parallel, and finally weighted and aggregated numerical vectors to generate the final output.
[0038] (3); (4); (5); feature After computation via the self-attention mechanism, the output, through residual connections, a Fully Connected Layer (FC) layer, and a LayNorm layer, is an Inner-Transformer feature representation. 1.3 Outer-transformer: This module extracts daytime features of electricity consumption data based on time-frequency BMPPA. First, the output of the Inner-transformer... Through the FC layer and dimensional transformation, it is adjusted to have a dimension of Outer-transformer input features Subsequently through H -1 layer discrete wavelet transform based on Haar wavelet basis functions will Convert to frequency domain signal of the same dimension Temporal characteristics and frequency domain features Separate and basic social characteristic sequences They are input to the time-frequency BMPPA module as dynamic and static covariates, respectively.
[0039] (6); (7); (8); (9); (10); 1.4 Output Module Introduction: This module is based on the output of time-frequency BMPPA and basic social features, and then uses FC layer and Softmax layer to achieve feature classification.
[0040] (11); (12); (13); and The input is fed into a multi-head attention mechanism. Its output is then averaged along the L-axis to generate a reference sequence. The sequence undergoes time-frequency BMPPA processing to reduce random signal interference. This is achieved by integrating the BSI sequence. Z and mean characteristics The output model adjusts the reference sequence by incorporating the user's basic social characteristics and varying power consumption levels, thereby constructing an inter-class classification hyperplane. Finally, the fused features are mapped to class probability distributions through fully connected (FC) layers and softmax layers.
[0041] 2. Introduction to Module 2 like Figure 2 As shown, its forward reasoning mainly includes: and This paper introduces phase construction, an improved Butterworth filter function, and a method for extracting differential features between subclasses guided by basic social characteristics.
[0042] 2.1 Introduction to RPE (Relative Position Embedded) To fit as Figure 4 The correlation patterns of residential electricity consumption data across different time and frequency bands are shown. A proposed Relative Power Array (RPE) is used to map the daytime relative positions of power consumption data across different time periods and frequency bands under multi-head attention to phase differences via Fourier transform. First, given a discrete unit impulse signal of sample length N, a set of basis signals is generated through cyclic shifting. For each base signal, the DFT is calculated, and finally the conjugate cross spectrum of the signal pair is calculated. The cross spectrum phase angle is extracted as the RPE of the two signals.
[0043] (14); (15); (16); (17); (18); (19); The characteristics of different heads in the multi-head attention mechanism correspond to different frequency bands. Because high-frequency components have greater... k These values allow them to exhibit a finer relative distance (time interval) resolution. By along H Dimensional pair The average is obtained.
[0044] 2.2 Introduction to DAB (Dynamic Attention Bias) DAB phase provides the model with dynamic feature perception capabilities beyond RPE by calculating the correlation coefficient instead of the self-attention matrix.
[0045] (20); (twenty one); (twenty two); Input matrix and After Z-score normalization, the matrix... A The result is converted into a correlation coefficient matrix between sequences, and its output is constrained to the range [-1, 1]. This saturation operation mitigates the impact of outliers. Subsequently, the normalized offset is... With learnable scaling factor The process of merging and constructing a DAB is completed. This includes the scaling factor. The interaction between RPE and DAB is modulated. In the frequency domain BMPPA, DAB is more significant than RPE in the low-frequency part compared to the high-frequency part, thus preserving the correlation pattern of the low-frequency part of the electricity consumption data.
[0046] 2.2.3 Improved Butterworth Filter Function : (twenty three); in Relative phase, For cutoff frequency, Let the filter order be . This is the scaling factor. In the classic Butterworth filter transitioning from low-pass to high-pass, the gradient explodes due to the inverse of the denominator becoming infinite. For example... Figure 3 As shown, by introducing , achieved Continuously adjustable switching between low-pass and high-pass modes. Different modes and Together, they provide methodological support for dynamic filtering in the wavelet transform domain.
[0047] (twenty four).
[0048] 2.2.4 Static Covariate-Guided Subclass Differential Feature Extraction Method: To model the differential decay characteristics of correlation coefficients among different categories of samples with increasing relative daily distance, the BMPPA framework innovatively introduces basic social characteristics of the samples. As a key modeling factor, the differences in social characteristics among the samples to be classified effectively characterize the class-specific patterns during the decay process.
[0049] (25); (26); (27); (28); Basic social characteristics and product It is decomposed into positive and negative components. These components are scaled by opposite factors. Substitution of values Function. The model is adjusted. By analyzing the proportion and amplitude of positive and negative components, we can obtain the differences in correlation patterns among different categories.
[0050] Through the aforementioned improvements, BMPPA demonstrates a superior ability to extract data with periodic information compared to standard attention mechanisms, such as... Figure 5 As shown, analysis using typical samples demonstrates that after BMPPA inference, high-frequency interference signals caused by individual differences in electricity consumption behavior in the original data are significantly suppressed, and the proportion of high-frequency components is reduced by 14.4% compared to the standard Attention method. The time-series representation of weekly electricity consumption data shows a clearer differentiation of weekday-restday periodic patterns, verifying the dual advantages of BMPPA in suppressing noise interference and enhancing periodic feature extraction.
[0051] 3. Experimental Setup 3.1 Training process description: During parameter optimization, the network adopts a supervised learning paradigm, which achieves parameter learning by minimizing the cross-entropy loss function between the model's predicted output and the true label distribution.
[0052] 3.2 Hyperparameter Settings : In this embodiment, the model hyperparameters were determined through cross-validation and Bayesian optimization. The Adam optimizer was used in the experiment, with a learning rate of 0.001 and momentum decay coefficients of 0.9 and 0.999, respectively. The hyperparameter settings are shown in Table 3 below.
[0053] Table 3
[0054] 4. Analysis of Classification Experiment Results 4.1 Validation of the TNT+S Framework: First, a comprehensive comparison is made between the original time-domain TNT model without BMPPA, the time-domain TNT+S (TNT incorporating basic social features), and four classic time-series classification models (LSTM, Encoder, CNN+SVM, and VisionTransformer), with a biased guessing (BG) model used as the benchmark. Given that the data source for this classification problem integrates electricity time-series data and static social features, a TFT model is specifically introduced as a comparison. Simultaneously, to evaluate the cutting-edge nature of the TNT models, this embodiment incorporates the newly proposed Mamba model for analysis. The performance of each model in residential electricity consumption data analysis is systematically evaluated, and the advantages of the TNT framework compared to traditional time-series models and cutting-edge architectures are discussed.
[0055] Table 4
[0056] Table 5
[0057] Tables 4 and 5 show the accuracy and F1 scores of different models on nine social feature classification tasks, respectively. The results show that the TNT and TNT+S frameworks significantly outperform other models on each dataset, and the introduction of basic social features enhances the TNT framework's feature extraction capability for electricity data. Specifically, the feature recognition accuracy is above 70%, indicating that the features to be classified are generally highly correlated with electricity behavior, and the model can effectively extract features from behavior.
[0058] Among them, the TNT+S model achieved an accuracy rate of over 80% for the "age person" and "children" features. Compared to family structure features, the classification accuracy of other features was lower, indicating a weaker correlation with electricity consumption behavior. Furthermore, by calculating the dataset entropy... The analysis examined whether the difference between accuracy and F1 score was affected by dataset distribution. The children dataset had the lowest entropy (0.878) and the highest classification accuracy, while the social class dataset had the highest entropy (1.478) and the second lowest classification accuracy. Further research showed that datasets with entropy values greater than 1 had a significantly higher mean difference between accuracy and F1 score (0.09) than datasets with entropy values less than 1 (0.02), indicating that both classification accuracy and the difference between the two metrics are influenced by dataset distribution. This reveals that the initial TNT+S model needs improvement in its ability to distinguish features when handling imbalanced data.
[0059] 4.2 The effectiveness of enhancing time-frequency feature extraction capability is verified by adding a frequency domain module. This embodiment selects three typical time-frequency analysis methods—Fourier transform, empirical mode decomposition, and wavelet transform—and conducts experiments on the aforementioned dataset to analyze their impact on classification performance.
[0060] like Figures 6 to 12 As shown, by performing frequency-band energy analysis on the dataset, it was found that different categories of data exhibit significant differences in energy distribution in the low-frequency band, while the energy characteristics in the high-frequency band tend to be similar. Based on this characteristic, a frequency domain analysis module was introduced into the TNT+S model to construct an encoder-decoder structure with the original time domain module. As shown in Table 6, the improved model achieved improved classification accuracy on multiple datasets, and the difference between the accuracy and F1 score showed a significant narrowing trend. Specifically, without the module, the average difference between the two indicators on each dataset was 0.045; after introducing the Fourier transform, empirical mode decomposition, and wavelet transform modules, the difference decreased to 0.036, 0.034, and 0.033, respectively. In the performance comparison of the three time-frequency methods, the wavelet transform showed the best effect. The reason may be: 1. The Short Time Fourier Transform (STFT) maps the original real data to complex form, and the linear layer mapping in the model will destroy the inherent correspondence between the real and imaginary parts of the complex number, resulting in signal phase and amplitude distortion. 2. Although Empirical Mode Decomposition is based on operations in the real number field, the length of the resulting IMF sequence is uncertain, making it difficult to capture the characteristic relationships in the time dimension. In addition, the uncertain number of IMFs also increases the computational complexity of the model.
[0061] Table 6
[0062] The elements in the table represent accuracy (first) and macro average F1 score (second). Furthermore, the improvement in model performance is related to the low-frequency differences between different categories. Taking the Floor area dataset as an example, when wavelet transform is used as the time-frequency analysis method, the accuracy improvement is as high as 14.8%, while the corresponding improvements on the house, age of house, and lightbulbs datasets are 1.2%, 3.5%, and 0.6%, respectively. Therefore, reducing the interference of high-frequency signals on classification, thereby strengthening the differences in low-frequency signals, is key to enhancing the model's ability to distinguish between different categories.
[0063] 4.3 Validation of the improvement in classification performance by using the Butterworth Phase-Adaptive Attention Mechanism (BMPPA) module instead of the original standard self-attention mechanism as an outer-transformer: Table 7 shows that the introduction of the BMPPA module significantly improves the feature extraction capability of the TNT model. Compared with previous experiments, the average accuracy of the model on imbalanced datasets improved by 1.84%. Among them, the accuracy improvement on the Lightbulbs dataset was the most significant, reaching 4%. This result can be attributed to the small energy difference of low-frequency signals among different classes in this dataset, and the low energy and limited interference of high-frequency signals. After the BMPPA module suppresses the interference of high-frequency signals, the model is able to capture the subtle differences between low-frequency signals more accurately. In the Age of House and Floor Area datasets, the accuracy improved by 0.8% in both datasets. This is because the inter-class differences of low-frequency signals in these datasets are obvious, and the inter-class boundaries are clear. The BMPPA module further enhances the stability of intra-class signals by reducing high-frequency signal interference, thereby improving the robustness of the model.
[0064] Table 7
[0065] The elements in the table represent accuracy (first) and macro average F1 score (second). Furthermore, without using data augmentation techniques such as oversampling and undersampling, or special loss functions such as focal loss, the BMPPA module effectively narrowed the gap between accuracy and F1 score. The mean difference between the two metrics decreased from 3.4% to 2.7%, and in the House, Age of House, and Lightbulbs datasets, the difference was almost 0%. This performance improvement is attributed to the dual mechanism of the time-frequency BMPPA module: firstly, the module achieves effective extraction of features from different categories of data by explicitly modeling basic social characteristics; secondly, by suppressing high-frequency interference signals, it reduces the impact of noise on model training and prediction, thereby improving the model's generalization ability on imbalanced datasets.
[0066] To further explore the class separability of features automatically extracted by the model, such as Figure 13 As shown, this implementation combines confusion matrices from different datasets for evaluation. In the visualization results of the binary classification model across four datasets, the overall classification performance is significant. Except for a few samples with class overlap, the distribution boundaries of different classes in the low-dimensional space are relatively clear. Analysis indicates that this phenomenon is closely related to the characteristics of the classification criteria. Specifically, when basic social characteristics are used as auxiliary classification criteria, because they are not perfectly correlated with the features to be classified (i.e., differences in basic social characteristics do not necessarily correspond perfectly to differences in the features to be classified), the model experiences classification confusion on a small portion of the data samples.
[0067] like Figure 14As shown in the diagram, taking the Age person dataset as an example, a series of common characteristics can be observed in the three-class classification model: although the model performs poorly in class 1, presumably due to insufficient rationality of the classification criteria, the model exhibits excellent performance in classifying data for ages 35-65 and over 65, with accuracy maintained at around 90%. It is worth emphasizing that this dataset suffers from significant sample imbalance, yet the model still achieves the above performance, fully demonstrating its strong resistance to data imbalance.
[0068] Figure 15 This is a schematic diagram of the anti-interference ability reflected by the accuracy oscillation amplitude of the BMPPA mechanism in different rounds of the Age of person dataset in the embodiments of the present invention. (a) is the result using the BMPPA attention mechanism, and (b) is the result using the standard attention mechanism. Figure 16 This diagram illustrates the anti-interference capability reflected by the accuracy oscillation amplitude of the BMPPA mechanism in different rounds of the Social class dataset in this embodiment of the invention. (a) shows the result using the BMPPA attention mechanism, and (b) shows the result using the standard attention mechanism. Figure 15 and Figure 16 Taking the dataset shown as an example, to verify the improvement in anti-interference capability after replacing the ordinary attention mechanism in the model with BMPPA, the mean difference between the upper and lower envelopes of the standardized loss function was calculated for analysis. Using the Age Person and Children datasets as examples, the difference between the upper and lower envelopes after BMPPA standardization decreased by 58.9% and 22.1% respectively compared to the wavelet transform in Table IV. In other datasets, except for Age of House, the reductions for Social Class, House, Lightbulbs, and Floor Area reached 5.8%, 9.9%, 28.8%, and 28.2% respectively, all showing a significant downward trend. This indicates that BMPPA can effectively reduce the oscillation amplitude of the loss function in most scenarios, improve the model's stability against interference, and provide strong support for enhancing model robustness.
[0069] This embodiment demonstrates that the proposed TNT+S+BMPPAS model framework successfully achieves accurate classification of household-related characteristics based on electricity data collected by smart meters and limited basic social features. Among the seven features to be classified, the model's accuracy and F1 score both exceed 74%, outperforming not only traditional models such as LSTM and CNN+SVM, but also significantly outperforming cutting-edge models such as Mamba and TFT, with an average improvement of 9.3% compared to the baseline TNT model. This performance improvement is mainly attributed to two innovations: first, the introduction of time-frequency analysis methods, whose accurate representation of periodic signals is consistent with the research results of Qiu, W, and other scholars. By converting time-domain signals into a joint time-frequency domain representation, it effectively enhances the model's ability to capture the periodic features of electricity consumption behavior; second, the specific frequency band selection capability of BMPPA based on Butterworth filters. By suppressing high-frequency noise interference, it highlights the key features of different electricity consumption behaviors in low-frequency signals, making the decision hyperplane of the feature space clearer and more separable, thereby improving the model's anti-interference classification ability for unbalanced data. Future research will further explore the interaction relationships between different basic social characteristics, improve the model's classification performance in all scenarios by dynamically optimizing the feature composition, and expand its practical application boundaries.
[0070] The above are merely preferred embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for identifying the association between electricity and social features based on a time-frequency attention model, characterized in that, include: The input consists of daily-week multi-timescale electricity consumption data recorded by smart meters, representing dynamic attributes, and partially known basic social features representing static attributes. The unknown social features are classified using a time-frequency Transformer-in-Transformer framework based on BMPPA. The data preprocessing module is used to fill in missing values and eliminate the impact of differences in absolute power consumption levels and fluctuation ranges on the extraction of unified power features. The Inner-transformer module was used to extract intraday features from the electricity consumption data; The Inner-transformer output features and basic social features are input into the Butterworth Phase-AdaptiveAttention Mechanism as the Outer-transformer module to differentiate and mimic the statistical correlation characteristics of different subclasses for daytime feature extraction. By integrating intraday features, interday features, and basic social features, and mapping them to probability distributions through a fully connected layer for classification, the association between electricity and social features is identified.
2. The method for identifying power-social feature associations based on a time-frequency attention model as described in claim 1, characterized in that, The preprocessing module is used to process the power time-series data and basic social characteristic inputs, including: The mean and standard deviation of power time series data are calculated along the time dimension. First, a centering operation is performed to eliminate the difference in absolute power consumption level represented by the mean of the input power data. The standard deviation of power time series data is used to adjust the ratio of the position encoding amplitude to the signal amplitude. The mode is used to fill in the missing values of discrete basic social features.
3. The method for identifying power-social feature associations based on a time-frequency attention model as described in claim 1, characterized in that, Intraday feature extraction in the Inner-transformer module includes: The embedding layer is used to augment single-dimensional power data to a preset dimension. The query matrix, key matrix, and value matrix are generated through three independent linear transformations. A multi-head attention mechanism is used to divide the query matrix, key matrix, and value matrix into subspaces according to the number of attention heads and compute them in parallel. The output features are represented by residual connections, layer normalization, and feedforward layers.
4. The method for identifying power-social feature associations based on a time-frequency attention model as described in claim 1, characterized in that, The daytime feature extraction of the Outer-transformer module includes: The output of the Inner-transformer is adjusted through a fully connected layer and dimensional transformation. Time-frequency transformation generates time-domain and frequency-domain features. The time-domain and frequency-domain signals, along with basic social features, are input into the Butterworth Phase-Adaptive Attention Mechanism as dynamic and static covariates.
5. The method for identifying power-social feature associations based on a time-frequency attention model as described in claim 1, characterized in that, The Butterworth Phase-Adaptive Attention Mechanism includes the following: Construct a relative position phase, and use Fourier transform to map the interval size of the data corresponding to the daily time dimension during the attention extraction process into cross-spectral phase difference; A dynamic phase is constructed, and the correlation coefficient matrix is used to supplement the missing information of the relative position phase during the feature extraction process of the attention mechanism. The relative position phase and dynamic phase are input into the improved Butterworth filter function; Construct a method for extracting differentiated features between subclasses.
6. The method for identifying power-social feature associations based on a time-frequency attention model as described in claim 5, characterized in that, Improved Butterworth filter functions include: Define a filtering function, and continuously and adjustablely switch between low-pass and high-pass BMPPA attention modes in the time and frequency domains by adjusting the scaling coefficients in the filtering function. Selectively extract specific time and frequency band features based on the cutoff frequency and order in the filtering function.
7. The method for identifying power-social feature associations based on a time-frequency attention model as described in claim 6, characterized in that, Methods for generating differential features between subclasses include: Decompose the result of multiplying the basic social feature vector with the matrix into positive and negative components; The positive and negative components are respectively input into an improved Butterworth filter function with opposite scaling factors; The output of the reconstructed filtering function is used as the attention matrix for daytime feature fusion.
8. The method for identifying power-social feature associations based on a time-frequency attention model as described in claim 1, characterized in that, The classification process includes: The time-frequency features and static features output by the Butterworth Phase-Adaptive Attention Mechanism are fused with cross-attention to obtain the fused features; Add the fusion feature to the feature characterizing the power consumption level; The summation result is processed by layer normalization and residual connection; The input to the fully connected layer is mapped to the class probability space, and the classification result is output through the Softmax function.