A fire alarm prediction method and device based on high-order markov chain
By preprocessing and optimizing the historical state sequence data of fire-fighting equipment using a high-order Markov chain model, the problems of high data requirements and difficulty in capturing complex relationships in fire risk prediction in time series analysis are solved, and rapid and accurate short-term prediction of fuzzy data is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2026-03-24
AI Technical Summary
Existing time series analysis methods for fire risk prediction have high data requirements, are sensitive to model parameter selection, and are difficult to capture complex relationships, resulting in insufficient accuracy and reliability of the analysis.
By employing a high-order Markov chain model, preprocessing historical state sequence data of fire-fighting equipment, constructing a state space and state transition probability matrix, and optimizing model parameters using a linear programming solver, rapid analysis and short-term prediction of fuzzy data can be achieved.
It improves the accuracy and reliability of fire risk prediction, and can capture complex state transition relationships and dynamic changes based on a small amount of data in a short period of time, reducing the demand for computing resources and adapting to different data characteristics and prediction needs.
Smart Images

Figure CN119397204B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of fire safety management, and in particular to a fire alarm prediction method and device based on a high-order Markov chain. BACKGROUND
[0002] Fire is sudden and destructive, and once it occurs, it can cause serious casualties and property losses. Through scientific and effective fire safety management, prediction and decision-making can be made to timely identify and eliminate fire hazards, develop emergency plans, ensure the normal operation of fire facilities and equipment, and improve fire prevention and emergency response capabilities. This not only helps to reduce the occurrence and harm of fire accidents, but also improves the overall sense of security and ability to respond to emergencies of society, thereby maintaining public safety and social order.
[0003] Currently, the commonly used prediction method in fire safety management is time series analysis. Time series analysis is a powerful statistical method for studying data that changes over time, which can identify trends, seasonality, and periodicity in data, and thus predict future fire risk trends. Time series is a collection of observations arranged in chronological order, such as the number of fire alarms per day. Time series analysis aims to reveal patterns and trends in data for prediction and decision-making.
[0004] However, time series analysis has the following shortcomings:
[0005] 1: High requirements for data: time series analysis requires a long enough history of data, and the data should have certain stability and trend. If the data quality is poor or the historical data is insufficient, it may affect the accuracy and reliability of the analysis. Generally, the input is required to be quantitative data, not fuzzy data such as the state of the system.
[0006] 2: Sensitive to model parameter selection: time series analysis involves selecting appropriate models and parameters, including lag order, seasonal period, etc. The selection of model parameters has a great influence on the analysis results, but it is often difficult to determine the best parameter data.
[0007] 3: Cannot capture complex relationships: time series analysis mainly focuses on historical patterns and trends in data, but often cannot capture complex nonlinear relationships and interactions in data. In fire risk prediction, there may be complex relationships between multiple influencing factors, and time series analysis is difficult to fully capture these relationships.
[0008] Therefore, there is an urgent need for a method to quickly analyze the state of a fuzzy system through short-term data to predict short-term fire risks. SUMMARY
[0009] Therefore, the application provides a fire alarm prediction method and device based on a high-order Markov chain, which realizes rapid analysis of fuzzy system states through short-term data to predict short-term fire risks.
[0010] Specifically, the application is realized through the following technical solutions.
[0011] The first aspect of the application provides a fire alarm prediction method based on a high-order Markov chain, which comprises the following steps:
[0012] The sub-sequences in historical state sequence data of a fire-fighting device are converted into numerical values to form a first state sequence of the fire-fighting device, the historical state sequence data is vector data generated after fire alarm states are arranged in chronological order, the historical state sequence data comprises a plurality of sub-sequences, each sub-sequence represents a fire alarm state at different time, and the first state sequence comprises a plurality of first state numerical values;
[0013] A state space is determined based on the first state sequence of the fire-fighting device, and the size of the state space is consistent with the number of all change combinations between adjacent data in the first state sequence;
[0014] The order of a high-order Markov chain model is determined based on the length of the historical state sequence data, a state transition probability matrix is calculated based on the first state sequence, and the high-order Markov chain model is constructed based on the order, the state transition probability matrix, and the first state sequence;
[0015] A model parameter of the high-order Markov chain model is obtained by solving a target function under a constraint condition based on a linear programming solver, and the high-order Markov chain model is constructed based on the solving result, the target function is determined based on the state transition probability matrix and the first state sequence, the constraint condition is determined based on the first state sequence, and the high-order Markov chain model is used to predict a fire alarm state in a first time period based on a plurality of sub-sequences adjacent to the first time period in the first state sequence;
[0016] The fire alarm state in the first time period is predicted based on the high-order Markov chain model, and the length of the first time period is less than the size of the order.
[0017] The second aspect of the application provides a fire alarm prediction device based on a high-order Markov chain, which comprises a conversion module, a determination module, a construction module, and a prediction module, wherein,
[0018] The conversion module is configured to convert a sub-sequence in historical state sequence data of the fire-fighting equipment into a numerical value to form a first state sequence of the fire-fighting equipment, the historical state sequence data is vector data generated by arranging fire alarm states in chronological order, the historical state sequence data includes a plurality of sub-sequences, each of the sub-sequences represents a fire alarm state at a different time, and the first state sequence includes a plurality of first state numerical values;
[0019] The determination module is configured to determine a state space based on the first state sequence of the fire-fighting equipment, and a size of the state space is consistent with a number of all change combinations between adjacent data in the first state sequence.
[0020] The determination module is further configured to determine an order of a high-order Markov chain model based on a length of the historical state sequence data, calculate a state transition probability matrix based on the first state sequence, and construct the high-order Markov chain model based on the order and the state transition probability matrix.
[0021] The construction module is configured to solve a target function under a constraint condition based on a linear programming solver to obtain model parameters of the high-order Markov chain model, and obtain an optimized high-order Markov chain model based on a solution result, the target function is determined based on the state transition probability matrix and the first state sequence, the constraint condition is determined based on the first state sequence, and the high-order Markov chain model is used to predict a fire alarm state in a first time period based on a plurality of sub-sequences adjacent to a first time period in the first state sequence.
[0022] The prediction module is configured to predict the fire alarm state in the first time period based on the high-order Markov chain model, and a length of the first time period is less than a size of the order.
[0023] This application provides a fire alarm prediction method and apparatus based on a high-order Markov chain. Firstly, by preprocessing historical state sequence data of fire-fighting equipment to obtain a first state sequence, a Markov chain model is constructed based on this first state sequence. Then, the fire alarm state and alarm type for future dates are predicted based on the Markov chain model. Since the historical state sequence data of fire-fighting equipment is fuzzy data, it is difficult to quantify. Compared to traditional time series analysis, which requires quantitative data, this application achieves rapid analysis of fire alarm states based on fuzzy data through fuzzy data processing. Furthermore, this application considers states at multiple points in time, requiring only data up to two weeks to achieve short-term predictions. It can capture the time-delayed effects and long-term trends of fire risks, calculate the state probability for the next few days to weeks, and has low computational resource requirements. Secondly, the Markov chain model constructed in this application has a more flexible model structure. It can flexibly adjust its order and state transition probability matrix according to historical state sequence data to adapt to different data characteristics and prediction needs. It can also more accurately capture the transition relationships between different states, thereby improving the accuracy and reliability of fire risk prediction. In contrast, time series analysis usually requires the selection of specific model types and parameters, lacking flexibility. Thirdly, since the historical state sequence data of fire-fighting equipment has complex periodic changes and its periodic changes are relatively fast, the first-order Markov chain model alone may not be able to fully capture these change patterns. This application uses a higher-order Markov chain model and performs linear optimization on the higher-order Markov chain model to more accurately capture the dynamic changes and dependencies in the data, thereby improving the accuracy of short-term prediction. Attached Figure Description
[0024] Figure 1 A flowchart of an embodiment of the fire alarm prediction method based on a high-order Markov chain provided in this application;
[0025] Figure 2 This is a schematic diagram of the structure of a fire alarm prediction device based on a high-order Markov chain provided in this application. Detailed Implementation
[0026] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application.
[0027] The terminology used in this application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. The singular forms “a,” “the,” and “the” used herein are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any and all possible combinations of one or more of the associated listed items.
[0028] It should be understood that although the terms first, second, third, etc., may be used in this application to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of this application, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to determination."
[0029] The following specific embodiments are given to illustrate the technical solution of this application in detail.
[0030] Figure 1 This is a flowchart of an embodiment of the fire alarm prediction method based on a high-order Markov chain provided in this application. Please refer to... Figure 1 The method provided in this embodiment may include:
[0031] S101. Convert the subsequences in the historical state sequence data of the fire-fighting equipment into numerical values to form the first state sequence of the fire-fighting equipment. The historical state sequence data is vector data generated by arranging the fire alarm states in chronological order. The historical state sequence data includes multiple subsequences, each of which represents the fire alarm state at a different time. The first state sequence includes multiple first state values.
[0032] Specifically, the historical state sequence data of fire-fighting equipment represents the fire alarm status of the equipment at different points in time. It is vector data obtained by arranging the fire alarm statuses in chronological order. The historical state sequence data includes multiple sub-sequences, each representing the fire alarm status of the fire-fighting equipment at different times. The fire alarm statuses include false alarms, alarms, and no alarms. The first state sequence includes multiple first state values, each representing a fire alarm status.
[0033] In practice, each subsequence in the historical state sequence data of fire-fighting equipment is traversed, and the subsequences are sorted according to the time point recorded in each subsequence. Furthermore, the subsequences are converted into numerical values according to the different fire alarm states, that is, subsequences corresponding to the same fire alarm state are assigned the same numerical value, and subsequences corresponding to different fire alarm states are assigned different numerical values.
[0034] For example, based on the above description, when the fire alarm status is a false alarm, the corresponding value is 0; when the fire alarm status is an alarm, the corresponding value is 1; and when the fire alarm status is not an alarm, the corresponding value is 2.
[0035] The method provided in this embodiment converts subsequences in historical state sequence data into numerical values. Firstly, numerical data is easier to analyze statistically, recognize patterns, and predictively model. Compared to text or symbols, numerical data can be directly applied to mathematical operations and algorithms, facilitating complex data processing tasks such as time series analysis, anomaly detection, and trend prediction. Secondly, numerical data occupies less storage space and is read and processed faster. This is particularly important for systems that require real-time monitoring and response to fire risks. Numericalization reduces the burden of storage and computation, improving overall system performance and response speed. Thirdly, numericalization standardizes state data from different devices or time points, making comparison, summarization, and comprehensive analysis easier. This helps discover patterns in the state changes of different devices or identify correlations and dependencies between multiple devices, thereby improving the accuracy and reliability of fire risk prediction.
[0036] Optionally, the process of acquiring the historical state sequence data includes:
[0037] (1) Obtain the target data document; the target data document includes at least historical state sequence data.
[0038] Specifically, the target data document is fire equipment alarm review data, which includes equipment number, equipment type, fire alarm status, alarm type, alarm time, review time, review reason, and review type.
[0039] In practice, fire equipment alarm verification data is read from relevant websites or files.
[0040] (2) The target data documents are filtered based on the equipment number of the fire-fighting equipment to obtain the first target data document corresponding to each fire-fighting equipment.
[0041] Specifically, the fire equipment alarm verification data records data documents for different devices, with each device corresponding to a target data document.
[0042] In practice, based on the equipment number corresponding to the fire-fighting equipment, the equipment number is entered in the search bar to filter and obtain the first target data document corresponding to the fire-fighting equipment.
[0043] (3) Extract the status features from the first target data document to obtain the historical status sequence data of the fire-fighting equipment.
[0044] Specifically, the historical status sequence data of fire-fighting equipment includes the fire alarm status and alarm type of the fire-fighting equipment.
[0045] In specific implementation, the step of extracting state features from the first target data document to obtain historical state sequence data of fire-fighting equipment includes: converting the format of the historical state sequence data in the first target data document to obtain first historical state sequence data; the first historical state sequence data includes dates and fire alarm states corresponding to the dates; sorting and classifying the first historical state sequence data based on the dates, and assigning numbers to the first historical state sequence data based on the sorting and classification results; and performing deduplication and missing data processing on the classified first historical state sequence data to obtain historical state sequence data of fire-fighting equipment.
[0046] Specifically, the time points recorded in the historical state sequence data include both the date and the specific time. When predicting the status of fire-fighting equipment, we only care whether an alarm occurred every day, and not the specific time of day the alarm occurred. Therefore, it is necessary to convert the format of the historical state sequence data to remove the specific time. The converted first historical state sequence data only contains the date and the corresponding fire alarm status.
[0047] Furthermore, the first historical state sequence data is sorted in ascending order according to the year, month, and day recorded in the date, and each subsequence in the first historical state sequence data is numbered based on the sorting result. Next, the sorted and categorized first historical state sequence data is deduplicated by checking for duplicate numbers to eliminate duplicate subsequences. Finally, the deduplicated first historical state sequence data is processed to fill in or delete missing data points.
[0048] The method provided in this embodiment, firstly, removes the time points from the historical state sequence data to obtain first historical state sequence data containing only dates, along with the corresponding fire alarm status and alarm type. This standardized structure represents the time point and status information of each record, simplifying the subsequent construction of the Markov chain model and allowing focus on predicting alarm probabilities on a daily basis. Secondly, sorting and classifying the first historical state sequence data based on dates ensures the data's temporal continuity and consistency, facilitating better analysis of fire equipment status change trends. Deduplication and missing data processing of the classified first historical state sequence data ensures data uniqueness, avoiding bias in analysis results due to duplicate data, improving data integrity and reliability, and ensuring accurate results during data analysis and modeling. In summary, by extracting status features from the first target data document, complete, continuous, and accurate historical state sequence data of fire equipment can be obtained, providing a reliable foundation for further analysis and decision-making.
[0049] S102. Determine the state space based on the first state sequence of the fire-fighting equipment; the size of the state space is consistent with the number of all possible combinations of changes between adjacent data in the first state sequence.
[0050] Specifically, the state space represents the transition relationship between different first state values, and the size of the state space is consistent with the number of all combinations of changes between adjacent data in the first state sequence.
[0051] In practice, the first state sequence is traversed to determine the number of different first state values. Based on the determined number of different first state values, this number is used as the number of rows and columns of the state space to determine the size of the state space. The row and column numbers are used to determine the transition relationship between different first state values, which are then used as the state space values for the corresponding rows and columns.
[0052] S103. Determine the order of the high-order Markov chain model based on the length of the historical state sequence data, calculate the state transition probability matrix based on the first state sequence, and construct the high-order Markov chain model based on the order and the state transition probability matrix.
[0053] Specifically, higher-order Markov chain models are used to describe the stochastic changes of a system between a series of states. The order of a higher-order Markov chain model determines how many past states the future state is related to; the higher the order, the more states there are, and the greater the complexity. When the order is 1, the future state depends only on the current state and is independent of previous states. When the order is 2, the future state depends on the current state and the previous state. When the order is k, the future state depends on the current state and the (k-1)th previous state.
[0054] In specific implementation, determining the order of the high-order Markov chain model based on the length of the historical state sequence data includes: traversing the historical state sequence data to determine its length; the length characterizing the number of subsequences contained in the historical state sequence data; determining the range of the Markov chain order based on the length of the historical state sequence data; the length of the historical state sequence data being positively correlated with the order; dividing the historical state sequence data into a training set and a validation set according to a preset ratio; performing cross-validation on the high-order Markov chain model corresponding to each order for the range of orders; calculating the average validation error; and determining the order of the high-order Markov chain model corresponding to the high-order Markov chain model with the smallest average validation error as the order of the high-order Markov chain model.
[0055] Specifically, the length of the historical state sequence data is positively correlated with the order of the higher-order Markov chain model. Within a certain range, the longer the historical state sequence data, the higher the order of the higher-order Markov chain model; conversely, the shorter the historical state sequence data, the lower the order of the higher-order Markov chain model. The preset ratio is set according to actual needs, and this embodiment does not limit it. For example, in one embodiment, the preset ratio is 4:1.
[0056] In practice, the historical state sequence data is traversed to determine the number of subsequences contained within it, i.e., the length of the historical state sequence data. By fitting the length of the historical state sequence data, and based on the relationship between the length and the order of the high-order Markov chain model, the range of the high-order Markov chain model's order is obtained. Further, the historical state sequence data is divided into a training set and a validation set according to a preset ratio. Starting from the minimum order, the high-order Markov chain model is trained sequentially using the training set. After training, the performance of the high-order Markov chain model is verified using the validation set, and its average validation error is calculated. The order is increased, and this training process is repeated until the order reaches its maximum value. By comparing the average validation errors corresponding to all orders, the order of the high-order Markov chain model with the smallest average validation error is determined as the order of the high-order Markov chain model.
[0057] Optionally, determining the order of the high-order Markov chain model based on the length of the historical state sequence data includes: determining the number of subsequences in the historical state sequence data; determining the order of the high-order Markov chain model as the maximum order based on the number and proportion of the subsequences; determining candidate historical state sequence data within the maximum order time period before the first time period; fitting the change trend in the candidate historical state sequence data; removing abnormal data from the candidate historical state sequence data based on the change trend, wherein the difference between the abnormal data and the change trend is greater than a preset value; and determining the order of the high-order Markov chain model based on the historical state sequence data after removing the abnormal data.
[0058] The method provided in this embodiment, firstly, through subsequence partitioning and trend fitting, allows the high-order Markov chain model to automatically identify pattern complexity in historical state sequence data, thereby automatically adjusting the order and avoiding errors from manual adjustment. This results in good generalization performance across different datasets. Furthermore, a reasonable order selection avoids overfitting caused by excessively large orders. If the order is too large, the high-order Markov chain model will focus on too much historical data, potentially treating noise or outlier states as patterns for learning, thus affecting prediction performance. Secondly, by removing outliers and imposing reasonable maximum order constraints, the model's generalization ability can be improved. By reasonably determining the order of the high-order Markov chain, the model can better capture long-term dependent features in historical sequences. The high-order Markov chain model predicts future states using longer historical state sequence data, which is particularly effective when complex dependencies exist between states. Moreover, outliers or abrupt changes often exist in historical state sequence data, directly affecting the fitting and order selection of the high-order Markov chain model. Removing these outliers allows for a more accurate reflection of data trends, making higher-order Markov chain models more robust and reducing the interference of noise on the model's order.
[0059] Furthermore, the step of calculating the state transition probability matrix based on the first state sequence includes:
[0060] (1) Traverse the first state sequence to determine the different categories of fire alarm states contained in the first state sequence.
[0061] Specifically, based on the above description, the first state sequence includes multiple first state values, each of which represents a fire alarm state; that is, the first state sequence includes multiple fire alarm states.
[0062] In practice, the system iterates through each first state value in the first state sequence and counts the different categories of fire alarm states contained in the first state sequence.
[0063] For example, in one embodiment, the first state sequence is {0, 1, 1, 1, 0, 0, 1}, which contains two different categories of fire alarm states, namely 0 and 1.
[0064] (2) Based on the first state sequence, determine all ordered state groups; the ordered state groups represent the state transition between different categories of fire alarm states.
[0065] Specifically, an ordered state group consists of two consecutive first state values in the first state sequence, which represent the state transition between different categories of fire alarm states.
[0066] For example, combining the above example, the first state sequence is {0, 1, 1, 1, 0, 0, 1}, which contains two different categories of fire alarm states, namely 0 and 1. At this time, the ordered state group includes (0, 0), (0, 1), (1, 0), and (1, 1).
[0067] (3) Traverse the first state sequence to determine the number of each ordered state group.
[0068] In practice, the first state sequence is traversed to determine the number of each ordered state group in the first state sequence.
[0069] For example, combining the above example, when the first state sequence is {0, 1, 1, 1, 0, 0, 1} and the ordered state group includes (0, 0), (0, 1), (1, 0), and (1, 1), the number of each ordered state in the first state sequence is: (0, 0) once, (0, 1) twice, (1, 0) once, and (1, 1) twice.
[0070] (4) Construct a state transition frequency matrix based on the number of each ordered state group and the number of different types of fire alarm states; each element in the state transition frequency matrix represents the number of each state transition situation; the size of the state transition frequency matrix is related to the number of different types of fire alarm states.
[0071] Specifically, each element of the state transition frequency matrix represents the number of each ordered state group, i.e., the number of each state transition scenario. The size of the state transition frequency matrix is positively correlated with the different categories of fire alarm states contained in the first state sequence.
[0072] In practice, the number of each ordered state group is sequentially filled into each column of the state transition frequency matrix according to the order in which they are formed. The number of columns in the state transition frequency matrix is determined by the different categories of fire alarm states contained in the first state sequence. For example, if the first state sequence contains two different fire alarm states, then the state transition frequency matrix is a 2x2 matrix.
[0073] For example, combining the above example, if the first state sequence is {0, 1, 1, 1, 0, 0, 1}, and the ordered state groups include (0, 0), (0, 1), (1, 0), and (1, 1), and each ordered state appears once in the first state sequence, (0, 0) once, (0, 1) twice, (1, 0) once, and (1, 1) twice respectively, then the state transition frequency matrix is: .
[0074] (5) Normalize the state transition frequency matrix to obtain the state transition probability matrix.
[0075] Specifically, each element of the state transition probability matrix represents the probability of each state transition situation out of all state transition situations, and the size of the state transition probability matrix is related to the number of different categories of fire alarm states contained in the first state sequence.
[0076] In a specific implementation, the normalization process of the state transition frequency matrix to obtain the state transition probability matrix includes: traversing the state transition frequency matrix to determine the number of each state transition condition and the total number of all state transition conditions; calculating the proportion of each state transition condition to all state transition conditions based on the number of each state transition condition and the total number of all state transition conditions; constructing the state transition probability matrix based on the proportion and the number of different categories of fire alarm states; each element in the state transition probability matrix represents the probability of each state transition condition to all state transition conditions, and the size of the state transition probability matrix is related to the number of different categories of fire alarm states.
[0077] Specifically, the state transition frequency matrix is traversed to determine the number of each ordered state group, i.e., the number of each state transition scenario. Then, the number of all state transition scenarios in each column of the state transition frequency matrix is summed to obtain the total number of state transition scenarios in each column. Further, the proportion of each state transition scenario to the total number of state transition scenarios in each column is calculated, and these proportions are sequentially filled into each column of the state transition probability matrix. The number of columns in the state transition probability matrix is determined by the different categories of fire alarm states included in the first state sequence. For example, if the first state sequence contains two different states, then the state transition probability matrix is a 2x2 matrix.
[0078] For example, combining the above example, the state transition frequency matrix is: When, the state transition probability matrix is .
[0079] Furthermore, based on the order and state transition probability matrix of the higher-order Markov chain, a higher-order Markov chain model can be constructed. The higher-order Markov chain model can be determined according to the following formula:
[0080] ;
[0081] Among them, the for The 1-order Markov chain model; for - The 1 / 2 Markov chain model; This is the starting moment of the historical sequence; the stated This refers to the final moment of the historical sequence; the stated... The moment of the state to be predicted; the The order of the high-order Markov chain model; These are the model parameters for a high-order Markov chain model; for The product of state transition probability matrices; This refers to the system status.
[0082] The method provided in this embodiment utilizes a higher-order Markov chain model, which offers a more flexible model structure. This model can adjust its order and state transition probability matrix based on historical state sequence data to adapt to different data characteristics and prediction needs. Furthermore, it can more accurately capture the transition relationships between different states, thereby improving the accuracy and reliability of fire risk prediction. In contrast, time series analysis typically requires selecting specific model types and parameters, lacking flexibility.
[0083] S104. Solve the objective function under constraints using a linear programming solver to obtain the model parameters of the higher-order Markov chain model. Based on the solution results, obtain the optimized higher-order Markov chain model. The objective function is determined based on the state transition probability matrix and the first state sequence. The constraints are determined based on the first state sequence. The higher-order Markov chain model is used to predict the fire alarm status of the first time period based on the first number of subsequences of the first order adjacent to the first time period in the first state sequence.
[0084] Specifically, the model parameters of a higher-order Markov chain model represent the linear combination parameters of each subsequence. The objective function is used to solve for the model parameters of the higher-order Markov chain model, and it is determined by the state transition probability matrix and the first state sequence. The constraints are used to constrain the stationary states in the first state sequence, and they are determined by the first state sequence.
[0085] Furthermore, the constraints include nonnegativity constraints, stationary state constraints, frequency constraints, and probability normalization constraints. Based on the defined objective function (e.g., minimizing the sum of the elements of the state transition probability matrix), nonnegativity constraints, stationary state constraints, frequency constraints, and probability normalization constraints are added. A linear programming solver is then used to solve for the optimal transition probability matrix under these constraints, thereby obtaining the required model parameters.
[0086] In specific implementation, the step of solving the objective function under constraints using a linear programming solver includes:
[0087] (1) Select a number of consecutive stationary states of the first state value from the first state sequence based on the order of the higher-order Markov chain model; the difference between the preset number and the order is 1, and the preset number is greater than the order; the stationary state represents the probability of different fire alarm states in the first state sequence.
[0088] Specifically, the difference between the preset quantity and the order of the higher-order Markov chain model is 1, and the preset quantity is greater than the order. Each first state value represents a fire alarm state. A stationary state refers to the probability of different fire alarm states in the first state sequence, which can be expressed as: , wherein To maintain a stable state, the , , These represent different fire alarm states in the first state sequence.
[0089] In practice, a predetermined number of consecutive first state values in a stable state are selected from the first state sequence.
[0090] (2) Determine the objective function based on the first state value, the state transition probability matrix, and the model parameters corresponding to the state transition probability matrix.
[0091] In a specific implementation, determining the objective function based on the first state value, the state transition probability matrix, and the model parameters corresponding to the state transition probability matrix includes: determining the intermediate parameter as the product of each first state value (excluding the target first state value) with the state transition probability matrix and the model parameters corresponding to the state transition probability matrix; the target first state value is the first state value with the largest number; and determining the objective function as the difference between the target first state value and each of the intermediate parameters.
[0092] Specifically, based on the above description, each first state value corresponds to a power representation of a state transition probability matrix. Since the first state values selected from the first state sequence are arranged in order, the target first state value represents the first state value with the largest number among the first state values.
[0093] In practical implementation, taking a second-order Markov chain model as an example, when the training set length is 7 days and the state time unit is days, the objective function can be determined according to the following formula:
[0094] , ;
[0095] Wherein, A is the objective function; For model parameters; the , , The first state data is a predetermined number of first state data selected in descending order from the first state sequence; P is the state transition probability matrix.
[0096] (3) Determine the constraints based on the stationary state.
[0097] In practical implementation, the constraints can be determined based on the following formula:
[0098] ;
[0099] in, , , ;
[0100] Among them, the The first state value; The power of the state transition probability matrix corresponding to the first state value; The power of the state transition probability matrix corresponding to the first state value; For a column vector consisting entirely of 1s, the The constraint matrix is defined by the objective function. and model parameters Composition, the denoted as the order of the high-order Markov chain model.
[0101] (4) Solve the objective function under the constraints based on the linear programming solver to obtain the solution result; the solution result includes the optimal model parameters; the number of the optimal model parameters is the same as the order.
[0102] Specifically, the number of optimal model parameters is determined by the order of the higher-order Markov chain model, and the number of optimal model parameters is the same as the order of the higher-order Markov chain model.
[0103] In practice, based on the determined objective function and constraints, the objective function, constraints, and the range of values for each variable in the objective function are input into the linear programming solver. Based on the solution method built into the linear programming solver, the solution result is output.
[0104] The method provided in this embodiment, in its first aspect, determines the objective function and constraints based on the state transition probability matrix, and then uses a linear programming solver to solve the objective function under the constraints. This yields optimal model parameters, and a Markov chain model is constructed based on these optimal parameters, improving the accuracy and reliability of fire risk prediction. Secondly, the objective function and constraints are determined based on the state transition probability matrix, unlike traditional linear programming methods that assume a linear objective function (i.e., relationships between decision variables are additive and multiplicative) and linear constraints. This approach may not be flexible enough for complex real-world problems. Many practical problems involve constraints that are nonlinear or involve complex interrelationships. Therefore, this application is adapted to more complex and dynamic real-world scenarios and can handle large-scale problems and complex nonlinear relationships.
[0105] S105. Predict the fire alarm status of the first time period based on the high-order Markov chain model; the length of the first time period is less than the order.
[0106] Specifically, the higher-order Markov chain model is used to predict the fire alarm status of the first time period based on the preceding orders of subsequences adjacent to the first time period in the first state sequence. The first time period is set according to actual needs, and this embodiment does not limit it. It should be noted that the length of the first time period is usually less than the order of the higher-order Markov chain model. For example, if the first time period is 1 day and the order of the higher-order Markov chain model is 4, then the fire alarm status of the next day can be predicted based on the fire alarm status of the past 4 days.
[0107] In practice, the order of the subsequences preceding the first time period in the first state sequence are input into the higher-order Markov chain model. The higher-order Markov chain model outputs the state probabilities of the first time period (including the fire alarm state probability). The fire alarm state with the highest state probability is determined as the fire alarm state of the first time period.
[0108] The fire alarm prediction method based on a high-order Markov chain provided in this embodiment has two main aspects. First, by preprocessing the historical state sequence data of fire-fighting equipment, a first state sequence of the fire-fighting equipment is obtained. A Markov chain model is then constructed based on the first state sequence, and the fire alarm state and alarm type for future dates are predicted based on the Markov chain model. Since the historical state sequence data of fire-fighting equipment is fuzzy data, it is difficult to quantify. Compared with traditional time series analysis, which requires quantitative data, this application achieves rapid analysis of fire alarm states based on fuzzy data by processing the fuzzy data. Furthermore, this application considers states at multiple points in time, and short-term prediction can be achieved with data of no more than two weeks. It can capture the time delay effect and long-term trend of fire risk, calculate the state probability in the next few days to weeks, and has low computational resource requirements. Second, the Markov chain model constructed in this application has a more flexible model structure. It can flexibly adjust its order and state transition probability matrix according to the historical state sequence data to adapt to different data characteristics and prediction needs. It can also more accurately capture the transition relationship between different states, thereby improving the accuracy and reliability of fire risk prediction. In contrast, time series analysis usually requires the selection of specific model types and parameters, lacking flexibility. Thirdly, due to the complex and rapid periodic changes in the historical state sequence data of fire-fighting equipment, a first-order Markov chain model alone may not be sufficient to capture these change patterns. This application uses a higher-order Markov chain model and performs linear optimization on it to more accurately capture the dynamic changes and dependencies in the data, thereby improving the accuracy of short-term predictions. Fourthly, by converting the subsequences in the historical state sequence data into numerical values, numerical data is easier to perform statistical analysis, pattern recognition, and predictive modeling. Compared to text or symbols, numerical data can be directly applied to mathematical operations and algorithms, facilitating the execution of complex data processing tasks such as time series analysis, anomaly detection, and trend prediction. Furthermore, numerical data occupies less storage space and has a faster reading and processing speed. This is particularly important for systems that require real-time monitoring and response to fire risks. Numerical processing reduces the burden of storage and computation, improving the overall system performance and response speed. Moreover, through numericalization, the state data of different devices or time points can be standardized, making it easier to compare, summarize, and comprehensively analyze. This helps to discover patterns in the state changes of different devices, or to identify the correlations and dependencies between multiple devices, thereby improving the accuracy and reliability of fire risk prediction.Fifthly, by removing the time from the historical state sequence data, we obtain the first historical state sequence data containing only the date and the fire alarm status and alarm type corresponding to the date. The time point and status information of each record are represented in a standardized structure, which simplifies the subsequent construction of the Markov chain model. We can focus on predicting the alarm probability on a daily basis, reduce the computational load of the model, and improve the accuracy and reliability of the prediction.
[0109] Corresponding to the aforementioned embodiment of a fire alarm prediction method based on a high-order Markov chain, this application also provides an embodiment of a fire alarm prediction device based on a high-order Markov chain.
[0110] Figure 2 This is a schematic diagram of the structure of an embodiment of the fire alarm prediction device based on a high-order Markov chain provided in this application. Please refer to... Figure 2 The apparatus provided in this embodiment includes a conversion module 210, a determination module 220, a construction module 230, and a prediction module 240; wherein,
[0111] The conversion module 210 is used to convert the subsequences in the historical state sequence data of the fire-fighting equipment into numerical values to form the first state sequence of the fire-fighting equipment. The historical state sequence data is vector data generated by arranging the fire alarm states in chronological order. The historical state sequence data includes multiple subsequences, each of which represents the fire alarm state at a different time. The first state sequence includes multiple first state values.
[0112] The determining module 220 is used to determine a state space based on the first state sequence of the fire-fighting equipment; the size of the state space is consistent with the number of all possible combinations of changes between adjacent data in the first state sequence.
[0113] The determining module 220 is further configured to determine the order of the high-order Markov chain model based on the length of the historical state sequence data, calculate the state transition probability matrix based on the first state sequence, and construct the high-order Markov chain model based on the order and the state transition probability matrix.
[0114] The construction module 230 is used to solve the objective function under constraints based on a linear programming solver to obtain the model parameters of the high-order Markov chain model, and to obtain an optimized high-order Markov chain model based on the solution results; the objective function is determined based on the state transition probability matrix and the first state sequence, the constraints are determined based on the first state sequence, and the high-order Markov chain model is used to predict the fire alarm status of the first time period based on the first number of subsequences of the first order adjacent to the first time period in the first state sequence;
[0115] The prediction module 240 is used to predict the fire alarm status of the first time period based on a high-order Markov chain model; the length of the first time period is less than the order.
[0116] The apparatus of this embodiment can be used to perform... Figure 1 The steps of the method embodiment shown are similar in principle and process, and will not be repeated here.
[0117] The specific implementation process of the functions and roles of each unit in the above device can be found in the implementation process of the corresponding steps in the above method, and will not be repeated here.
[0118] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this application according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0119] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.
Claims
1. A fire alarm prediction method based on high-order Markov chains, characterized in that, The method includes: The subsequences in the historical state sequence data of fire-fighting equipment are converted into numerical values to form the first state sequence of fire-fighting equipment. The historical state sequence data is vector data generated by arranging fire alarm states in chronological order. The historical state sequence data includes multiple subsequences, each of which represents a fire alarm state at a different time. The first state sequence includes multiple first state values, each of which represents a fire alarm state. The historical state sequence data includes the fire alarm state and alarm type of the fire-fighting equipment. Specifically, the subsequences are converted into numerical values according to the different fire alarm states, the same numerical value is assigned to the subsequences corresponding to the same fire alarm state, and different numerical values are assigned to the subsequences corresponding to different fire alarm states. The state space is determined based on the first state sequence of the fire-fighting equipment; the size of the state space is consistent with the number of all possible combinations of changes between adjacent data in the first state sequence. The order of the high-order Markov chain model is determined based on the length of the historical state sequence data. A state transition probability matrix is calculated based on the first state sequence. A high-order Markov chain model is constructed based on the order and the state transition probability matrix. The pattern complexity in the historical state sequence data is automatically identified through subsequence partitioning and change pattern fitting, and the order is automatically adjusted. The length of the historical state sequence data is positively correlated with the order. The objective function under constraints is solved using a linear programming solver to obtain the model parameters of a higher-order Markov chain model. An optimized higher-order Markov chain model is obtained based on the solution results. The objective function is determined based on the state transition probability matrix and the first state sequence. The constraints are determined based on the first state sequence. The higher-order Markov chain model is used to predict the fire alarm status of the first time period based on the first order of subsequences adjacent to the first time period in the first state sequence. The fire alarm status for the first time period is predicted based on the high-order Markov chain model; the length of the first time period is less than the order of the model. The determination of the order of the high-order Markov chain model based on the length of the historical state sequence data includes: Determine the number of subsequences in the historical state sequence data; The order of the higher-order Markov chain model is determined as the maximum order based on the number and proportion of the subsequences. Determine candidate historical state sequence data within the maximum order time period prior to the first time period; Fit the changing trend in the candidate historical state sequence data, and remove abnormal data in the candidate historical state sequence data according to the changing trend, wherein the difference between the abnormal data and the changing trend is greater than a preset value. The order of the high-order Markov chain model is determined based on the historical state sequence data after removing outliers. The determination of the order of the high-order Markov chain model based on the length of the historical state sequence data includes: Traverse the historical state sequence data to determine its length; the length represents the number of subsequences contained in the historical state sequence data. The range of the order of the Markov chain is determined based on the length of the historical state sequence data; the length of the historical state sequence data is positively correlated with the order. The historical state sequence data is divided into a training set and a validation set according to a preset ratio. For the range of orders, cross-validation is performed on the high-order Markov chain model corresponding to each order. The average validation error is calculated, and the order of the high-order Markov chain model with the smallest average validation error is determined as the order of the high-order Markov chain model.
2. The method according to claim 1, characterized in that, The method of solving the objective function under constraints using a linear programming solver includes: Based on the order of the high-order Markov chain model, a predetermined number of consecutive stationary states are selected from the first state sequence; the difference between the predetermined number and the order is 1, and the predetermined number is greater than the order; the stationary state represents the probability of different fire alarm states in the first state sequence. The objective function is determined based on the first state value, the state transition probability matrix, and the model parameters corresponding to the state transition probability matrix; The constraints are determined based on the described stable state; The objective function under the constraints is solved using a linear programming solver to obtain the solution result, which includes the optimal model parameters. The number of the optimal model parameters is the same as the order.
3. The method according to claim 2, characterized in that, The step of determining the objective function based on the first state value, the state transition probability matrix, and the model parameters corresponding to the state transition probability matrix includes: Each first state value (excluding the target first state value) is multiplied by the state transition probability matrix and the model parameters corresponding to the state transition probability matrix to determine intermediate parameters; the target first state value is the first state value with the largest number. The difference between the target first state value and each of the intermediate parameters is determined as the objective function.
4. The method according to claim 1, characterized in that, The process of obtaining the historical state sequence data includes: Obtain the target data document; the target data document includes at least historical state sequence data; The target data documents are filtered based on the equipment numbers of the fire-fighting equipment to obtain the first target data document corresponding to each fire-fighting equipment; State features are extracted from the first target data document to obtain historical state sequence data of fire-fighting equipment.
5. The method according to claim 4, characterized in that, The step of extracting state features from the first target data document to obtain historical state sequence data of fire-fighting equipment includes: The historical status sequence data in the first target data document is converted to a format to obtain the first historical status sequence data; the first historical status sequence data includes the date and the fire alarm status corresponding to the date. The first historical state sequence data is sorted and classified based on the date, and the first historical state sequence data is assigned a number based on the sorting and classification results. The first historical state sequence data after classification is deduplicated and missing data is removed to obtain the historical state sequence data of fire-fighting equipment.
6. The method according to claim 1, characterized in that, The step of calculating the state transition probability matrix based on the first state sequence includes: Traverse the first state sequence to determine the different categories of fire alarm states contained in the first state sequence; Based on the first state sequence, all ordered state groups are determined; the ordered state groups represent the state transitions between different categories of fire alarm states. Traverse the first state sequence to determine the number of each ordered state group; A state transition frequency matrix is constructed based on the number of each ordered state group and the number of different categories of fire alarm states; each element in the state transition frequency matrix represents the number of each state transition condition; the size of the state transition frequency matrix is related to the number of different categories of fire alarm states. The state transition frequency matrix is normalized to obtain the state transition probability matrix.
7. The method according to claim 6, characterized in that, The normalization process of the state transition frequency matrix to obtain the state transition probability matrix includes: Traverse the state transition frequency matrix to determine the number of each state transition case and the total number of all state transition cases; Based on the number of each state transition scenario and the total number of all state transition scenarios, calculate the proportion of each state transition scenario to all state transition scenarios. A state transition probability matrix is constructed based on the ratio and the number of different types of fire alarm states; each element in the state transition probability matrix represents the probability of each state transition situation relative to all state transition situations, and the size of the state transition probability matrix is related to the number of different types of fire alarm states.
8. A fire alarm prediction device based on a high-order Markov chain, characterized in that, The device includes a conversion module, a determination module, a construction module, and a prediction module; wherein, The conversion module is used to convert subsequences in the historical state sequence data of fire-fighting equipment into numerical values to form a first state sequence of fire-fighting equipment. The historical state sequence data is vector data generated by arranging fire alarm states in chronological order. The historical state sequence data includes multiple subsequences, each of which represents a fire alarm state at a different time. The first state sequence includes multiple first state values, each of which represents a fire alarm state. The historical state sequence data includes the fire alarm state and alarm type of the fire-fighting equipment. Specifically, the subsequences are converted into numerical values according to the different fire alarm states, the same numerical value is assigned to the subsequences corresponding to the same fire alarm state, and different numerical values are assigned to the subsequences corresponding to different fire alarm states. The determining module is used to determine a state space based on the first state sequence of the fire-fighting equipment; the size of the state space is consistent with the number of all possible combinations of changes between adjacent data in the first state sequence. The determining module is further configured to determine the order of the high-order Markov chain model based on the length of the historical state sequence data, calculate the state transition probability matrix based on the first state sequence, and construct the high-order Markov chain model based on the order and the state transition probability matrix; wherein, the pattern complexity in the historical state sequence data is automatically identified through subsequence partitioning and change pattern fitting, and the order is automatically adjusted; the length of the historical state sequence data is positively correlated with the size of the order; The construction module is used to solve the objective function under constraints based on a linear programming solver to obtain the model parameters of the higher-order Markov chain model, and to obtain an optimized higher-order Markov chain model based on the solution results; the objective function is determined based on the state transition probability matrix and the first state sequence, the constraints are determined based on the first state sequence, and the higher-order Markov chain model is used to predict the fire alarm status of the first time period based on the first order subsequences adjacent to the first time period in the first state sequence; The prediction module is used to predict the fire alarm status of the first time period based on a high-order Markov chain model; the length of the first time period is less than the order of the model. The determination of the order of the high-order Markov chain model based on the length of the historical state sequence data includes: Determine the number of subsequences in the historical state sequence data; The order of the higher-order Markov chain model is determined as the maximum order based on the number and proportion of the subsequences. Determine candidate historical state sequence data within the maximum order time period prior to the first time period; Fit the changing trend in the candidate historical state sequence data, and remove abnormal data in the candidate historical state sequence data according to the changing trend, wherein the difference between the abnormal data and the changing trend is greater than a preset value. The order of the high-order Markov chain model is determined based on the historical state sequence data after removing outliers. The determination of the order of the high-order Markov chain model based on the length of the historical state sequence data includes: Traverse the historical state sequence data to determine its length; the length represents the number of subsequences contained in the historical state sequence data. The range of the order of the Markov chain is determined based on the length of the historical state sequence data; the length of the historical state sequence data is positively correlated with the order. The historical state sequence data is divided into a training set and a validation set according to a preset ratio. For the range of orders, cross-validation is performed on the high-order Markov chain model corresponding to each order. The average validation error is calculated, and the order of the high-order Markov chain model with the smallest average validation error is determined as the order of the high-order Markov chain model.
Citation Information
Patent Citations
Prediction method and device for alarm in service operation and maintenance and electronic equipment
CN111124840A