Building energy consumption prediction method under data scarcity based on time sequence hierarchical feature extraction and domain adaptation
By employing a transfer learning framework based on hierarchical feature extraction and Gaussian random domain adapter, the problems of scarce new building data and cross-domain transfer were solved, achieving high-precision building energy consumption prediction and improving the model's generalization ability under data-scarce conditions.
Patent Information
- Application Number
- CN202511250966.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-03
- Publication Date
- 2025-12-19
AI Technical Summary
Traditional building energy consumption prediction methods fail in new building or renovation projects due to the scarcity of historical data, and feature mismatch occurs due to inter-domain differences when transferring data across domains. Existing deep learning methods have failed to effectively solve the problems of data scarcity and cross-domain generalization.
We adopt a transfer learning framework based on time series hierarchical feature extraction and Gaussian random domain adapter. The hierarchical feature extraction module mines coarse-grained and fine-grained features in parallel, and captures temporal dependencies by combining a multi-head self-attention mechanism. We also use a Gaussian random domain adapter to achieve dynamic feature adaptation and combine an adversarial training mechanism to improve the model's generalization ability.
Under conditions of data scarcity, it significantly improves the accuracy of building energy consumption prediction and its generalization ability across buildings, solves the bottlenecks of data scarcity and cross-domain migration, and supports real-time decision-making for smart energy management.
Smart Images

Figure CN121167166A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of building energy management technology, and relates to a method for predicting building energy consumption under data scarcity based on time series hierarchical feature extraction and domain adaptation. Background Technology
[0002] With the acceleration of urbanization and the advancement of dual-carbon goals, Building Energy Prediction (BEP) technology has become a core support for smart energy management. Traditional methods mainly rely on statistical models (such as autoregressive integral moving average models) or shallow machine learning models (such as support vector machines), but they face two major bottlenecks:
[0003] High data dependency: New construction or renovation projects often fail due to the scarcity of historical data. For example, in cold start scenarios, less than 1% of the target building has available data, and traditional models have prediction errors as high as 30%-40%, which cannot meet actual scheduling needs.
[0004] Poor cross-domain generalization: Buildings exhibit heterogeneous data distribution due to differences in structure, climate, and energy consumption habits. Existing methods assume that the source domain (e.g., office buildings) and target domain (e.g., hospitals) have the same data distribution, ignoring inter-domain offset issues. Direct transfer models can lead to mismatch in key features, typically manifested as misidentification of peak and valley energy consumption patterns.
[0005] While deep learning has improved the accuracy of single-building predictions in recent years, it has not solved the core contradiction of data scarcity and cross-domain transfer:
[0006] Single-scale feature extraction cannot take into account both the coarse-grained trends (such as seasonal fluctuations) and fine-grained fluctuations (such as equipment start-up and shutdown transients) of energy consumption sequences, resulting in the loss of key information;
[0007] Static domain adaptation methods (such as maximum mean difference alignment) struggle to handle new building types not covered by the source domain, and the inter-domain distribution differences still exceed 0.5KL divergence.
[0008] The shortcomings of existing technologies highlight the urgent need to develop a BEP method that balances hierarchical feature extraction and dynamic domain adaptation. To address this, this invention proposes a transfer learning framework based on time-series hierarchical feature extraction and Gaussian Stochastic Domain Adapter (GSDA), overcoming the bottleneck of cross-building generalization under data scarcity. Summary of the Invention
[0009] In view of this, the purpose of this invention is to provide a method for predicting building energy consumption under data scarcity based on time series hierarchical feature extraction and domain adaptation.
[0010] To achieve the above objectives, the present invention provides the following technical solution:
[0011] A method for predicting building energy consumption under data scarcity based on time series hierarchical feature extraction and domain adaptation includes the following steps:
[0012] Source domain model pre-training stage: acquire energy consumption data and weather data of source buildings, extract coarse and fine-grained features of energy consumption data through the hierarchical feature extraction module to form hierarchical features, use the temporal dependency module to model the temporal dependency relationship of the hierarchical features to form temporal enhanced features, input the temporal enhanced features into the Gaussian Stochastic Domain Adapter (GSDA) for feature adaptation, and finally use the predictor to train based on the adapted features to obtain the pre-trained source domain model;
[0013] Target domain transfer learning stage: acquire energy consumption data and weather data of the target building, initialize the target domain model using the weights of the source domain model, process the source building data and target building data using the target domain model to extract their respective features, achieve domain adaptation between the source domain and target domain through the Gaussian Random Domain Adapter (GSDA) and adversarial training mechanism, and fine-tune the target domain model using the target building data to achieve prediction of the target building's energy consumption.
[0014] Furthermore, the hierarchical feature extraction module includes at least two parallel feature extraction branches, each branch including a linear mapping layer, a layer normalization layer, a nonlinear activation layer and a random deactivation layer connected in sequence, and the outputs of the at least two parallel branches are fused to obtain the hierarchical features.
[0015] Furthermore, one of the at least two parallel feature extraction branches is used to extract coarse-grained global trend features of the energy consumption data, and the other branch is used to extract fine-grained local fluctuation features of the energy consumption data.
[0016] Furthermore, the temporal dependency module employs a multi-head self-attention mechanism, which linearly projects the hierarchical features into a query matrix, a key matrix, and a value matrix, independently calculates attention weights in multiple subspaces, and concatenates the outputs of each subspace to achieve the temporal dependency modeling.
[0017] Furthermore, the calculation of each attention head in the multi-head self-attention mechanism is defined by the following formula:
[0018]
[0019] Q h ,K h V h Let D be the query matrix, key matrix, and value matrix of the h-th attention head. headis the feature dimension of the key matrix.
[0020] Furthermore, after inputting the hierarchical features into the temporal dependency module and before inputting them into the Gaussian random domain adapter (GSDA), a feature fusion step is included to fuse the output of the hierarchical feature extraction module with the output of the temporal dependency module to form the final fused features for adaptation.
[0021] Furthermore, the Gaussian Random Domain Adapter (GSDA) adapts the features using a set of learnable parameters, including the mean vector μ. d Log-variance vector and the domain importance weight w d The feature adaptation process is defined by the following formula:
[0022] F adapted =F final ⊙(μ d +∈⊙σ d )⊙w d
[0023] Among them, F adapted For the adapted features, F final The features to be adapted are represented by ⊙, which indicates element-wise multiplication, and ∈ represents a noise vector sampled from a standard normal distribution.
[0024] Furthermore, when the target building is a new domain not present in the source domain, the Gaussian Random Domain Adapter (GSDA) constructs a composite transformation vector by weighted fusion of the learnable parameters of all source domains to achieve feature adaptation to the new domain.
[0025] Furthermore, the adversarial training mechanism includes a gradient reversal layer (GRL) and a domain discriminator. The gradient reversal layer reverses the gradient from the domain discriminator during backpropagation to enable the model to learn domain-invariant features.
[0026] Furthermore, the predictor is a bidirectional long short-term memory (BiLSTM) network.
[0027] The beneficial effects of this invention are as follows:
[0028] (1) To address the problem of key information loss caused by single-scale feature extraction in traditional methods, this invention uses a hierarchical feature extraction module to mine coarse-grained global trends and fine-grained local fluctuation features in parallel. For example, one branch focuses on macroscopic patterns such as seasonal energy consumption changes, while the other captures microscopic details such as transient changes in equipment start-up and shutdown. This collaborative mechanism avoids the limitations of single-scale analysis, enabling the model to comprehensively capture the complex dynamic characteristics of energy consumption sequences, thereby improving the completeness and robustness of feature representation.
[0029] (2) The temporal dependency module employs a multi-head self-attention mechanism to independently compute stride-length dependencies in multiple subspaces. This design can flexibly capture the interactive effects of short-term fluctuations and long-term trends, such as the correlation between local equipment operating cycles and seasonal climate change. Compared with traditional temporal models, this invention not only accelerates training convergence but also reduces reliance on manual feature engineering, achieving more accurate temporal pattern recognition and prediction stability.
[0030] (3) Gaussian Stochastic Domain Adapter (GSDA) achieves dynamic feature adaptation through learnable parameters, effectively mitigating the distribution differences between the source and target domains. For known domains, parameters are directly reused for feature transformation; for new domains, source domain parameters are weighted and fused to construct a suitable adaptation strategy. This mechanism significantly reduces the dependence on the amount of historical data of the target building and solves the model failure problem in cold start scenarios. At the same time, combined with adversarial training mechanisms such as gradient inversion layers and domain discriminators, the model learns domain-invariant features, improving its generalization ability across building types.
[0031] (4) A two-stage architecture of source domain pre-training and target domain transfer learning fully utilizes the source building data to initialize model weights, and then fine-tunes them to adapt to the target domain. This end-to-end design strengthens the synergy between modules: after the hierarchical feature extraction and the output of the temporal dependency module are fused, they are adapted by GSDA and processed by the predictor to form a closed-loop optimization. Ultimately, the model maintains high-precision prediction even in data-scarce environments, supporting real-time decision-making in smart energy management.
[0032] Other advantages, objectives, and features of the invention will be set forth in part in the description which follows, and in part will be apparent to those skilled in the art from the following examination, or may be learned from practice of the invention. The objectives and other advantages of the invention can be realized and obtained through the following description. Attached Figure Description
[0033] To make the objectives, technical solutions, and advantages of the present invention clearer, the preferred embodiments of the present invention will be described in detail below with reference to the accompanying drawings, wherein:
[0034] Figure 1This is the overall framework diagram;
[0035] Figure 2 This is a hierarchical feature extraction module;
[0036] Figure 3 For time-dependent modules;
[0037] Figure 4 It is a Gaussian random domain adapter. Detailed Implementation
[0038] The following specific examples illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of the present invention. Unless otherwise specified, the following embodiments and features can be combined with each other.
[0039] The accompanying drawings are for illustrative purposes only and are schematic diagrams, not actual pictures. They should not be construed as limiting the invention. To better illustrate the embodiments of the invention, some parts in the drawings may be omitted, enlarged, or reduced, and do not represent the actual product dimensions. It is understandable to those skilled in the art that some well-known structures and their descriptions may be omitted in the drawings.
[0040] In the accompanying drawings of the embodiments of the present invention, the same or similar reference numerals correspond to the same or similar components. In the description of the present invention, it should be understood that if terms such as "upper," "lower," "left," "right," "front," and "rear" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, they are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, the terms used to describe positional relationships in the drawings are only for illustrative purposes and should not be construed as limiting the present invention. For those skilled in the art, the specific meaning of the above terms can be understood according to the specific circumstances.
[0041] 1. Overall Framework
[0042] like Figure 1 As shown, the framework of this invention includes two stages: source domain model pre-training and target domain transfer learning.
[0043] Phase 1: Source Domain Model Pre-training
[0044] In the first stage, the source building energy consumption data and corresponding weather data are preprocessed to ensure data quality and consistency. Addressing the hierarchical characteristics of energy consumption time series data, which exhibit both long-term cyclical trends (such as seasonal energy consumption fluctuations) and short-term dynamic changes (such as instantaneous changes caused by equipment start-up and shutdown), this invention proposes a hierarchical feature extraction module, a temporal dependency module, and a feature fusion module. The hierarchical feature extraction module extracts coarse-grained and fine-grained energy consumption features; the temporal dependency module further captures temporal dependencies across different time ranges. The fused output forms a comprehensive hierarchical feature representation, which is then adapted using a Gaussian Random Domain Adapter (GSDA). Finally, a Bidirectional Long Short-Term Memory (BiLSTM) predictor is trained to complete the building energy consumption prediction task, and the model weights are saved to initialize the target domain model.
[0045] Phase Two: Target Domain Transfer Learning
[0046] In the second stage, the model architecture and modules remain unchanged and are initialized with pre-trained weights from the source domain. Both the source and target domain building data undergo the same preprocessing and feature extraction processes as in the first stage. To achieve target domain transfer learning, a TSDAM-based transfer strategy is proposed. GSDA achieves domain adaptation by reusing or aggregating source domain parameters, thus reducing the inter-domain gap. Figure 1 As shown, adversarial training is implemented using a gradient inversion layer (GRL) and a domain discriminator. GRL promotes domain-invariant feature learning by inverting gradients during backpropagation, while the domain discriminator distinguishes between the source and target domains. This adversarial mechanism facilitates robust knowledge transfer between the source and target domains. Subsequently, the model is fine-tuned on target domain data to improve domain adaptability and generalization ability. After fine-tuning, the model exhibits excellent predictive performance and transfer capabilities.
[0047] 2. Hierarchical feature extraction module
[0048] To achieve multi-scale characterization of building energy consumption prediction (BEP) time series data, this study proposes a hierarchical feature extraction module (such as...). Figure 2 (As shown). The input features are defined as: Where N is the number of samples, T is the time step, and D is the time number. in The input dimension is defined as follows. This module first projects the input onto a unified hidden space, and then extracts features independently through two parallel branches. Each branch contains linear mapping, normalization, non-linear activation, and Dropout operations, and has its own independent parameter set {W}. s ,b s ,γ s ,β sOne branch focuses on coarse-grained global trends, while the other emphasizes fine-grained local fluctuations. Ultimately, the features from both branches are fused at the output layer to obtain the hierarchical feature representation F. scale This provides a multi-level input foundation for subsequent time series modeling.
[0049] Step 1: Project the input onto the hidden layer
[0050] The original input X is first projected uniformly into the hidden representation space through the input layer to ensure that different input dimensions are in the same feature space, forming the basic representation for subsequent branches.
[0051] Step 2: Independent linear mapping for each branch
[0052] In each branch, an independent weight matrix W is used. s (W s ∈R Din×Dhidden and bias vector b s (b s ∈R Dhidden Perform a linear transformation on the input features:
[0053] H s =XW s +b s
[0054] This step ensures that the two branches can learn different feature patterns on the same input.
[0055] Step 3: Layer Normalization
[0056] Each branch performs layer normalization independently, using the scaling parameter γ. s and offset parameter β s Adjust the feature distribution and improve the convergence efficiency of model training.
[0057] Step 4: Nonlinear Activation (ReLU)
[0058] Introducing the ReLU activation function enables the mapped features to have non-linear expressive power, thereby representing more complex energy consumption patterns.
[0059] Step 5: Dropout Random Deactivation
[0060] During the training phase, the Dropout operation is applied to randomly discard some neuron results, thereby improving generalization ability and avoiding overfitting.
[0061] Step 6: Output Layer Blending
[0062] The features from the two branches are ultimately fused back to D through the output layer (concatenation + reprojection). hidden Dimensions, forming hierarchical feature representations: Fscale
[0063] This representation integrates coarse-grained and fine-grained features, providing multi-scale input for subsequent time series modeling.
[0064] 3. Timing-dependent modules
[0065] While the hierarchical feature extraction module can acquire coarse-grained and fine-grained features through parallel branches, the processing between each time step is independent, failing to explicitly consider time-series dependencies. However, Building Energy Estimation (BEP) is typically influenced by both short-term fluctuations and long-term trends, thus requiring the capture of cross-step dependency patterns over time. Therefore, this study introduces a time-series dependency modeling module based on hierarchical features (see...). Figure 3 The method employs a multi-head self-attention mechanism to model time series features in order to explicitly uncover local and global temporal relationships.
[0066] Step 1: Input Feature Preparation
[0067] Output representation from the hierarchical feature extraction module:
[0068]
[0069] It is fed into the timing-dependent module as input. Here, D hidden It is a hidden dimension, such as 64.
[0070] Step 2: Generate the query, key, and value.
[0071] Through linear projection, the input features are mapped into three sets of matrices:
[0072]
[0073] These are used to represent the time step feature to be queried, the corresponding context representation, and the specific value representation, respectively.
[0074] Step 3: Multi-head partitioning
[0075] Hidden dimension D hidden Divide the space into H equal subspaces based on the number of attention heads H:
[0076]
[0077] In this study, H=4 is set, therefore the dimension of each subspace is D. head =64 / 4=16. Different heads will focus on different scopes, such as local dependencies, long-range dependencies, or periodic patterns.
[0078] Step 4: Attention Calculation
[0079] Each attention head independently calculates its own temporal dependency weights, using the following formula:
[0080]
[0081] Intuitively, the process learns the dependencies between a given time step and historical or distant features by associating the similarity between a given time step and other time steps. Figure 3 The heatmaps show the attention distribution of different heads, revealing that some heads focus more on nearby moments, while others cover longer time spans, thus forming complementary dependency patterns.
[0082] Step 5: Multi-head splicing and linear transformation
[0083] The outputs of each attention head are concatenated along the feature dimension to obtain:
[0084] Concat(Head1,Head2,Head3,Head4)
[0085] The concatenated results are then transformed through a linear layer to integrate them into a temporal enhancement feature, denoted as: F attended ;
[0086] Step 6: Output Feature Transmission
[0087] The final F attended It integrates local, long-range, and periodic dependency information, which is then used as an enhanced temporal representation input to subsequent prediction layers.
[0088] 4. Gaussian Random Domain Adapter
[0089] In cross-domain prediction scenarios, significant distributional differences exist between the source and target domains, which limits the generalization performance of the BEP model. To alleviate the distributional shift problem, this study proposes the Gaussian Stochastic Domain Adapter (GSDA), which achieves flexible feature adaptation through learnable Gaussian distribution parameters and controlled randomness transformations, thereby improving the model's robustness and generalization ability under unknown domain conditions. Unlike common statistical-based adaptation methods, GSDA's distribution parameters are automatically learned entirely through backpropagation, enabling dynamic fitting of feature distributions across different domains.
[0090] Step 1: Parameter Settings
[0091] For each domain d∈{1,2,…,D}, GSDA maintains a set of learnable Gaussian parameters:
[0092] Mean vector
[0093] Log-variance vector
[0094] and the domain importance weight w d .
[0095] These parameters together define the characteristic transformation distribution of the domain d.
[0096] Step 2: Random sampling (reparameterization technique)
[0097] During adaptation, the transformation vector θ is sampled from the Gaussian distribution. d :
[0098] θ d =μ d +∈⊙σ d ,∈~N(0,I),
[0099] in ⊙ indicates element-wise multiplication.
[0100] Noise ∈ is resampled during each forward propagation, thus introducing slight random perturbations. This controlled randomness is tuned by learnable parameters, which maintains the diversity of random exploration while avoiding instability caused by disordered noise.
[0101] Step 3: Feature Adaptation
[0102] Fusion feature F final Adaptation in the target domain is achieved in the following ways:
[0103] F adapted =F final ⊙θ d ⊙w d ,
[0104] Where the transformation vector θ d Provides domain-specific feature transformations and domain weights w d This further adjusts the contribution of different domains in the adaptation process.
[0105] Step 4: Adaptation Strategy
[0106] Depending on whether the target domain appears in the source domain, GSDA employs two different adaptation strategies (see...). Figure 4 ):
[0107] Known domain pattern: For target domains that already exist in the source domain, directly use the parameters corresponding to that domain. Perform feature transformation.
[0108] New Domain Mode: For target domains not present in the source domain, GSDA constructs a composite transformation vector by weighted fusion of Gaussian parameters from all source domains.
[0109]
[0110] This enables the model to achieve cross-domain generalization in unknown domain scenarios.
[0111] like Figure 4 As shown, the feature transformation process of GSDA includes: sampling noise ∈ from a standard normal distribution, and combining it with a learnable Gaussian parameter (μ). d ,σ d Construct the transformation vector; then utilize the domain weights w d The design controls the contribution of different domains. It combines "data augmentation randomness" with "parameter controllability", which not only achieves the effect of implicit regularization, but also greatly enhances the model's adaptability to distribution shifts.
[0112] The Time Series Domain Adaptive Model (TSDAM) proposed in this invention addresses the core problem faced by existing building energy consumption prediction technologies in data-scarce environments. By employing a hierarchical feature extraction mechanism, it overcomes the limitations of existing single-scale feature extraction methods, simultaneously capturing coarse-grained and fine-grained patterns and complex temporal dependencies in building energy consumption data, thus improving the model's representational capabilities. Through a Gaussian Stochastic Domain Adapter (GSDA) technique combined with transfer learning, this invention achieves dynamic adaptation to differences in data distribution among different buildings. This not only solves the problem of static adaptation in existing methods but also effectively handles new building types not present in the source domain, significantly reducing the heavy reliance on historical data for the target building. The synergistic effect of these innovative technologies enables TSDAM to maintain stable prediction performance even under extreme data scarcity conditions, greatly improving cross-building generalization ability and prediction accuracy, providing reliable technical support for building energy management in data-scarce environments.
[0113] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A building energy consumption prediction method based on time series hierarchical feature extraction and domain adaptation under data scarcity, characterized in that: The method comprises the following steps: A source domain model pre-training stage: obtaining energy consumption data and weather data of a source building, extracting coarse-grained and fine-grained features of the energy consumption data through a hierarchical feature extraction module to form hierarchical features, modeling a time sequence dependency relationship of the hierarchical features through a time sequence dependency module to form time sequence enhanced features, inputting the time sequence enhanced features into a Gaussian random domain adapter GSDA for feature adaptation, and finally training a predictor based on the adapted features to obtain a pre-trained source domain model; A target domain transfer learning stage: obtaining energy consumption data and weather data of a target building, initializing a target domain model using the weights of the source domain model, processing source building data and target building data using the target domain model to extract respective features, realizing domain adaptation between the source domain and the target domain through the Gaussian random domain adapter GSDA and an adversarial training mechanism, and fine-tuning the target domain model using the target building data to realize prediction of energy consumption of the target building.
2. The method of claim 1, wherein the method comprises: The hierarchical feature extraction module comprises at least two parallel feature extraction branches, each branch comprising a linear mapping layer, a layer normalization layer, a nonlinear activation layer and a random inactivation layer connected in sequence, and the outputs of the at least two parallel branches are fused to obtain the hierarchical features.
3. The method of claim 2, wherein the method comprises: One of the at least two parallel feature extraction branches is used to extract coarse-grained global trend features of the energy consumption data, and the other branch is used to extract fine-grained local fluctuation features of the energy consumption data.
4. The method of claim 1, wherein the method comprises: The time sequence dependency module adopts a multi-head self-attention mechanism, linearly projects the hierarchical features into a query matrix, a key matrix and a value matrix, independently calculates attention weights in multiple subspaces, and splices the outputs of each subspace to realize modeling of the time sequence dependency relationship.
5. The method of claim 4, wherein the method comprises: The calculation of each attention head in the multi-head self-attention mechanism is defined by the following formula: wherein Q h , K h , and V h are the query matrix, the key matrix, and the value matrix of the h-th attention head, respectively, and D head is the feature dimension of the key matrix.
6. The method of claim 1, wherein the method further comprises: After inputting the hierarchical features into the time sequence dependency module and before inputting them into the Gaussian random domain adapter GSDA, a feature fusion step is further included for fusing the outputs of the hierarchical feature extraction module and the outputs of the time sequence dependency module to form final fused features for adaptation.
7. The method of claim 1, wherein the method further comprises: The Gaussian stochastic domain adapter GSDA adapts the features through a set of learnable parameters including a mean vector μ d , a log-variance vector , and a domain importance weight w d The feature adaptation process is defined by the following equation: F adapted = F final ⊙(μ d + ∈ ⊙ σ d ) ⊙ w d where F adapted is the adapted feature, F final is the feature to be adapted, denotes element-wise multiplication, and ∈ is a noise vector sampled from a standard normal distribution, 8. The method of claim 7, wherein the method comprises: When the target building is a new domain that does not appear in the source domain, the Gaussian random domain adapter GSDA constructs a composite transformation vector by weighted fusion of the learnable parameters of all source domains to realize feature adaptation of the new domain. 9.The building energy consumption prediction method based on time series hierarchical feature extraction and domain adaptation under data scarcity according to claim 1, characterized in that: The adversarial training mechanism comprises a gradient reversal layer GRL and a domain discriminator, the gradient reversal layer reverses the gradient from the domain discriminator during backpropagation to prompt the model to learn domain-invariant features. 10.The building energy consumption prediction method based on time series hierarchical feature extraction and domain adaptation under data scarcity according to claim 1, characterized in that: The predictor is a bidirectional long short-term memory network BiLSTM.