Construction method of pathological data model based on dynamic sliding window and template matching
Through the dynamic sliding window model and multi-mutation point detection algorithm, combined with the segmentation threshold calculated by the fluctuation amount and the mean value, the time series data of neurological diseases are dynamically segmented and classified, and a pathological data template library is constructed to solve the problem of slow detection speed of fixed sliding window. and missed detection problems, enabling rapid and accurate diagnosis of neurological diseases.
Patent Information
- Application Number
- CN202111449009.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-29
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2041-11-29
AI Technical Summary
When detecting neurological diseases, the existing technology has a fixed sliding window that results in slow detection speed and easy missed detection of disease states. Moreover, it is difficult to diagnose in areas lacking experienced doctors, and it is difficult to detect dynamically changing pathological signals.
Using a dynamic sliding window model combined with a multi-mutation point detection algorithm, the segmentation threshold is calculated through fluctuations and averages, and the time series data of neurological diseases are dynamically segmented and classified. A pathological data template library is constructed, and updated through template matching and expert library mechanism to improve diagnostic accuracy.
It effectively improves the accuracy and speed of pathological signal detection, enriches the pathological template library, realizes rapid and accurate diagnosis of neurological diseases, and is suitable for areas lacking experienced doctors.
Smart Images

Figure CN114121265B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of big data rapid analysis and anomaly detection, and in particular to a method for constructing a pathological data model based on dynamic sliding window and template matching. Background Art
[0002] Abnormal discharges in the human nervous system can induce a variety of sudden diseases such as epilepsy, sleep disorders and ataxia. The prominent feature of such diseases is that they occur rapidly without obvious signs. Fast-paced life, staying up late for a long time and excessive use of electronic products may all be the cause of sudden diseases of the nervous system. At present, the diagnosis of such diseases mostly relies on the analysis of bioelectric signals such as electrocardiogram, electroencephalogram and electromyogram.
[0003] The abnormal changes in the above electrical signals can detect abnormal neuronal activity in patients with neurological diseases. At present, most of the detection of pathological time series data uses fixed sliding windows for segmentation, but this is not suitable for detecting neurological electrical signals, because when patients with neurological diseases are not sick, their neural electrical signals are no different from those in health. Only when the disease occurs will the signal fluctuate violently for a short time. The use of fixed sliding windows all the time not only slows down the detection speed, but also misses important pathological features in the disease state. If the sliding window can be changed dynamically with the disease state, the accuracy and speed of pathological signal detection can be greatly improved. In addition, the formation of the ability to accurately diagnose the disease based on the electrocardiogram requires a lot of experience accumulation, which also means that in underdeveloped areas where there is a lack of experienced doctors, the diagnosis and treatment of neurological diseases are difficult. Therefore, if the window vector data decomposed by the dynamic sliding window can be classified, a pathological template can be formed, and a pathological data expert system model can be constructed in combination with expert knowledge, it will be of great significance for the detection of neurological diseases. Summary of the invention
[0004] To solve the problems mentioned in the background technology, this paper provides a method for constructing a pathology data model based on dynamic sliding window and template matching. The construction process includes the following steps:
[0005] Step 1: Collect ECG signals of patients with nervous system diseases to obtain time series pathological data, and use a sliding window model to divide the time series pathological data into data segments of fixed size;
[0006] Step 2: Calculate the fluctuation and mean of each data segment, and use this as a basis to obtain the two groups of disease segmentation thresholds;
[0007] Step 3: Dynamically segment the training data and the data to be tested using a dynamic sliding window model, and classify the above data segments according to the segmentation threshold in step 2 to form a pathology data template library;
[0008] Step 4: Based on the similarity between the characteristics of the data segment to be detected and the pathological template, template matching is performed on the data segment to be detected, so as to realize the disease diagnosis function of the expert system model;
[0009] Step 5: Further improve the performance of the expert system model by setting up the expert database update mechanism, template sorting mechanism and priority selection area.
[0010] Preferably, in step 2 of the present invention, the fluctuation amount and mean of each data segment are calculated, and two groups of disease segmentation thresholds are obtained based on this; the specific process is:
[0011] The TSTKS mutation point detection algorithm is used to identify windows with mutation points. The fluctuations of multiple windows are calculated based on the locations where the data in each window mutates. If there is no mutation point, the window fluctuation is recorded as 0. The fluctuations of each window are combined into a multidimensional fluctuation vector. The fluctuations in the fluctuation vector are sorted and the largest fluctuation WF is selected. max As a fluctuation segmentation threshold; the extraction method of the mean threshold is similar to the fluctuation threshold. The mean of each window is calculated, sorted, and the maximum mean is taken. max as the mean segmentation threshold.
[0012] Preferably, in step 3 of the present invention, the training data and the data to be detected are dynamically segmented using a dynamic sliding window model, and the disease classification is performed on the above data segments in combination with the segmentation threshold in step 2 to form a pathology data template library; the specific process is:
[0013] The patient's real ECG signal is used as training data, and the dynamic sliding window model is used to segment the training data, detect the position of the mutation point in the window vector, and calculate the window vector fluctuation ratio. The calculation formula is:
[0014]
[0015] Among them, WVFR i represents the fluctuation ratio of the i-th window vector; n cp Indicates the number of mutation points in the window vector; Wl fcp Indicates the window position of the first mutation point in the window vector; Wl end Indicates the position of the last window in the window vector; based on this parameter, the window vector is dynamically changed;
[0016] When there is a mutation point in the window vector, first locate the position of the first mutation point. If the first mutation point does not appear in the first window, execute the truncation mechanism, combine all windows before the first mutation point into a template, and calculate the WVFR for the remaining part of the vector. If the first mutation point is in the first window of the vector, directly calculate the WVFR of the entire vector. When WVFR≥0.3, use a 2-dimensional window vector with a window size of 128 to re-detect. When WVFR<0.3, use a 2-dimensional window vector with a window size of 256 to re-detect. This realizes the dynamic change of the window vector.
[0017] Summarize the window vectors segmented by the dynamic sliding window model in step 3, calculate the average mean and average fluctuation of each window in these vectors, and compare them with the two sets of segmentation thresholds in step 2 to obtain the disease severity corresponding to this window vector; the disease diagnosis result of the vector and the dimension of this vector and the width of the window are used as labels and marked on the window vector to form a complete pathology template and generate sufficient pathology templates.
[0018] Preferably, step 4 of the present invention performs template matching on the data segment to be detected based on the degree of similarity between the characteristics of the data segment to be detected and the pathological template, thereby realizing the disease diagnosis function of the expert system model; the specific process is:
[0019] The pathological templates constructed in step 3 are classified and stored in the expert template library according to the dimensions of the templates and the window widths. With the help of the information on the templates, the similarity between the templates in the expert library and the pathological data to be detected is calculated. The pathological data to be detected will first be segmented with the help of a dynamic sliding window model. According to the dimension and length of the window vector after segmentation, templates with the same length and dimension are preferentially searched in the expert library. Then, the proximity between the mean and fluctuation of each window in the vector and the mean and fluctuation of the corresponding window in the pathological template vector is calculated. When the mean and fluctuation are both within the range of 80%-120% of the mean and fluctuation of the corresponding window in the template, it indicates that the match is successful, and a diagnosis is quickly made on the data to be detected based on the disease diagnosis results corresponding to the data in the template.
[0020] Preferably, step 5 of the present invention further improves the expert system model performance by setting an expert database update mechanism, a template sorting mechanism and a priority selection area; wherein the specific process of the expert database update mechanism is:
[0021] If a window vector in the pathological data to be detected in step 4 still fails to match successfully after traversing all templates of equal length, the disease condition is divided according to the segmentation threshold trained in step 3, and the division result is used as a label and recorded on this window vector. This window vector is used as a new template and added to the expert library to update the pathological template library.
[0022] Preferably, step 5 of the present invention further improves the expert system model performance by setting an expert database update mechanism, a template sorting mechanism and a priority selection area; wherein the specific process of the expert database template sorting mechanism and the priority selection area is:
[0023] A template sorting mechanism is set up in the pathology template library to sort templates with the same length and dimension together, and the templates are arranged from high to low according to the number of successful matches; when the pathology data to be detected is input into the expert system model, the templates are matched in sequence from high frequency to low frequency to ensure that the pathology data can be quickly matched to the appropriate template;
[0024] A priority queue selection area is set up in the expert database to accommodate three templates; when a template in the sorting queue is matched successfully, this template is copied into the priority queue; when the next round of template matching begins, the templates in the priority queue are traversed first; according to the inertia of pathological data changes, the matching time is shortened and the performance of the expert system model is improved.
[0025] By adopting the above technical solution, the advantages of the present invention are:
[0026] 1. The present invention combines the multiple mutation point detection algorithm and proposes two disease classification strategies based on fluctuation and mean, which effectively completes the classification of patient symptoms.
[0027] 2. The present invention uses a dynamic sliding window model, relying on the dynamic changes of the window vector, which can effectively reduce the detection time in the non-disease data segment and enhance the feature extraction of the disease data segment.
[0028] 3. The present invention utilizes dynamic sliding windows and segmentation thresholds, combined with expert knowledge, to generate pathology templates of various dimensions and lengths, greatly enriching the types of templates and pathology information in the expert template library.
[0029] 4. In terms of template matching, the present invention compares the similarity between each window data in the window vector to be detected and the corresponding window data in the template vector. While finding the template that is closest to the data fluctuation and the data mean, it also compares the data change trend.
[0030] 5. The present invention improves the speed of template matching through the template sorting mechanism, and realizes the self-update of the expert template library by combining the update mechanism.
[0031] 6. The present invention sets a priority selection area in the expert database to further improve the performance of the expert system model. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 It is a flow chart of establishing a pathological data model in the present invention.
[0033] Figure 2It is a change strategy diagram of the dynamic sliding window model in the present invention.
[0034] Figure 3a This is an example diagram of the truncation mechanism when the first mutation point appears at an odd position in the window vector.
[0035] Figure 3b This is an example diagram of the truncation mechanism when the first mutation point appears at an even position in the window vector.
[0036] Figure 4 It is the template matching strategy diagram in the present invention.
[0037] Figure 5 It is a disease segmentation strategy diagram based on fluctuation amount and mean value in the present invention.
[0038] Figure 6 This is an example diagram of the expert library template sorting mechanism in the present invention.
[0039] Figure 7 This is an example diagram of the priority selection area of the expert database in the present invention. DETAILED DESCRIPTION
[0040] The present invention will be further described below in conjunction with specific examples. It should be understood that these examples are only used to illustrate the present invention and are not intended to limit the scope of the present invention. In addition, it should be understood that after reading the content taught by the present invention, those skilled in the art can make various changes or modifications to the present invention, and these equivalent forms fall within the scope limited by the appended claims of the application equally.
[0041] Embodiment 1:
[0042] The method for constructing a pathological data model based on dynamic sliding window and template matching specifically includes the following steps:
[0043] Step 1: Collect ECG signals of patients with neurological diseases to obtain time series pathological data, and use a sliding window model to divide the time series pathological data into data segments of fixed size.
[0044] Step 2: Calculate the fluctuation and mean of each data segment, and use this as a basis to obtain the two groups of disease segmentation thresholds;
[0045] The TSTKS mutation point detection algorithm is used to identify windows with mutation points. The fluctuations of multiple windows are calculated based on the locations where the data in each window mutates. If there is no mutation point, the window fluctuation is recorded as 0. The fluctuations of each window are combined into a multidimensional fluctuation vector. The fluctuations in the fluctuation vector are sorted and the largest fluctuation WF is selected. max As a fluctuation segmentation threshold; the extraction method of the mean threshold is similar to the fluctuation threshold. The mean of each window is calculated, sorted, and the maximum mean is taken. maxas the mean segmentation threshold.
[0046] Step 3: Dynamically segment the training data and the data to be tested using a dynamic sliding window model, and classify the above data segments according to the segmentation threshold in step 2 to form a pathology data template library;
[0047] The patient's real ECG signal is used as training data, and the dynamic sliding window model is used to segment the training data, detect the position of the mutation point in the window vector, and calculate the window vector fluctuation ratio. The calculation formula is:
[0048]
[0049] Among them, WVFR i represents the fluctuation ratio of the i-th window vector; n cp Indicates the number of mutation points in the window vector; Wl fcp Indicates the window position of the first mutation point in the window vector; Wl end Indicates the position of the last window in the window vector; based on this parameter, the window vector is dynamically changed;
[0050] When there is a mutation point in the window vector, first locate the position of the first mutation point. If the first mutation point does not appear in the first window, execute the truncation mechanism, combine all windows before the first mutation point into a template, and calculate the WVFR for the remaining part of the vector. If the first mutation point is in the first window of the vector, directly calculate the WVFR of the entire vector. When WVFR≥0.3, use a 2-dimensional window vector with a window size of 128 to re-detect. When WVFR<0.3, use a 2-dimensional window vector with a window size of 256 to re-detect. This realizes the dynamic change of the window vector.
[0051] Summarize the window vectors segmented by the dynamic sliding window model in step 3, calculate the average mean and average fluctuation of each window in these vectors, and compare them with the two sets of segmentation thresholds in step 2 to obtain the disease severity corresponding to this window vector; the disease diagnosis result of the vector and the dimension of this vector and the width of the window are used as labels and marked on the window vector to form a complete pathology template and generate sufficient pathology templates.
[0052] Step 4: Based on the similarity between the characteristics of the data segment to be detected and the pathological template, template matching is performed on the data segment to be detected, so as to realize the disease diagnosis function of the expert system model;
[0053] The pathological templates constructed in step 3 are classified and stored in the expert template library according to the dimensions of the templates and the window widths. With the help of the information on the templates, the similarity between the templates in the expert library and the pathological data to be detected is calculated. The pathological data to be detected will first be segmented with the help of a dynamic sliding window model. According to the dimension and length of the window vector after segmentation, templates with the same length and dimension are preferentially searched in the expert library. Then, the proximity between the mean and fluctuation of each window in the vector and the mean and fluctuation of the corresponding window in the pathological template vector is calculated. When the mean and fluctuation are both within the range of 80%-120% of the mean and fluctuation of the corresponding window in the template, it indicates that the match is successful, and a diagnosis is quickly made on the data to be detected based on the disease diagnosis results corresponding to the data in the template.
[0054] Step 5: Further improve the performance of the expert system model by setting up the expert database update mechanism, template sorting mechanism and priority selection area;
[0055] The specific process of the expert database update mechanism is as follows:
[0056] If a certain window vector in the pathological data to be detected in step 4 still fails to match successfully after traversing all templates of equal length, the disease condition is divided by the segmentation threshold trained in step 3, and the division result is used as a label and recorded on this window vector. This window vector is used as a new template and added to the expert library to update the pathological template library;
[0057] The specific process of the expert database template sorting mechanism and priority selection is as follows:
[0058] A template sorting mechanism is set up in the pathology template library to sort templates with the same length and dimension together, and the templates are arranged from high to low according to the number of successful matches; when the pathology data to be detected is input into the expert system model, the templates are matched in sequence from high frequency to low frequency to ensure that the pathology data can be quickly matched to the appropriate template;
[0059] A priority queue selection area is set up in the expert database to accommodate three templates; when a template in the sorting queue is matched successfully, this template is copied into the priority queue; when the next round of template matching begins, the templates in the priority queue are traversed first; according to the inertia of pathological data changes, the matching time is shortened and the performance of the expert system model is improved.
[0060] Embodiment 2:
[0061] The method for constructing a pathological data model based on dynamic sliding window and template matching specifically includes the following steps:
[0062] Step 1: Collect ECG signals from patients with neurological diseases to obtain time series pathological data, use a sliding window model to preprocess the data, and perform data segmentation.
[0063] Step 2: Calculate the fluctuation and mean of each segment of data, and use this as a basis to obtain the segmentation thresholds for the two groups of conditions. This is divided into two steps:
[0064] 2a) Segmentation threshold extraction based on fluctuation and mean
[0065] First, use a fixed-length sliding window model to segment the learning data, and use the TSTSK algorithm to detect whether each window contains a mutation point. If there is a mutation point, it means that the data in the window has abnormal fluctuations. The fluctuation amount of each window is defined as:
[0066]
[0067] In the formula, Var(Z L ) represents the variance of the data to the left of the mutation point in the window, Var(Z R ) represents the variance of the data to the right of the mutation point in the window, Z represents the entire data in the window including the mutation point, and max and min represent the maximum and minimum values. If there is no mutation point, the window fluctuation is recorded as 0. Sort the fluctuations of each window and get the maximum fluctuation WF max As a fluctuation segmentation threshold. The extraction method of the mean threshold is similar to the fluctuation threshold. The mean of each window is calculated, sorted, and the maximum mean is taken. max as the mean segmentation threshold.
[0068] 2b) Multi-threshold pathology data classification method
[0069] The multi-threshold segmentation method includes two disease segmentation strategies. Strategy 1 is a multi-threshold segmentation strategy based on fluctuation volume, which uses the window fluctuation and the maximum fluctuation volume WF max The ratio of the disease is divided into four states: "normal", "suspected disease", "mild disease" and "severe disease". However, when the patient is in a continuous disease state, the distribution of the data may not change significantly, so the mutation point cannot be detected, which also causes Strategy 1 to misclassify some disease data segments as "normal". Therefore, when Strategy 1 judges the pathological data as "normal", it is necessary to start Strategy 2, which is based on the multi-threshold segmentation strategy of the mean, and divide the mean interval [Mean min ,Mean max ] is divided into 4 sections, corresponding to the four states of "normal", "suspected onset", "mild onset" and "severe onset". According to the position of the window mean in the interval, the disease state of the current window data is judged.
[0070] Step 3: Generate sufficient pathological templates based on the newly invented dynamic sliding window model and the segmentation threshold in step 2. The specific process is divided into two steps:
[0071] 3a) Use dynamic sliding windows to segment the training data
[0072] When testing pathological time series data with a fixed-length sliding window, there are problems such as slow detection speed and single generated template. The present invention proposes a sliding window dynamic change strategy based on the window vector fluctuation ratio. The calculation formula is as follows:
[0073]
[0074] Where WVFR i represents the fluctuation ratio of the i-th window vector; n cp Indicates the number of mutation points of the window vector; Wl fcp Indicates the window position of the first mutation point in the window vector; Wl end Indicates the position of the last window in the window vector.
[0075] This strategy combines multiple sliding windows into a window vector, and uses the TSTKS algorithm to detect mutation points in the window. The width of the window and the dimension of the window vector are dynamically adjusted by the proportion of the number of windows with mutation points in the vector in the entire window vector. In the data segment of the pre-disease state, a large window vector with a large dimension is used for detection, and in the data segment of the diseased state, a small window vector with a small dimension is used for detection to avoid missing important pathological features.
[0076] When training data is input, the initial window vector is set to 4 dimensions, and the size of each window is 2 8 If the mutation point is not detected in these four consecutive windows, the dimension of the window vector is increased to 8 dimensions and the window size is 2. 8 However, if a mutation point is detected in these four windows, it is necessary to locate the position where the first mutation point appears, implement a truncation mechanism, generate a template for the window before the first mutation point, and then calculate the window vector fluctuation ratio of the window after the first mutation point. According to the fluctuation ratio, adjust the dimension and window width of the detection window vector. When the window vector fluctuation ratio belongs to (0,0.3], use 2 dimensions, and each window width is 2 8 The window vector is re-tested after the first mutation point. If the window vector fluctuation ratio belongs to (0.3,1], it means that there are many mutation points in this data segment and the data distribution is abnormal. It is necessary to change the smallest window vector for re-testing, that is, a 2-dimensional window with a width of 2. 7 The window vector.
[0077] Using a dynamic sliding window, the training data can be decomposed into two dimensions according to the fluctuation ratio, with a window size of 2 7 or 2 8 ; 4 dimensions, window size is 2 8 ; 6 dimensions, window size is 2 8; 8 dimensions, window size is 2 8 , a total of 4 dimensions of window vectors.
[0078] 3b) Generation of pathological templates
[0079] The training data is taken from real pathological data. The training data is divided into window vectors of various dimensions and lengths using a dynamic sliding window. The average mean and average fluctuation of the windows in these vectors are calculated, and the segmentation threshold obtained in step 2 is used to classify the disease. The disease severity corresponding to this window vector can be obtained. This disease severity will be used as a label together with the dimension of this vector and the width of the window. Combined with expert knowledge, the disease is judged to form a complete pathological template. A sufficient number of pathological templates are generated according to the above method, and finally an expert template library is formed.
[0080] Step 4: Based on the pathological template generated in steps 1-3 and the dynamic sliding window model, an expert system model is constructed by combining the template matching method. The specific steps are as follows:
[0081] 4a) Pathological data template matching
[0082] The label of the pathological template constructed in step 3 not only carries the disease level, but also the mean and fluctuation of each window in the template. With the help of this feature on the label of the pathological template, the degree of matching between the template in the expert library and the pathological data to be tested can be calculated. The pathological data to be tested will first be segmented with the help of a dynamic sliding window. According to the dimension and length of the window vector after segmentation, the template with the same length and dimension is preferentially searched in the expert library, and then the mean and fluctuation of each window in the vector are calculated to be close to the mean and fluctuation of the corresponding window in the pathological template vector. When the mean and fluctuation are both within the range of 80%-120% of the mean and fluctuation of the corresponding window in the template, it indicates that the match is successful, otherwise the match fails.
[0083] 4b) Sorting and updating of pathology templates
[0084] In order to improve the speed of template matching, a sorting mechanism based on the frequency of template occurrence is set up in the expert database, such as Figure 6 As shown in the figure, templates with the same length and dimension are sorted together, and the templates are dynamically arranged from high to low according to the number of successful matches. The higher the frequency of successful template matching, the more times the pathological condition corresponding to the template appears in the actual pathological data, and the easier it is to successfully match. When the real pathological data is input for matching, the templates are matched in order from high frequency to low frequency to ensure that the pathological data can be quickly matched to the appropriate template.
[0085] If a window vector in the pathological data to be tested still fails to match successfully after traversing all templates of equal length, the disease condition is divided according to the segmentation threshold trained in step 2, and the division result is used as a label and recorded on the window vector of the pathological data to be tested. This window vector will be used as a new template, added to the expert library and participate in the template sorting mechanism, so as to realize the update of the pathological template library.
[0086] 4c) Set priority areas
[0087] During the onset of neurological diseases, the changes in the patient's ECG, EEG, EMG and other conditions have inertia. Based on this principle, a priority queue selection area that can accommodate three templates is set in the expert database. When a template in the sorting queue is successfully matched, the template is copied into the priority queue. At the beginning of the next round of template matching, the templates in the priority queue are traversed first. In this way, the inertia of pathological signal changes can be used to increase the probability of successful matching, thereby shortening the matching time.
[0088] like Figure 7 As shown, the templates in the priority queue selection area are also updated, because the selection area can only accommodate up to three templates. When a template in the queue still fails to match successfully in three rounds of matching, it will be squeezed out of the queue by the newly matched template, thereby completing the update of the template in the priority queue.
[0089] Embodiment 3:
[0090] like Figure 1 As shown, a flowchart of a method for constructing a pathological data model based on dynamic sliding window and template matching specifically includes the following steps:
[0091] (1) Collect ECG signals from patients with neurological diseases and obtain time-series pathological data.
[0092] (2) The sliding window model was used to preprocess the data. The pathological data were segmented by a fixed sliding window. The TSTKS algorithm was used to detect the window mutation points and calculate the fluctuation and mean of each window. After sorting, the maximum fluctuation and mean were taken to calculate the segmentation threshold.
[0093] (3) Use a dynamic sliding window model to dynamically partition the training data based on the window fluctuation ratio. The specific strategy is as follows: Figure 2 As shown in the figure, multiple sliding windows are combined into a window vector. First, the position of the first mutation point in the window vector is located. The windows before the first mutation point are merged using the truncation mechanism, and a template is generated separately. Subsequent windows are combined into a window vector, and the vector fluctuation ratio is calculated. According to the fluctuation ratio, dynamic sliding windows of different dimensions and different window widths are used for re-detection. Figure 3a , Figure 3bAs shown in , when the first mutation point appears at an even position, in order to ensure that the dimensions of all case templates are within the range of [2,4,6,8], the first mutation point window is also included in the truncated window, and a template with an even dimension is generated separately. After obtaining pathological data templates with multiple window widths and multiple dimensions, the average fluctuation and average mean of each pathological template are calculated. Figure 4 , Figure 5 As shown, the two sets of segmentation thresholds obtained in (2) are combined with expert knowledge to diagnose the disease of each pathological template. By learning massive training data, sufficient pathological templates are obtained and put into the expert database.
[0094] (4) Slice the input pathological data to be detected using a dynamic sliding window model, calculate the fluctuation and mean of each window in the window vector, and then find an equal-length template in the template library for matching. Compare the proximity of the mean and fluctuation of each window in the vector with the mean and fluctuation of the corresponding window in the pathological template vector. There are two conditions for successful matching:
[0095] 0.8WF i ≤wf i ≤1.2WF i
[0096] Where wf i Represents the fluctuation of the i-th window in the vector to be detected, WF i Represents the fluctuation of the i-th window in the template.
[0097] 0.8Mean i ≤mean i ≤1.2Mean i
[0098] In the formula, mean i Represents the mean of the i-th window in the vector to be detected, Mean i Represents the mean of the i-th window in the template. If the above two conditions are met, the match is successful, otherwise the match fails.
[0099] (5) For the template that failed to match in (4), the segmentation threshold is used to determine the condition of the template. The determination result is then marked on the vector and added to the expert database as a new template, thereby achieving automatic updating of the template in the expert system.
[0100] (6) Set up a template sorting mechanism in the expert system model, such as Figure 6 As shown in the figure, according to the number of successful matches, templates of equal dimensions and window widths are sorted from high frequency to low frequency. During the template matching process, templates are traversed in order of frequency, and high-frequency templates are given priority, which can shorten the time to find a suitable template.
[0101] (7) Set priority areas in the expert system model, such as Figure 7 As shown, a priority queue selection area that can accommodate three templates is set. When a template in the sorting queue is successfully matched, the template is copied into the priority queue. At the beginning of the next round of template matching, the templates in the priority queue are traversed first. According to the inertia of pathological data changes, the matching time is shortened and the performance of the expert system model is improved.
[0102] The present invention combines a multi-mutation point detection algorithm, proposes two disease classification strategies based on fluctuation and mean, and effectively completes the classification of patient symptoms. Using a dynamic sliding window model, relying on the dynamic change of the window vector, it can effectively reduce the detection time in the non-disease data segment, and can strengthen the feature extraction of the disease data segment. Using a dynamic sliding window and a segmentation threshold, combined with expert knowledge, pathological templates of multiple dimensions and lengths are generated, which greatly enriches the types of templates and pathological information in the expert template library. In terms of template matching, the similarity between each window data in the window vector to be detected and the corresponding window data in the template vector is compared. While finding the template with the closest data fluctuation and data mean, the change trend of the data is also compared. Through the template sorting mechanism, the speed of template matching is improved, and combined with the update mechanism, the self-update of the expert template library is realized. Setting priority areas in the expert library further improves the performance of the expert system model.
[0103] It should also be noted that the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, the present invention will not further describe various possible combinations.
Claims
1. A method for constructing a pathological data model based on dynamic sliding window and template matching, characterized in that: The following steps are involved: Step 1: Collect ECG signals of patients with nervous system diseases to obtain time series pathological data, and use a sliding window model to divide the time series pathological data into data segments of fixed size; Step 2: Calculate the fluctuation and mean of each data segment, and use this as a basis to obtain the two groups of disease segmentation thresholds; The specific process is: The TSTKS mutation point detection algorithm is used to identify windows with mutation points. The fluctuations of multiple windows are calculated based on the locations where the data in each window mutates. If there is no mutation point, the window fluctuation is recorded as 0. The fluctuations of each window are combined into a multidimensional fluctuation vector. The fluctuations in the fluctuation vector are sorted and the largest fluctuation WF is selected. max As a fluctuation segmentation threshold; the extraction method of the mean threshold is similar to the fluctuation threshold. The mean of each window is calculated, sorted, and the maximum mean is taken. max As the mean segmentation threshold; Step 3: Dynamically segment the training data and the data to be tested using a dynamic sliding window model, and classify the above data segments according to the segmentation threshold in step 2 to form a pathology data template library; The specific process is: The patient's real ECG signal is used as training data, and the dynamic sliding window model is used to segment the training data, detect the position of the mutation point in the window vector, and calculate the window vector fluctuation ratio. The calculation formula is: Among them, WVFR i represents the fluctuation ratio of the i-th window vector; n cp Indicates the number of mutation points in the window vector; Wl fcp Indicates the window position of the first mutation point in the window vector; Wl end Indicates the position of the last window in the window vector; based on this parameter, the window vector is dynamically changed; When there is a mutation point in the window vector, first locate the position of the first mutation point. If the first mutation point does not appear in the first window, execute the truncation mechanism, combine all windows before the first mutation point into a template, and calculate the WVFR for the remaining part of the vector. If the first mutation point is in the first window of the vector, directly calculate the WVFR of the entire vector. When WVFR≥0.3, use a 2-dimensional window vector with a window size of 128 to re-detect. When WVFR<0.3, use a 2-dimensional window vector with a window size of 256 to re-detect. This realizes the dynamic change of the window vector. Summarize the window vectors segmented by the dynamic sliding window model in step 3, calculate the average mean and average fluctuation of each window in these vectors, and compare them with the two sets of segmentation thresholds in step 2 to obtain the disease severity corresponding to this window vector; the disease diagnosis result of this vector, the dimension of this vector, and the width of the window are used as labels and marked on the window vector to form a complete pathology template, and a sufficient number of pathology templates are generated; Step 4: Based on the similarity between the characteristics of the data segment to be detected and the pathological template, template matching is performed on the data segment to be detected, so as to realize the disease diagnosis function of the expert system model; The specific process is: The pathological template constructed in step 3 is classified and stored in the expert template library according to the dimension and window width of the template. With the help of the information on the template, the similarity between the template in the expert library and the pathological data to be detected is calculated; the pathological data to be detected will first be segmented with the help of a dynamic sliding window model, and according to the dimension and length of the window vector after segmentation, the template with the same length and dimension is preferentially searched in the expert library, and then the degree of proximity between the mean and fluctuation of each window in the vector and the mean and fluctuation of the corresponding window in the pathological template vector is calculated; when the mean and fluctuation are both within the range of 80%-120% of the mean and fluctuation of the corresponding window in the template, it indicates that the match is successful, and the diagnosis of the data to be detected is quickly made according to the disease diagnosis result corresponding to the data in the template; Step 5: Further improve the performance of the expert system model by setting up the expert database update mechanism, template sorting mechanism and priority selection area.
2. The construction method according to claim 1, characterized in that: The specific process of the expert database update mechanism in step 5 above is: If a window vector in the pathological data to be detected in step 4 still fails to match successfully after traversing all templates of equal length, the disease condition is divided according to the segmentation threshold trained in step 3, and the division result is used as a label and recorded on this window vector. This window vector is used as a new template and added to the expert library to update the pathological template library.
3. The construction method according to claim 1, characterized in that: The specific process of the expert database template sorting mechanism and priority selection in step 5 above is as follows: A template sorting mechanism is set up in the pathology template library to sort templates with the same length and dimension together, and the templates are arranged from high to low according to the number of successful matches; when the pathology data to be detected is input into the expert system model, the templates are matched in sequence from high frequency to low frequency to ensure that the pathology data can be quickly matched to the appropriate template; A priority queue selection area is set up in the expert database to accommodate three templates; when a template in the sorting queue is matched successfully, this template is copied into the priority queue; when the next round of template matching begins, the templates in the priority queue are traversed first; according to the inertia of pathological data changes, the matching time is shortened and the performance of the expert system model is improved.
