Electrical fire risk robust grading early warning method and system based on HL-Transform and SVM
Through the two-stage model of HL-Transformer and SVM, combined with electrical parameters and environmental parameters, the feature extraction and classification coupling problem of the traditional electrical fire warning system is solved, and a more accurate and reliable electrical fire risk classification warning is achieved.
Patent Information
- Application Number
- CN202510532159.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-25
- Publication Date
- 2025-09-19
AI Technical Summary
Traditional electrical fire warning systems rely on a single sensor or single-stage model, which cannot fully capture the comprehensive characteristics of electrical fires. Feature extraction and classification tasks are coupled, and outlier interference can easily lead to ambiguity. The warning level division lacks quantification of intermediate risk values, resulting in coarse warning granularity.
A two-stage model based on HL-Transformer and SVM is adopted. First, the HL-Transformer model is used to predict the electrical fire risk. Then, SVM is used to classify the risk levels. Combined with electrical parameters and environmental parameters, a robust hierarchical early warning method is formed.
The accuracy and reliability of electrical fire risk warnings are improved, the interference of outliers on the model is reduced, and more fine-grained risk classification warnings are achieved.
Smart Images

Figure CN120673567A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of electrical fire risk warning technology, and in particular to a robust hierarchical warning method and system for electrical fire risk based on HL-Transformer and SVM. Background Art
[0002] The total number of electrical fires in my country each year accounts for the highest proportion of the total number of fires. The national fire situation in the first 10 months of 2023 released by the Fire Rescue Bureau of the Ministry of Emergency Management shows that there were 217,000 fire accidents caused by electricity, accounting for 29.1% of the total number of fires. Therefore, it is imperative to achieve early and accurate warning of electrical fires.
[0003] Changes in electrical and environmental parameters, such as abnormal temperatures in electrical circuits, short circuits, and arc faults, often provide potential early warning signals. These signals can be used to detect and alert electrical fires, enabling rapid response and preventing the occurrence and escalation of fires. However, traditional electrical fire early warning systems primarily rely on single sensors for detection, failing to fully capture the comprehensive characteristics of electrical fires. Furthermore, these systems rely on single sensors or single-stage models (such as LSTM or Transformer) that directly input time series data to simultaneously extract features and assign warning levels. These approaches suffer from the following issues: First, feature extraction and classification tasks are coupled; the model must balance learning time series features with classification decisions, and outlier interference can easily blur feature representations. Second, the electrical environment is complex, and data often contains equipment interference or transmission noise. Single-stage models directly fit noisy data, resulting in large fluctuations in prediction results. Third, warning level assignment relies on end-to-end output, lacking the quantification of intermediate risk values. This makes it difficult to dynamically adjust thresholds, resulting in coarse warning granularity. Summary of the Invention
[0004] In order to solve the technical problems existing in the above-mentioned prior art, the present invention provides a method and system for robust hierarchical early warning of electrical fire risks based on HL-Transformer and SVM. The technical solution is as follows:
[0005] On the one hand, a robust hierarchical early warning method for electrical fire risk based on HL-Transformer and SVM is provided, which includes:
[0006] S1. Acquire and preprocess parameter data related to electrical fire risks and corresponding risk value data and risk level data, wherein the parameter data includes electrical parameter data and environmental parameter data, and construct an electrical fire data set;
[0007] S2. Calculate the correlation between the preprocessed parameter data and the risk value data;
[0008] S3, the correlation coefficient is greater than the preset threshold θ th The parameter data and the risk value data as labels are input and trained into the first-stage electrical fire risk prediction model based on the HL-Transformer model to predict the electrical fire risk value and obtain the electrical fire risk prediction value;
[0009] S4. Inputting the electrical fire risk prediction value, environmental parameter data, and risk level data as labels into a second-stage SVM-based electrical fire graded warning model for training, and classifying electrical fire risk warning levels;
[0010] S5. Use the trained overall model consisting of the two-stage electrical fire risk prediction model and the electrical fire graded warning model to perform graded warnings for the electrical fire risks to be warned.
[0011] Optionally, the electrical parameter data includes: current, voltage, power and maximum current; the environmental parameter data includes: oxygen content, temperature and humidity; after calculating the correlation using the Pearson correlation coefficient, the correlation coefficient obtained is greater than a preset threshold value θ th The parameter data are current, voltage, and power in the electrical parameter data. The current, voltage, power and risk value data as labels are input and trained into the first stage electrical fire risk prediction model based on the HL-Transformer model.
[0012] Optionally, the electrical fire risk prediction model based on the HL-Transformer model includes: a fully connected layer, a position encoding layer, multiple stacked encoder layers, a Hodges-Lehmann pooling layer, a Dropout layer, a fully connected layer, and a Dropout layer;
[0013] The fully connected layer maps the input parameter data to a high-dimensional embedding space, providing a richer feature representation for the model.
[0014] The position encoding layer performs position encoding on the data through sine and cosine functions of different frequencies, and adds the position encoding to the data, which can be expressed as follows:
[0015]
[0016]
[0017] X=x+PE
[0018] In the above formula, pos: represents the position of the element in the input sequence, and its value range is from 0 to max_length-1, and max_length is the maximum length of the input sequence; i: represents the dimension of the position encoding tensor, and its value range is from 0 to d model is the embedding dimension of the model; x: represents the output of the fully connected layer; X: represents the output of the position encoding layer.
[0019] The multiple stacked encoders gradually fuse global information to extract electrical fire risk features from the data;
[0020] The Hodges-Lehmann Pooling performs a dimensionality reduction operation on the features output by the multiple stacked encoders using the Hodges-Lehmann estimation method, thereby reducing computational complexity and enhancing model robustness while retaining key features, thereby obtaining more discriminative electrical fire risk features. The features are then passed through the Dropout layer, the fully connected layer, and the Dropout layer to output the electrical fire risk prediction value.
[0021] Optionally, the processing of the multiple stacked encoders includes:
[0022] First, it is processed by a multi-head self-attention mechanism. By parallelly calculating the association weights between all positions in the input sequence, it captures the long-range dependencies between different positions in the sequence and generates attention features that integrate global context information.
[0023] The attention features are then randomly inactivated through the Dropout layer and directly added to the original input through the residual connection to preserve the initial information flow, and then the feature distribution is stabilized through the layer normalization layer;
[0024] The normalized result is input into the fully connected layer for dimensional expansion, and the ReLU activation function is applied for nonlinear transformation, and then compressed back to the original embedding dimension to enhance the feature expression ability and form a high-order feature representation. After Dropout, the residual is added to the previous normalized result for the second time, and then the output of the encoder is obtained through the second layer normalization layer.
[0025] Optionally, the Hodges-Lehmann Pooling process includes:
[0026] Assume that the shape of the tensor output from the multiple stacked encoders is (batch_size, steps, feature), where batch_size is the batch size; steps is the number of time steps; features is the number of features in each time step;
[0027] For each feature of each data sample, the Hodges-Lehmann HL value is taken at all time steps. The output tensor shape is (batch_size, features), which removes the time step dimension and only retains the feature dimension. Assume that the input tensor is X i,j,k , represents the kth eigenvalue of the jth time step of the i-th sample, then:
[0028]
[0029] Among them, S is the number of time steps; Y i,k is the Hodges-Lehmann value of the kth feature of the i-th sample, which is the more discriminative electrical fire risk feature. The specific calculation method is:
[0030]
[0031] vec(M)=[M 1,1 ,M 1,2 ,…,M 1,S ,M 2,1 ,…,M S,S ]
[0032]
[0033] Where M is an S×S stacked matrix constructed by traversing all m and n and calculating the arithmetic mean; vec(M) is a one-dimensional array obtained by flattening the matrix M; vec(M) sorted : One-dimensional array sorted in ascending order.
[0034] Optionally, the SVM-based electrical fire graded warning model consists of an input layer, a support vector machine layer and an output layer;
[0035] The input layer integrates electrical fire risk prediction values and environmental parameters. This is because electrical fire risk is essentially the result of the dynamic coupling between the electrical system state and the external environment. While the electrical fire risk prediction value can reflect the internal risk characteristics of the equipment, the probability of fire occurrence is also affected by the multi-physics coupling mechanism of the environment: temperature increases accelerate material thermal decomposition and arc triggering, humidity changes lead to nonlinear fluctuations in insulation resistance, and oxygen content is directly related to combustion conditions.
[0036] The support vector machine layer uses the Gaussian kernel function to extract features and classify the input data. The Gaussian kernel function can effectively measure the similarity between samples, allowing similar samples to be better clustered together, thereby improving the linear separability and classification effect of the model.
[0037] Output layer, outputs the corresponding fire risk level.
[0038] Optionally, the support vector machine layer adopts a one-to-many OvR strategy principle for classification;
[0039] The training phase:
[0040] For a multi-classification problem with K categories, train K binary SVM models. For the jth category, mark the samples belonging to this category as y ij =1, and the remaining K-1 categories of samples are marked as y ij =-1;
[0041] For each binary classification problem, we need to find a hyperplane that can separate the j-th class samples from the other class samples as much as possible and maximize the interval. The search for this hyperplane is obtained by solving the following optimization problem:
[0042]
[0043] Among them, w j : The normal vector of the j-th hyperplane, which determines the direction of the hyperplane; ξ ij : The slack variable of the i-th sample in the j-th class classifier, allowing the sample to slightly violate the classification interval constraint; b j : The bias term of the j-th hyperplane, which adjusts the position of the hyperplane in space to maximize the classification interval; φ(u i ): Through the RBF kernel function K(u i ,u j )=exp(-g||u i -u j || 2 ) implicitly maps to a high-dimensional space; C: penalty coefficient, balancing the classification interval and misclassified samples; g: RBF kernel parameter, controlling the decay rate of sample similarity. The smaller g is, the more sensitive the model is to local features.
[0044] Prediction stage:
[0045] For each new sample x, substitute it into the K trained hyperplane models:
[0046] f j (u)=∑ i∈SV a ij y ij K(u i ,u)+b j ,j=1,2,…,k
[0047] Among them, SV: support vector set; α ij : Lagrange multiplier, reflecting the contribution of samples to the hyperplane;
[0048] Then choose such that f jThe category j with the largest (x) value is used as the predicted category of sample x:
[0049]
[0050] In another aspect, a robust hierarchical early warning system for electrical fire risks based on HL-Transformer and SVM is provided, the system comprising:
[0051] An acquisition module is used to acquire and preprocess parameter data related to electrical fire risks and corresponding risk value data and risk level data, wherein the parameter data includes electrical parameter data and environmental parameter data, and construct an electrical fire data set;
[0052] A correlation calculation module is used to calculate the correlation between the preprocessed parameter data and the risk value data;
[0053] The first training module is used to calculate the correlation coefficient greater than the preset threshold θ th The parameter data and the risk value data as labels are input and trained into the first-stage electrical fire risk prediction model based on the HL-Transformer model to predict the electrical fire risk value and obtain the electrical fire risk prediction value;
[0054] A second training module is used to input the electrical fire risk prediction value, environmental parameter data, and risk level data as labels into a second-stage SVM-based electrical fire graded warning model to classify electrical fire risk warning levels;
[0055] The graded warning module is used to use the trained overall model consisting of a two-stage electrical fire risk prediction model and an electrical fire graded warning model to provide graded warnings for electrical fire risks to be warned.
[0056] On the other hand, an electronic device is provided, comprising a processor and a memory, wherein the memory stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the above-mentioned robust hierarchical warning method for electrical fire risks based on HL-Transformer and SVM.
[0057] On the other hand, a computer-readable storage medium is provided, wherein the storage medium stores at least one instruction, and the at least one instruction is loaded and executed by a processor to implement the above-mentioned robust hierarchical warning method for electrical fire risks based on HL-Transformer and SVM.
[0058] The beneficial effects brought about by the technical solution provided by the present invention include at least:
[0059] 1) This paper uses the Hodges-Lehman estimate to modify the pooling layer of the Transformer model. When processing electrical fire-related data, it can effectively reduce the interference of outliers on the model, improve the model's ability to capture electrical fire risk characteristics, and thus improve the accuracy of predictions.
[0060] 2) This paper combines the HL-Transformer-based electrical fire risk prediction model with the SVM-based electrical fire graded warning model to form a two-stage model. The first stage predicts the risk value, and the second stage classifies the risk level based on environmental parameters. This model gives full play to the advantages of each model, realizes a robust graded warning of electrical fire risks, and improves the reliability and accuracy of the entire warning system. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0062] Figure 1 This is a flow chart of a robust hierarchical early warning method for electrical fire risks based on HL-Transformer and SVM, provided by an embodiment of the present invention;
[0063] Figure 2 This is an overall block diagram of a robust hierarchical early warning method for electrical fire risks based on HL-Transformer and SVM provided by an embodiment of the present invention;
[0064] Figure 3 This is a structural block diagram of an electrical fire risk prediction model based on the HL-Transformer model provided by an embodiment of the present invention;
[0065] Figure 4 Schematic diagram of the training process of the electrical fire graded warning model based on SVM provided by an embodiment of the present invention;
[0066] Figure 5 This is a block diagram of a robust hierarchical early warning system for electrical fire risks based on HL-Transformer and SVM, provided by an embodiment of the present invention;
[0067] Figure 6 It is a structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0068] In order to make the technical problems, technical solutions and advantages to be solved by the present invention clearer, a detailed description will be given below with reference to the accompanying drawings and specific embodiments.
[0069] An embodiment of the present invention provides a robust hierarchical early warning method for electrical fire risks based on HL-Transformer and SVM. The method can be implemented by an electronic device, which can be a terminal or a server. Figure 1 The flow chart of this method is shown in FIG. Figure 2 The overall block diagram of the method is shown below. The processing flow may include the following steps:
[0070] S1. Acquire and preprocess parameter data related to electrical fire risks and corresponding risk value data and risk level data, wherein the parameter data includes electrical parameter data and environmental parameter data, and construct an electrical fire data set;
[0071] Optionally, the electrical parameter data includes: current, voltage, power and maximum current; the environmental parameter data includes: oxygen content, temperature and humidity.
[0072] Optionally, the preprocessing includes:
[0073] 1) Data cleaning:
[0074] For a small number of missing values, we use methods such as mean, median, and linear interpolation to fill them in according to the characteristics of the data; for records with a large number of missing values, if the missing ratio exceeds a certain threshold, we directly delete the record.
[0075] 2) Standardize the cleaned data set.
[0076] Data standardization uses the StandardScaler method in the Sklearn library to convert the data into a standard normal distribution with a mean of 0 and a standard deviation of 1. The standardization calculation formula is:
[0077]
[0078] Among them, x is the original data, μ is the mean of the original data, σ represents the standard deviation of the original data, and z is the standardized data.
[0079] 3) The dataset is divided into training set, validation set and test set in a ratio of 7:1:2.
[0080] S2. Calculate the correlation between the preprocessed parameter data and the risk value data;
[0081] Alternatively, the Pearson correlation coefficient may be used to calculate the correlation between the pre-processed parameter data and the risk value data.
[0082] S3, the correlation coefficient is greater than the preset threshold θ th The parameter data and the risk value data as labels are input and trained into the first-stage electrical fire risk prediction model based on the HL-Transformer model to predict the electrical fire risk value and obtain the electrical fire risk prediction value;
[0083] Optionally, after calculating the correlation using the Pearson correlation coefficient, the obtained correlation coefficient is greater than a preset threshold θ th The parameter data are current, voltage, and power in the electrical parameter data. The current, voltage, power and risk value data as labels are input and trained into the first stage electrical fire risk prediction model based on the HL-Transformer model.
[0084] Alternatively, as Figure 3 As shown, the electrical fire risk prediction model based on the HL-Transformer model includes: a fully connected layer, a position encoding layer, multiple stacked encoder layers, a Hodges-Lehmann pooling layer, a Dropout layer, a fully connected layer, and a Dropout layer;
[0085] The fully connected layer maps the input parameter data to a high-dimensional embedding space, providing a richer feature representation for the model.
[0086] The position encoding layer performs position encoding on the data through sine and cosine functions of different frequencies, and adds the position encoding to the data, which can be expressed as follows:
[0087]
[0088]
[0089] X=x+PE
[0090] In the above formula, pos: represents the position of the element in the input sequence, and its value range is from 0 to max_length-1, and max_length is the maximum length of the input sequence; i: represents the dimension of the position encoding tensor, and its value range is from 0 to d model is the embedding dimension of the model; x: represents the output of the fully connected layer; X: represents the output of the position encoding layer.
[0091] The multiple stacked encoders gradually fuse global information to extract electrical fire risk features from the data;
[0092] The Hodges-Lehmann Pooling performs a dimensionality reduction operation on the features output by the multiple stacked encoders using the Hodges-Lehmann estimation method, thereby reducing computational complexity and enhancing model robustness while retaining key features, thereby obtaining more discriminative electrical fire risk features. The features are then passed through the Dropout layer, the fully connected layer, and the Dropout layer to output the electrical fire risk prediction value.
[0093] Alternatively, as Figure 3 As shown, the processing process of the multiple stacked encoders includes:
[0094] First, it is processed by a multi-head self-attention mechanism. By parallelly calculating the association weights between all positions in the input sequence, it captures the long-range dependencies between different positions in the sequence and generates attention features that integrate global context information.
[0095] The attention features are then randomly inactivated through the Dropout layer (effective only during training) and directly added to the original input through a residual connection to preserve the initial information flow, and then stabilized by a layer normalization layer.
[0096] The normalized result is input into the fully connected layer for dimensional expansion, and the ReLU activation function is applied for nonlinear transformation, and then compressed back to the original embedding dimension to enhance the feature expression ability and form a high-order feature representation. After Dropout, the residual is added to the previous normalized result for the second time, and then the output of the encoder is obtained through the second layer normalization layer.
[0097] Optionally, the Hodges-Lehmann Pooling process includes:
[0098] Assume that the shape of the tensor output from the multiple stacked encoders is (batch_size, steps, features), where batch_size is the batch size; steps is the number of time steps; features is the number of features per time step;
[0099] For each feature of each data sample, the Hodges-Lehmann HL value is taken at all time steps. The output tensor shape is (batch_size, features), which removes the time step dimension and only retains the feature dimension. Assume that the input tensor is X i,j,k , represents the kth eigenvalue of the jth time step of the i-th sample, then:
[0100]
[0101] Among them, S is the number of time steps; Yi,k is the Hodges-Lehmann value of the kth feature of the i-th sample, which is the more discriminative electrical fire risk feature. The specific calculation method is:
[0102]
[0103] vec(M)=[M 1,1 ,M 1,2 ,…,M 1,S ,M 2,1 ,…,M S,S ]
[0104]
[0105] Where M is an S×S stacked matrix constructed by traversing all m and n and calculating the arithmetic mean; vec(M) is a one-dimensional array obtained by flattening the matrix M; vec(M) sorted : One-dimensional array sorted in ascending order.
[0106] The pooling layer of the embodiment of the present invention performs a dimensionality reduction operation through the median of the Hodges-Lehmann estimation method, which can retain the central tendency of the data, and retain more distribution information through the calculation of pairwise average values. It is more sensitive to fluctuations but still robust. In the electrical fire risk warning system, since the monitoring data may be affected by noise interference or abnormal conditions, this method can improve the robustness and reliability of the model.
[0107] S4. Inputting the electrical fire risk prediction value, environmental parameter data, and risk level data as labels into a second-stage SVM-based electrical fire graded warning model for training, and classifying electrical fire risk warning levels;
[0108] Optionally, the SVM-based electrical fire graded warning model consists of an input layer, a support vector machine layer and an output layer;
[0109] The input layer integrates electrical fire risk prediction values and environmental parameters. This is because electrical fire risk is essentially the result of the dynamic coupling between the electrical system state and the external environment. While the electrical fire risk prediction value can reflect the internal risk characteristics of the equipment, the probability of fire occurrence is also affected by the multi-physics coupling mechanism of the environment: temperature increases accelerate material thermal decomposition and arc triggering, humidity changes lead to nonlinear fluctuations in insulation resistance, and oxygen content is directly related to combustion conditions.
[0110] The support vector machine layer uses the Gaussian kernel function to extract features and classify the input data. The Gaussian kernel function can effectively measure the similarity between samples, allowing similar samples to be better clustered together, thereby improving the linear separability and classification effect of the model.
[0111] Output layer, outputs the corresponding fire risk level.
[0112] Optionally, the support vector machine layer adopts a one-vs-Rest (OvR) strategy principle for classification;
[0113] The training phase:
[0114] For a multi-classification problem with K categories, train K binary SVM models. For the jth category, mark the samples belonging to this category as y ij =1, and the samples of the remaining K-1 categories are marked as y ij =-1;
[0115] For each binary classification problem, we need to find a hyperplane that can separate the j-th class samples from the other class samples as much as possible and maximize the interval. The search for this hyperplane is obtained by solving the following optimization problem:
[0116]
[0117]
[0118] Among them, w j : The normal vector of the j-th hyperplane, which determines the direction of the hyperplane; ξ ij : The slack variable of the i-th sample in the j-th class classifier, allowing the sample to slightly violate the classification interval constraint; b j : The bias term of the j-th hyperplane, which adjusts the position of the hyperplane in space to maximize the classification interval; φ(u i ): Through the RBF kernel function K(u i ,u j )=exp(-g||u i -u j || 2 ) implicitly maps to a high-dimensional space; C: penalty coefficient, balancing the classification interval and misclassified samples; g: RBF kernel parameter, controlling the decay rate of sample similarity. The smaller g is, the more sensitive the model is to local features.
[0119] Prediction stage:
[0120] For each new sample x, substitute it into the K trained hyperplane models:
[0121] f j (u)=∑ i∈SV a ij y ij K(u i ,u)+b j ,j=1,2,…,k
[0122] Among them, SV: support vector set; α ij : Lagrange multiplier, reflecting the contribution of samples to the hyperplane;
[0123] Then choose such that f j The category j with the largest (x) value is used as the predicted category of sample x:
[0124]
[0125] like Figure 4 As shown, the training process of the electrical fire graded warning model based on SVM in the embodiment of the present invention includes:
[0126] The gas fire risk prediction values and environmental parameters are standardized, and the data is then divided into training, validation, and test sets. Preliminary experiments are then conducted to determine the kernel function parameter range, optimize the penalty parameter C and kernel function parameter g, and combine these two into a parameter combination to be tuned. A grid search and cross-validation method is used to traverse the parameter space. If the model accuracy A exceeds 90%, the optimal parameters (C, g) are recorded and the test set accuracy is output, completing the process. This entire process aims to ensure that the model achieves high accuracy requirements for electrical fire risk prediction through systematic parameter optimization.
[0127] S5. Use the trained overall model consisting of the two-stage electrical fire risk prediction model and the electrical fire graded warning model to perform graded warnings for the electrical fire risks to be warned.
[0128] The collected electrical parameter data and environmental parameter data are input into the overall model, and the corresponding fire risk level is output.
[0129] like Figure 5 As shown, an embodiment of the present invention further provides a robust hierarchical early warning system for electrical fire risks based on HL-Transformer and SVM, the system comprising:
[0130] An acquisition module 510 is configured to acquire and pre-process parameter data related to electrical fire risks and corresponding risk value data and risk level data, wherein the parameter data includes electrical parameter data and environmental parameter data, and construct an electrical fire data set;
[0131] A correlation calculation module 520 is used to calculate the correlation between the pre-processed parameter data and the risk value data;
[0132] The first training module 530 is used to calculate the correlation coefficient greater than the preset threshold θ thThe parameter data and the risk value data as labels are input and trained into the first-stage electrical fire risk prediction model based on the HL-Transformer model to predict the electrical fire risk value and obtain the electrical fire risk prediction value;
[0133] A second training module 540 is configured to input the electrical fire risk prediction value, environmental parameter data, and risk level data as labels into a second-stage SVM-based electrical fire graded warning model to classify electrical fire risk warning levels;
[0134] The graded warning module 550 is used to use the trained overall model consisting of the two-stage electrical fire risk prediction model and the electrical fire graded warning model to provide graded warnings for the electrical fire risks to be warned.
[0135] An embodiment of the present invention provides a robust graded early warning system for electrical fire risks based on HL-Transformer and SVM. Its functional structure corresponds to an embodiment of the present invention provides a robust graded early warning method for electrical fire risks based on HL-Transformer and SVM, which will not be repeated here.
[0136] Figure 6 3 is a structural diagram of an electronic device 300 provided in an embodiment of the present invention. The electronic device 600 may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 601 and one or more memories 602, wherein the memory 602 stores at least one instruction, and the at least one instruction is loaded and executed by the processor 601 to implement the steps of the above-mentioned robust hierarchical warning method for electrical fire risks based on HL-Transformer and SVM.
[0137] In an exemplary embodiment, a computer-readable storage medium is also provided, such as a memory device including instructions. The instructions are executable by a processor in a terminal to implement the robust hierarchical early warning method for electrical fire risk based on HL-Transformer and SVM. For example, the computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, or optical data storage device.
[0138] Those skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware, or by a program to instruct the relevant hardware, and the program may be stored in a computer-readable storage medium, which may be a read-only memory, a disk, or an optical disk, etc.
[0139] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A robust hierarchical early warning method for electrical fire risk based on HL-Transformer and SVM, characterized by: The method comprises: S1. Acquire and preprocess parameter data related to electrical fire risks and corresponding risk value data and risk level data, wherein the parameter data includes electrical parameter data and environmental parameter data, and construct an electrical fire data set; S2. Calculate the correlation between the preprocessed parameter data and the risk value data; S3, the correlation coefficient is greater than the preset threshold θ th The parameter data and the risk value data as labels are input and trained into the first-stage electrical fire risk prediction model based on the HL-Transformer model to predict the electrical fire risk value and obtain the electrical fire risk prediction value; S4. Inputting the electrical fire risk prediction value, environmental parameter data, and risk level data as labels into a second-stage SVM-based electrical fire graded warning model for training, and classifying electrical fire risk warning levels; S5. Use the trained overall model consisting of the two-stage electrical fire risk prediction model and the electrical fire graded warning model to perform graded warnings for the electrical fire risks to be warned.
2. The method according to claim 1, characterized in that The electrical parameter data includes: current, voltage, power and maximum current; the environmental parameter data includes: oxygen content, temperature and humidity; after calculating the correlation using the Pearson correlation coefficient, the obtained correlation coefficient is greater than the preset threshold θ th The parameter data are current, voltage, and power in the electrical parameter data. The current, voltage, power and risk value data as labels are input and trained into the first stage electrical fire risk prediction model based on the HL-Transformer model.
3. The method according to claim 1, characterized in that The electrical fire risk prediction model based on the HL-Transformer model includes: a fully connected layer, a position encoding layer, multiple stacked encoder layers, a Hodges-Lehmann pooling layer, a dropout layer, a fully connected layer, and a dropout layer; The fully connected layer maps the input parameter data to a high-dimensional embedding space, providing a richer feature representation for the model. The position encoding layer performs position encoding on the data through sine and cosine functions of different frequencies, and adds the position encoding to the data, which can be expressed as follows: X=x+PE In the above formula, pos: represents the position of the element in the input sequence, and its value range is from 0 to max_length-1, and max_length is the maximum length of the input sequence; i: represents the dimension of the position encoding tensor, and its value range is from 0 to d model is the embedding dimension of the model; x: represents the output of the fully connected layer; X: represents the output of the position encoding layer; The multiple stacked encoders gradually fuse global information to extract electrical fire risk features from the data; The Hodges-Lehmann Pooling performs a dimensionality reduction operation on the features output by the multiple stacked encoders using the Hodges-Lehmann estimation method, thereby reducing computational complexity and enhancing model robustness while retaining key features, thereby obtaining more discriminative electrical fire risk features. The features are then passed through the Dropout layer, the fully connected layer, and the Dropout layer to output the electrical fire risk prediction value.
4. The method according to claim 3, characterized in that The processing of the multiple stacked encoders includes: First, it is processed by a multi-head self-attention mechanism. By parallelly calculating the association weights between all positions in the input sequence, it captures the long-range dependencies between different positions in the sequence and generates attention features that integrate global context information. The attention features are then randomly inactivated through the Dropout layer and directly added to the original input through the residual connection to preserve the initial information flow, and then the feature distribution is stabilized through the layer normalization layer; The normalized result is input into the fully connected layer for dimensional expansion, and the ReLU activation function is applied for nonlinear transformation, and then compressed back to the original embedding dimension to enhance the feature expression ability and form a high-order feature representation. After Dropout, the residual is added to the previous normalized result for the second time, and then the output of the encoder is obtained through the second layer normalization layer.
5. The method according to claim 3, characterized in that The Hodges-Lehmann Pooling process includes: Assume that the shape of the tensor output from the multiple stacked encoders is (batch_size, steps, features), where batch_size is the batch size; steps is the number of time steps; features is the number of features per time step; For each feature of each data sample, the Hodges-Lehmann HL value is taken at all time steps. The output tensor shape is (batch_size, features), which removes the time step dimension and only retains the feature dimension. Assume that the input tensor is X i,j,k , represents the kth eigenvalue of the jth time step of the i-th sample, then: Among them, S is the number of time steps; Y i,k is the Hodges-Lehmann value of the kth feature of the i-th sample, which is the more discriminative electrical fire risk feature. The specific calculation method is: vec(M)=[M 1,1 ,M 1,2 ,…,M 1,S ,M 2,1 ,…,M S,S ] vec(M) sorted =[M (1) ,M (2) ,…,M (S2) ] Where M is an S×S stacked matrix constructed by traversing all m and n and calculating the arithmetic mean; vec(M) is a one-dimensional array obtained by flattening the matrix M; vec(M) sorted : One-dimensional array sorted in ascending order.
6. The method according to claim 1, characterized in that The electrical fire graded warning model based on SVM consists of an input layer, a support vector machine layer and an output layer; The input layer integrates electrical fire risk prediction values and environmental parameters. This is because electrical fire risk is essentially the result of the dynamic coupling between the electrical system state and the external environment. While the electrical fire risk prediction value can reflect the internal risk characteristics of the equipment, the probability of fire occurrence is also affected by the multi-physics coupling mechanism of the environment: temperature increases accelerate material thermal decomposition and arc triggering, humidity changes lead to nonlinear fluctuations in insulation resistance, and oxygen content is directly related to combustion conditions. The support vector machine layer uses the Gaussian kernel function to extract features and classify the input data. The Gaussian kernel function can effectively measure the similarity between samples, allowing similar samples to be better clustered together, thereby improving the linear separability and classification effect of the model. Output layer, outputs the corresponding fire risk level.
7. The method according to claim 6, characterized in that The support vector machine layer adopts the one-to-many OvR strategy principle for classification; The training phase: For a multi-classification problem with K categories, train K binary SVM models. For the jth category, mark the samples belonging to this category as y ij =1, and the samples of the remaining K-1 categories are marked as y ij =-1; For each binary classification problem, we need to find a hyperplane that can separate the j-th class samples from the other class samples as much as possible and maximize the interval. The search for this hyperplane is obtained by solving the following optimization problem: Among them, w j : The normal vector of the j-th hyperplane, which determines the direction of the hyperplane; ξ ij : The slack variable of the i-th sample in the j-th class classifier, allowing the sample to slightly violate the classification interval constraint; b j : The bias term of the j-th hyperplane, which adjusts the position of the hyperplane in space to maximize the classification interval; φ(u i ): Through the RBF kernel function K(u i ,u j )=exp(-g||u i -u j || 2 ) implicitly maps to a high-dimensional space; C: penalty coefficient, balancing the classification interval and misclassified samples; g: RBF kernel parameter, controlling the decay rate of sample similarity. The smaller g is, the more sensitive the model is to local features. Prediction stage: For each new sample x, substitute it into the K trained hyperplane models: f j (u)=∑ i∈SV a ij y ij K(u i ,u)+b j ,j=1,2,…,k Among them, SV: support vector set; α ij : Lagrange multiplier, reflecting the contribution of samples to the hyperplane; Then choose such that f j The category j with the largest (x) value is used as the predicted category of sample x:
8. A robust hierarchical early warning system for electrical fire risk based on HL-Transformer and SVM, characterized by: The system comprises: An acquisition module is used to acquire and preprocess parameter data related to electrical fire risks and corresponding risk value data and risk level data, wherein the parameter data includes electrical parameter data and environmental parameter data, and construct an electrical fire data set; A correlation calculation module is used to calculate the correlation between the preprocessed parameter data and the risk value data; The first training module is used to calculate the correlation coefficient greater than the preset threshold θ th The parameter data and the risk value data as labels are input and trained into the first-stage electrical fire risk prediction model based on the HL-Transformer model to predict the electrical fire risk value and obtain the electrical fire risk prediction value; A second training module is used to input the electrical fire risk prediction value, environmental parameter data, and risk level data as labels into a second-stage SVM-based electrical fire graded warning model to classify electrical fire risk warning levels; The graded warning module is used to use the trained overall model consisting of a two-stage electrical fire risk prediction model and an electrical fire graded warning model to provide graded warnings for electrical fire risks to be warned.
9. An electronic device comprising a processor and a memory, wherein the memory stores at least one instruction, characterized in that: The at least one instruction is loaded and executed by the processor to implement the robust hierarchical early warning method for electrical fire risks based on HL-Transformer and SVM as described in any one of claims 1 to 7.
10. A computer-readable storage medium, wherein at least one instruction is stored in the storage medium, characterized in that: The at least one instruction is loaded and executed by the processor to implement the robust hierarchical warning method for electrical fire risk based on HL-Transformer and SVM as described in any one of claims 1 to 7.