Data classification method and device, equipment and storage medium
By extracting independent feature representations of ECG data fragments and generating continuous feature representations, the problem of the lack of interpretability in deep neural networks in ECG classification is solved, and the transparency and accuracy of classification results are improved.
Patent Information
- Application Number
- CN202310657792.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-05
- Publication Date
- 2024-12-06
AI Technical Summary
Deep neural networks lack interpretability in electrocardiogram classification, resulting in opaque acquisition of classification results.
By obtaining periodically and continuously changing data fragments in the input data, independent feature representations are extracted, and continuous feature representations and final feature representations are generated using these features, thereby improving the interpretability and accuracy of feature representations.
The interpretability of the data fragment classification process and the accuracy of the classification results are improved, so that the final feature representation can reflect the characteristics of the data fragment and its global impact in the data.
Smart Images

Figure CN119089253A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of artificial intelligence technology, and in particular to a data classification method, device, equipment and storage medium. Background Art
[0002] Electrocardiogram (ECG) is a diagnostic tool that can measure and record the electrical activity of the heart. Due to its non-invasive nature, ECG has become one of the most effective ways to detect cardiovascular diseases such as arrhythmias.
[0003] In related technologies, since deep neural networks have powerful feature extraction capabilities, deep learning models can accurately extract features from electrocardiogram signals and classify heartbeat types based on the extracted features. However, deep learning models are often black box models, and the process of obtaining classification results lacks explainability. Summary of the invention
[0004] The embodiments of the present application provide a data classification method, apparatus, device and storage medium, which can improve the interpretability of the classification result acquisition process and the accuracy of the classification result acquisition. The technical solution is as follows:
[0005] According to one aspect of an embodiment of the present application, a data classification method is provided, the method comprising:
[0006] Acquire input data, wherein the input data includes n data segments that are periodically and continuously changed, where n is an integer greater than 1;
[0007] Obtaining independent feature representations corresponding to n data segments in the input data, respectively, wherein the independent feature representations are used to characterize the data segments;
[0008] Generate a continuous feature representation according to the independent feature representations corresponding to the first m data fragments in the input data, where the continuous feature representation is used to characterize the input data, and m is a positive integer less than n;
[0009] Generating a final feature representation corresponding to the nth data segment according to the continuous feature representation and the independent feature representation corresponding to the nth data segment;
[0010] The nth data segment is classified according to the final feature representation corresponding to the nth data segment to obtain a classification result corresponding to the nth data segment.
[0011] According to one aspect of an embodiment of the present application, a method for training a data classification model is provided, the method comprising:
[0012] Acquire training data, wherein the training data includes n data segments that are periodically and continuously changing, each of the data segments is labeled with a true classification result, and n is an integer greater than 1;
[0013] Obtaining, by means of the data classification model, independent feature representations corresponding to the n data segments in the training data, respectively, wherein the independent feature representations are used to characterize the data segments;
[0014] Generate a continuous feature representation through the data classification model according to the independent feature representations corresponding to the first m data segments in the training data, wherein the continuous feature representation is used to characterize the training data, and m is a positive integer less than n;
[0015] Generating a final feature representation corresponding to the nth data segment according to the continuous feature representation and the independent feature representation corresponding to the nth data segment;
[0016] Classifying the nth data segment according to the final feature representation corresponding to the nth data segment by the data classification model to obtain a predicted classification result corresponding to the nth data segment;
[0017] The data classification model is trained according to the predicted classification result and the actual classification result corresponding to the nth data segment to obtain a trained data classification model, and the trained data classification model is used to classify the data segments in the input data.
[0018] According to one aspect of an embodiment of the present application, a data classification device is provided, the device comprising:
[0019] An input data acquisition module, used to acquire input data, wherein the input data includes n data segments that change periodically and continuously, where n is an integer greater than 1;
[0020] An independent representation acquisition module, used to acquire independent feature representations corresponding to n data segments in the input data, respectively, wherein the independent feature representations are used to characterize the data segments;
[0021] A continuous representation acquisition module, used to generate a continuous feature representation according to the independent feature representations corresponding to the first m data fragments in the input data, wherein the continuous feature representation is used to characterize the input data, and m is a positive integer less than n;
[0022] A final representation acquisition module, used to generate a final feature representation corresponding to the nth data segment according to the continuous feature representation and the independent feature representation corresponding to the nth data segment;
[0023] A classification result acquisition module is used to classify the nth data segment according to the final feature representation corresponding to the nth data segment to obtain a classification result corresponding to the nth data segment.
[0024] According to one aspect of an embodiment of the present application, a training device for a data classification model is provided, the device comprising:
[0025] A training data acquisition module, used to acquire training data, wherein the training data includes n data segments that are periodically and continuously changing, each of the data segments is labeled with a true classification result, and n is an integer greater than 1;
[0026] An independent representation acquisition module, used to acquire independent feature representations corresponding to n data segments in the training data respectively through the data classification model, wherein the independent feature representations are used to characterize the data segments;
[0027] A continuous representation acquisition module, used to generate a continuous feature representation according to the independent feature representations corresponding to the first m data segments in the training data through the data classification model, wherein the continuous feature representation is used to characterize the training data, and m is a positive integer less than n;
[0028] A final representation acquisition module, used to generate a final feature representation corresponding to the nth data segment according to the continuous feature representation and the independent feature representation corresponding to the nth data segment;
[0029] a classification result acquisition module, configured to classify the nth data segment according to the final feature representation corresponding to the nth data segment through the data classification model, and obtain a predicted classification result corresponding to the nth data segment;
[0030] The classification model training module is used to train the data classification model according to the predicted classification result and the actual classification result corresponding to the nth data segment to obtain a trained data classification model, and the trained data classification model is used to classify the data segments in the input data.
[0031] According to one aspect of an embodiment of the present application, a computer device is provided, which includes a processor and a memory, wherein a computer program is stored in the memory, and the computer program is loaded and executed by the processor to implement the above-mentioned data classification method, or to implement the above-mentioned data classification model training method.
[0032] According to one aspect of an embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored. The computer program is loaded and executed by a processor to implement the above-mentioned data classification method, or to implement the above-mentioned data classification model training method.
[0033] According to one aspect of an embodiment of the present application, a computer program product is provided, the computer program product comprising a computer program, the computer program being stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the above-mentioned data classification method, or executes the above-mentioned data classification model training method.
[0034] The technical solution provided by the embodiments of the present application includes at least the following beneficial effects:
[0035] By determining the continuous feature representation corresponding to the input data based on the independent feature representations corresponding to the first m data fragments, and then obtaining the final feature representation corresponding to the nth data fragment based on the continuous feature representation and the independent feature representation corresponding to the nth data fragment, the final feature representation corresponding to the nth data fragment can not only reflect the characteristics of the nth data fragment, but also reflect the influence of the first m data fragments on the nth data fragment, and the global characteristics of the nth data fragment in the input data, thereby improving the interpretability and accuracy of the final feature representation, and then improving the interpretability of the data fragment classification process and the accuracy of obtaining the classification results. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0037] Figure 1 It is a schematic diagram of an implementation environment of a solution provided by an embodiment of the present application;
[0038] Figure 2 is a flow chart of a data classification method provided by an embodiment of the present application;
[0039] Figure 3 is a schematic diagram of a data segment provided by an embodiment of the present application;
[0040] Figure 4 is a flow chart of a method for obtaining independent feature representation provided by an embodiment of the present application;
[0041] Figure 5 is a schematic diagram of denoised input data provided by an embodiment of the present application;
[0042] Figure 6 is a schematic diagram of grid data provided by an embodiment of the present application;
[0043] Figure 7 is a schematic diagram of a training method for a data classification model provided by an embodiment of the present application;
[0044] Figure 8 is a schematic diagram of a user interface provided by an embodiment of the present application;
[0045] Fig. 9 is a schematic diagram of an electrocardiogram classification method provided by an embodiment of the present application;
[0046] Fig.10 is a block diagram of a data classification device provided by an embodiment of the present application;
[0047] Fig.11 is a block diagram of a data classification device provided by another embodiment of the present application;
[0048] Fig.12 is a block diagram of a training device for a data classification model provided by one embodiment of the present application;
[0049] Fig.13 is a block diagram of a training device for a data classification model provided by another embodiment of the present application;
[0050] Fig.14 It is a schematic diagram of the structure of a computer device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0051] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0052] Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making.
[0053] Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level and software-level technologies. The basic technologies of artificial intelligence generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics and other technologies. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0054] Machine Learning (ML) is a multi-disciplinary subject that involves probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and other disciplines. It specializes in studying how computers simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications are spread across all areas of artificial intelligence. Machine learning and deep learning usually include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and teaching learning.
[0055] The technical solution provided in the embodiment of the present application involves machine learning technology of artificial intelligence, which uses machine learning technology to extract features from data segments in training data to obtain final feature representations corresponding to specified data segments, and then obtain predicted classification results corresponding to the specified data segments based on the final feature representations corresponding to the specified data segments. Then, based on the predicted classification results and actual classification results corresponding to the specified data segments, a data classification model is trained to obtain a trained data classification model, which can be used to classify data segments in input data.
[0056] In the method provided in the embodiment of the present application, the execution subject of each step may be a computer device, which refers to an electronic device with data calculation, processing and storage capabilities. The computer device may be a terminal such as a PC (Personal Computer), a tablet computer, a smart phone, a wearable device, an intelligent robot, etc.; or it may be a server. Among them, the server may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services.
[0057] The technical solution provided by the embodiment of the present application is applicable to any processing scenario of data that changes periodically and continuously, such as electrocardiogram classification tasks, pulse data analysis tasks, voltage and current and other electrical signal analysis tasks, etc. The technical solution provided by the embodiment of the present application can improve the interpretability of the classification result acquisition process and the accuracy of the classification result acquisition.
[0058] Please refer to Figure 1 , which shows a schematic diagram of a solution implementation environment provided by an embodiment of the present application. The solution implementation environment may include a model training device 10 and a model using device 20.
[0059] The model training device 10 may be an electronic device such as a PC, a computer, a tablet computer, a server, an intelligent robot, or other electronic devices with strong computing capabilities. The model training device 10 is used to train the data classification model 30. Optionally, the model training device 10 may also be a server.
[0060] In the embodiment of the present application, the data classification model 30 refers to a neural network model for classifying data, such as classifying electrocardiogram signals in an electrocardiogram, and classifying any data that changes continuously and periodically. Exemplarily, the data classification model 30 is a neural network model for classifying each heartbeat data segment in the electrocardiogram, each heartbeat data segment can reflect the key waveform of a heartbeat, and then the predicted classification result corresponding to each heartbeat can be used to determine whether the heartbeat corresponding to the electrocardiogram is abnormal. Optionally, the model training device 10 can train the data classification model 30 in a machine learning manner so that it has better performance.
[0061] The trained data classification model 30 can be deployed in the model using device 20 for use to provide data classification services. The model using device 20 can be a terminal device such as a mobile phone, a computer, a smart TV, a multimedia playback device, a wearable device, a medical device, or a server, which is not limited in the present embodiment of the application.
[0062] For example, Figure 1 As shown, the data classification model 30 may include a first feature extraction network 31, a second feature extraction network 32 and a classifier 33. The first feature extraction network 31 is used to extract features from each data segment in the training data to obtain independent feature representations corresponding to each data segment; the second feature extraction network 32 is used to obtain a continuous feature representation corresponding to the input data, which can be obtained based on independent feature representations corresponding to multiple continuous data segments; the classifier 33 is used to predict the category of the data segment to obtain the predicted classification result corresponding to the data segment. The data segments in the training data are periodically and continuously changing, and each data segment has similarity.
[0063] Among them, the input of the first feature extraction network 31 is the embedding vectors corresponding to the n data segments, and the embedding vectors corresponding to the data segments represent the data segments with vector data. The output of the first feature extraction network 31 is the independent feature representation corresponding to the n data segments, and the independent feature representation is used to characterize the data segments, such as the features of a single heartbeat. Optionally, the first feature extraction network 31 can be constructed based on CNN (Convolutional Neural Networks), ResNet (Residual Network), DNN (Deep Neural Networks), RNN (Recurrent Neural Network), Transformer network (a sequence generation neural network), etc., and the embodiments of the present application are not limited to this.
[0064] The input of the second feature extraction network 32 is the independent feature representation corresponding to the first m data segments in the training data. The output of the first feature extraction network 31 is the continuous feature representation corresponding to the input data, and the continuous feature representation is used to characterize the input data, such as continuous heartbeat features. Optionally, the network structure of the second feature extraction network 32 can be the same as the network structure of the first feature extraction network 31, but the network parameters of the second feature extraction network 32 are different from the network parameters of the first feature extraction network 31. Alternatively, the network structure of the second feature extraction network 32 is different from the network structure of the first feature extraction network 31. The second feature extraction network 32 can also be constructed based on networks such as CNN, ResNet, DNN, RNN, Transformer, etc., which is not limited to this embodiment of the present application.
[0065] The input of the classifier 33 is the final feature representation corresponding to the nth data segment, which can be obtained by concatenating the continuous feature representation and the independent feature representation corresponding to the nth data segment. The output of the classifier 33 is the predicted classification result corresponding to the nth data segment. When the classifier 33 is a multi-type classifier, the predicted classification result can be used to indicate the possibility that the nth data segment belongs to each category, or, when the classifier 33 is a binary classifier, the predicted classification result can be used to indicate whether the nth data segment belongs to a specified category.
[0066] The model using device 20 trains the data classification model 30 according to the predicted classification result and the actual classification result corresponding to the nth data segment to obtain the trained data classification model 30. The training process is an iterative process, and the network parameter iteration of the data classification model 30 can be completed according to multiple training data.
[0067] The trained data classification model 30 can be deployed in the model using device 20 for use. Exemplarily, input data (such as an electrocardiogram) is input into the model using device 20, and the model using device 20 can obtain the classification results of each data segment in the input data through the data classification model 30, such as the prediction type corresponding to the data segment.
[0068] Below, the technical solution provided by the embodiment of the present application will be introduced and explained through a method embodiment.
[0069] Please refer to Figure 2 , which shows a flow chart of a data classification method provided by an embodiment of the present application. The execution subject of each step of the method may be the model using device 20 introduced above. The method may include the following steps (201-205):
[0070] Step 201: Acquire input data, where the input data includes n data segments that change periodically and continuously, where n is an integer greater than 1.
[0071] The above-mentioned input data refers to the input of the above-mentioned data classification model, which may refer to any data that changes periodically and continuously, such as electrocardiogram signals, pulse data, voltage and current data that change periodically and continuously, etc. The embodiments of the present application are not limited to this.
[0072] Optionally, the above data segment may refer to data corresponding to a cycle in the input data. Exemplarily, the input data includes sampling data corresponding to a plurality of consecutive sampling points, and the plurality of sampling points are arranged in chronological order. Then, a data segment may include sampling data corresponding to each sampling point in a cycle, that is, each data segment includes sampling data corresponding to a plurality of consecutive sampling points. Optionally, each sampling point may correspond to a sampling moment, and the sampling moments are periodic.
[0073] For example, refer to Figure 3 Taking an electrocardiogram as an example, the electrocardiogram 300 includes a plurality of heartbeat data segments 301 corresponding to cardiac cycles, each heartbeat data segment 301 corresponding to a heartbeat, which can reflect the characteristics of the heartbeat. Each heartbeat data segment 301 can include key waveforms of the heartbeat, such as R wave, P wave, T wave, etc.
[0074] In one example, the above input data is obtained by intercepting the original data, that is, the input data is a part of the original data. Exemplarily, every n continuously changing data segments in the original data can constitute an input data. Optionally, the original data can be data obtained by real-time sampling, such as an electrocardiogram sampled in real time using a smart wearable device (smart bracelet, smart watch, etc.). After sampling n-1 heartbeat data segments, each new sampling completes a heartbeat data segment, and an input data can be generated, so that the classification result corresponding to the heartbeat data segment can be quickly obtained. In this case, each input data can be used to predict the classification result of the nth data segment in the input data (that is, the last data segment in the input data).
[0075] Exemplarily, the input data can be recorded as: H i+1 ,H i+2 ,...,H i+n-1 ,H i+n ,H i+n is the nth data segment in the ith input data. For example, the input data may be any 10 consecutive data segments in the original data.
[0076] Optionally, the raw data may also be data that has been sampled. Exemplarily, the raw data may be a historical electrocardiogram. Alternatively, in an electrocardiogram classification task, classification is performed after obtaining a complete electrocardiogram. In this case, each input data may be used to predict the classification result of any data segment in the input data, which is not limited in the embodiments of the present application.
[0077] Step 202: Obtain independent feature representations corresponding to n data segments in the input data, respectively, where the independent feature representations are used to characterize the data segments.
[0078] Optionally, by using the first feature extraction network in the above data classification model, feature extraction is performed on the n data segments respectively, so that independent feature representations corresponding to the n data segments can be obtained.
[0079] In one example, if Figure 4 As shown, step 202 may also include the following sub-steps:
[0080] Step 202a, denoising the input data to obtain denoised input data, wherein noise data is filtered out of the denoised input data.
[0081] Due to the influence of the environment, equipment, etc., the sampled data is often accompanied by a large amount of noise data, which brings great challenges to feature extraction. For example, in the process of collecting ECG signals, it is very susceptible to the influence of the internal and external environment, such as limb movement, breathing, electromagnetic interference in the environment, etc., and the directly collected ECG signals are often accompanied by a large amount of noise data. Therefore, the embodiment of the present application also denoises the input data to reduce the influence of noise data on feature extraction, thereby improving the accuracy of feature extraction, and then improving the accuracy of classification results.
[0082] Optionally, the denoising method adopted in the embodiment of the present application may include at least one of the following: median filtering, empirical mode decomposition method, wavelet transform, curve fitting and high-pass filtering.
[0083] Exemplarily, when the median filtering method is adopted, step 202a may also include the following contents:
[0084] 1. Get the filter window corresponding to the input data. The number of sampling points corresponding to the filter window is an odd number.
[0085] The filter window is used to indicate the number of sampling points in each denoising process. The denoised input data can be obtained by traversing and filtering the input data according to the filter window. The sampled data corresponding to one sampling point in the input data can be denoised each time according to the filter window.
[0086] Exemplarily, the length of the filter window can be recorded as: L=2M+1, where M is a positive integer, which can be set and adjusted according to actual use requirements. The filter window needs to ensure that there is a median in the filter window.
[0087] 2. For the first sampling point in the input data, with the first sampling point as the center, obtain the sampling data corresponding to the odd number of sampling points from the input data to generate the data to be denoised corresponding to the first sampling point.
[0088] The first sampling point may refer to any sampling point in the input data. With the first sampling point as the center, the data to be denoised corresponding to the first sampling point may be obtained according to the filtering window.
[0089] Exemplarily, the data to be denoised corresponding to the first sampling point can be expressed as follows:
[0090] x(nM),...,x(n),...,x(n+M);
[0091] Wherein, x(n) is the sampling data corresponding to the first sampling point.
[0092] 3. The median sampling data in the to-be-denoised data corresponding to the first sampling point is determined as the denoised data corresponding to the first sampling point.
[0093] Optionally, the denoised data corresponding to the first sampling point can be expressed as follows:
[0094] y(n)=med[x(nM),...,x(n),...,x(n+M)];
[0095] Wherein, med[] represents the operation of sorting all the sampled data in the filter window from small to large and then taking the median. Optionally, the length of the filter window can be selected to be about 30% of the sampling rate. Wherein, the sampling rate refers to the sampling rate of the above-mentioned sampled data, which corresponds to the sampling period corresponding to the sampling point.
[0096] 4. According to the denoised data corresponding to each sampling point in the input data, the denoised input data is obtained.
[0097] The denoised data corresponding to each sampling point in the input data are concatenated in chronological order to obtain the denoised input data.
[0098] For example, refer to Figure 5 Taking the electrocardiogram as an example, after the electrocardiogram signal 501 is subjected to median filtering, the jitter in the electrocardiogram signal 501 can be filtered out (such as removing the baseline drift), and a relatively smooth denoised electrocardiogram signal 502 can be obtained, thereby improving the usability of the electrocardiogram signal. Since the median filtering method is simple, fast in processing speed and obvious in effect, it can improve the denoising efficiency and effect of the input data, and reduce the denoising complexity of the input data.
[0099] In the case of using the empirical mode decomposition method, step 202a may also include the following content: find all extreme points of the input data X(t), and use the extreme points to fit the envelope. For example, the upper envelope Up_envelop is fitted according to all the maximum points through the cubic spline function, and the lower envelope Low_envelop is fitted according to all the minimum points through the cubic spline function. Then, based on the upper envelope and the lower envelope, the mean envelope is calculated: m(t) = (Up_envelop + Low_envelop) / 2. Finally, the mean envelope is subtracted from the input data to obtain the intermediate signal: r(t) = X(t)-m(t).
[0100] If the intermediate signal satisfies the two constraints of IMF (Intrinsic Mode Functions), the intermediate signal is the denoised input data. If not, the iteration is repeated.
[0101] Optionally, the empirical mode decomposition method satisfies:
[0102]
[0103] Among them, res is the residual component, r k (t) is the IMF decomposed for the kth time, and n is the total number of decompositions. Assuming that r(t) is the first high-frequency component IMF1 decomposed, the mean envelope is a low-frequency component relative to IMF1, and then m(t) is used as input data to continue decomposing to obtain the next IMF until the residual component is a monotonic function or a constant, and then stop decomposing.
[0104] When the wavelet transformation method is adopted, step 202a may also include the following contents: selecting a suitable wavelet basis function, decomposing the input data at a certain scale, and obtaining wavelet coefficients at each scale; wherein the wavelet coefficients with relatively large amplitudes are useful signals, and the wavelet coefficients with relatively small amplitudes are noise data. According to the frequency distribution of the input data and the noise data, the wavelet coefficients less than the threshold at each scale can be set to zero or processed with a threshold function. After processing the low-frequency coefficients and high-frequency coefficients after the wavelet scale decomposition respectively, the signal is reconstructed to obtain the denoised input data.
[0105] In the case of using the curve fitting method, step 202a may also include the following content: select the target fitting function, and try to fit the input data to a polynomial and exponential function. After calculating the parameters of the fitting curve, a new curve after fitting is obtained, and the new curve roughly represents the drift baseline. The input data minus the new curve after fitting can obtain the denoised input data. The longer the input data, the better the processing effect of the curve fitting method.
[0106] In the case of adopting the high-pass filtering method, step 202a may also include the following content: filtering the input data through a high-pass filter to obtain the denoised input data. The high-pass filter includes at least one of the following: an IIR (Infinite Impulse Response) filter and a FIR (Finite Impulse Response) filter.
[0107] In an embodiment of the present application, the original data may be uniformly denoised first, and then the input data may be intercepted from the denoised original data. This can reduce the number of denoising times. The denoising method for the original data is the same as the denoising method for the input data mentioned above, and will not be repeated here.
[0108] Step 202b: Obtain embedding vectors corresponding to the n data segments respectively according to the denoised input data.
[0109] For the denoised input data, the n data segments it includes are also denoised, so the data segments used below are all denoised data segments. In the embodiment of the present application, the data segment includes sampled data corresponding to multiple consecutive sampling points, and the sampled data in the denoised data segment is also denoised.
[0110] Embedding refers to the process of converting the original representation of data into a low-dimensional representation that can be processed by a neural network model. The low-dimensional representation is the embedding vector in the embodiment of the present application.
[0111] In one example, the process of obtaining the embedding vector can be as follows:
[0112] 1. According to the denoised input data, the target sampling points corresponding to the n data segments are obtained. The target sampling point refers to the sampling point with the largest sampling data among the multiple sampling points corresponding to the data segment.
[0113] For each data segment in the denoised input data, a maximum value in the data segment is determined, and a sampling point corresponding to the maximum value is determined as a target sampling point corresponding to the data segment.
[0114] For example, refer to Figure 3 For the electrocardiogram 300, the sampling point of the R peak in each heartbeat data segment 301 can be determined as the target sampling point corresponding to each heartbeat data segment 301. The R peak refers to the peak value of the R wave.
[0115] In some feasible examples, the sampling point corresponding to the minimum value in the data segment can also be determined as the target sampling point. The judgment standard of the target sampling point can be set according to actual usage requirements, and the embodiment of the present application is not limited to this.
[0116] 2. For each data segment, take the target sampling point corresponding to the data segment as a reference point, acquire a first number of sampling points forward, and acquire a second number of sampling points backward, to obtain a sampling point sequence corresponding to the data segment.
[0117] The first quantity and the second quantity can be set and adjusted according to actual usage requirements, but they need to cover the key features corresponding to the data segments.
[0118] For example, refer to Figure 3 For a certain heartbeat data segment 301, 90 sampling points before the R peak, 109 sampling points after the R peak, and the target sampling point (i.e., the sampling point corresponding to the R peak) can be combined into a sampling point sequence corresponding to the heartbeat data segment 301. The sampling point sequence corresponding to the heartbeat data segment 301 can cover key features such as the P wave, R wave, and T wave corresponding to the heartbeat data segment 301. The sampling points in the sampling point sequence are sorted in chronological order.
[0119] Optionally, for each data segment, the sampling data corresponding to each sampling point in the sampling point sequence corresponding to the data segment can be used to simplify the data to obtain simplified data, thereby reducing the amount of data in the feature extraction process and avoiding the influence of invalid data.
[0120] For example, taking the case where the number of sampling points corresponding to the sampling point sequence is 200, the data segment can also be simplified as follows:
[0121]
[0122] Among them, H t is the data corresponding to the tth data fragment in the input data, Represents the sampling data corresponding to the 200th sampling point in the tth data segment.
[0123] 3. According to the sampling data corresponding to each sampling point in the sampling point sequence corresponding to the data segment, the embedding vector corresponding to the data segment is obtained.
[0124] Optionally, the embedding vector corresponding to the data segment is obtained according to the simplified data corresponding to the data segment. In one example, the process may be as follows:
[0125] 1) Divide the sampling data corresponding to the sampling point sequence to obtain a plurality of sub-data segments, each of which includes sampling data corresponding to a third number of sampling points.
[0126] Optionally, the sampling data corresponding to every third number of sampling points in the sampling point sequence is used as a sub-data segment. The third number can be set and adjusted according to actual usage requirements. For example, for a sampling point sequence with 200 sampling points, the sampling data corresponding to every 10 sampling points can be used as a sub-data segment, which can be recorded as:
[0127] The sampling data corresponding to each of the 10 consecutive sampling points is divided into a sub-data segment X, a data segment H t Can be divided into 20 sub-data segments.
[0128] 2) For each sub-data segment, obtain the embedding vector corresponding to the sub-data segment according to the sampling data corresponding to the sub-data segment.
[0129] Optionally, the process of obtaining the embedding vector corresponding to the sub-data segment can be expressed as follows:
[0130]
[0131] Among them, Φ[] represents the conversion algorithm of the embedding vector (such as one-hot encoding, Word2Vec and other algorithms), the dimension of the embedding vector is k, and each sub-data segment corresponds to a k-dimensional embedding vector.
[0132] 3) According to the embedding vectors corresponding to the multiple sub-data segments, the embedding vector corresponding to the data segment is obtained.
[0133] Optionally, the embedding vectors corresponding to the above 20 sub-data segments are concatenated to obtain a 20*k embedding matrix v t , the embedding matrix v t That is the above data segment H t The corresponding embedding vector.
[0134] For n data fragments, the embedding vectors can be mapped in sequence: v1, ..., v n-1 , v n .
[0135] Step 202c: Obtain independent feature representations corresponding to the n data segments respectively according to the embedding vectors corresponding to the n data segments respectively.
[0136] Optionally, the first feature extraction network can obtain independent feature representations corresponding to the n data segments respectively according to the embedding vectors corresponding to the n data segments. In one example, the process can be as follows:
[0137] 1. For each data segment, obtain the weight parameters corresponding to each sub-data segment in the data segment.
[0138] The weight parameter corresponding to the sub-data segment is used to indicate the influence of the sub-data segment on the data segment to which it belongs, so as to explain which sub-data segments are more important to the data segment to which it belongs, thereby improving the interpretability of feature extraction.
[0139] Taking a data segment having 20 sub-data segments as an example, the process of obtaining the weight parameters corresponding to the sub-data segments can be expressed as follows:
[0140]
[0141] in, is the weight parameter corresponding to the T-th sub-data segment in the t-th data segment, is a learnable parameter of the embedding vector of the T-th sub-data segment in the t-th data segment. The learnable parameter can be obtained by training the data classification model. The training process of the data classification model will be described in detail below and will not be repeated here.
[0142] 2. According to the weight parameters corresponding to the sub-data segments in the data segment, the embedding vectors corresponding to the sub-data segments in the data segment are fused to obtain a first fused vector.
[0143] Optionally, the first fusion vector can be expressed as:
[0144] in, is the embedding vector of the T-th sub-data segment in the t-th data segment.
[0145] By using the attention mechanism, the embedding vectors corresponding to each sub-data fragment in the data fragment are fused, which not only enables the independent feature representation to learn the internal features of each sub-data fragment, but also to understand which sub-data fragments are more important to the data fragment, thereby improving the interpretability and accuracy of the independent feature representation.
[0146] 3. For each sub-data segment in the data segment, obtain the Hadamard product between the sub-data segment and each target sub-data segment corresponding to the sub-data segment; wherein the target sub-data segment refers to the sub-data segment after the sub-data segment in the data segment.
[0147] 4. Fusing the Hadamard products between the sub-data segments and each target sub-data segment corresponding to the sub-data segment to obtain a second fused vector corresponding to the sub-data segment.
[0148] 5. Fuse the second fusion vectors corresponding to each sub-data segment in the data segment to obtain a third fusion vector.
[0149] Optionally, the third fusion vector can be expressed as:
[0150] in, for The corresponding target sub-data fragment, ⊙ represents the Hadamard product, is the second fusion vector, so that the independent feature representation can learn the relationship between each sub-data segment in the data segment, thereby further improving the interpretability and accuracy of the independent feature representation.
[0151] 6. Fuse the first fusion vector and the third fusion vector to obtain an independent feature representation corresponding to the data segment.
[0152] The independent feature representation corresponding to the data segment can be expressed as:
[0153]
[0154] In this way, the independent feature representation can simultaneously learn the internal features of each sub-data segment, which sub-data segments are more important to the data segment, and the relationship between each sub-data segment, thereby improving the interpretability and accuracy of the independent feature representation.
[0155] Step 203: Generate a continuous feature representation based on the independent feature representations corresponding to the first m data segments in the input data. The continuous feature representation is used to characterize the input data, where m is a positive integer less than n.
[0156] The embodiment of the present application does not limit the value of m, which can be set according to actual use requirements. For example, m=n-1, that is, the m data segments are all data segments in the input data except the nth data segment.
[0157] Optionally, the first m data segments may refer to the m data segments before the nth data segment in the input data, that is, obtaining m data segments from the nth data segment forward, so that the feature representations of the m data segments adjacent to the nth data segment can be obtained to determine the influence of the adjacent m data segments on the nth data segment, thereby improving the interpretability of the data classification model.
[0158] Exemplarily, based on the above embodiment, when m=n-1, the independent feature representations corresponding to the first m data segments in the i-th input data can be expressed as: i+1 , ..., s i+n-2 ,s i+n-1 .
[0159] In one example, an attention mechanism can be used to obtain continuous feature representations. The process may include the following:
[0160] 1. According to the independent feature representations corresponding to the first m data fragments, the weight parameters corresponding to the first m data fragments are obtained.
[0161] The weight parameter corresponding to the data segment is used to indicate the influence of the data segment on the data segment to be classified (i.e., the nth data segment), so that it can explain which adjacent data segments are more important to the data segment to be classified, thereby improving the interpretability of feature extraction.
[0162] Exemplarily, the process of obtaining the weight parameters corresponding to the data segments can be expressed as follows:
[0163]
[0164] Among them, u tis the weight parameter corresponding to the t-th data segment, <, > represents the inner product, f2() and f3() represent feedforward neural networks, which are used to project the independent feature representation into a new vector space (such as using a fully connected network to convert the independent feature representation to a specified dimension, such as reducing the dimensionality of the independent feature representation), k is the dimension of the embedded vector, and f2() and f3() can design different types of network structures according to actual computing resources.
[0165] 2. Perform dimension conversion on the independent feature representations corresponding to the first m data segments to obtain the converted feature representations corresponding to the first m data segments.
[0166] Alternatively, the process can be expressed as follows: f1(s t ), f1() represents a feedforward neural network, which designs different types of network structures according to actual computing resources. For example, f1() can be used to reduce the dimensionality of independent feature representation.
[0167] 3. According to the weight parameters corresponding to the first m data fragments, the transformed feature representations corresponding to the first m data fragments are fused to obtain a continuous feature representation.
[0168] Alternatively, the continuous feature representation can be expressed as follows:
[0169]
[0170] In this way, the continuous feature representation can not only extract the global features of each adjacent data segment corresponding to the data segment to be classified, but also capture the correlation between different adjacent data segments, and can better explain which adjacent data segment has a greater impact on the data segment to be classified.
[0171] Step 204: Generate a final feature representation corresponding to the nth data segment according to the continuous feature representation and the independent feature representation corresponding to the nth data segment.
[0172] Optionally, the continuous feature representation and the independent feature representation corresponding to the n-th data segment are concatenated to generate a final feature representation corresponding to the n-th data segment.
[0173] For example, when the independent feature representation is represented by a feature vector, the independent feature representation corresponding to the nth data segment is directly spliced after the continuous feature representation to obtain the final feature representation corresponding to the nth data segment. Alternatively, when the independent feature representation is represented by a feature vector, the continuous feature representation is directly spliced after the independent feature representation corresponding to the nth data segment to obtain the final feature representation corresponding to the nth data segment, which is not limited in the embodiments of the present application.
[0174] The final feature representation corresponding to the nth data fragment can represent the association between the nth data fragment and the first m data fragments, as well as the influence of the first m data fragments on the nth data fragment, thereby improving the interpretability of the final feature representation.
[0175] Step 205: classify the nth data segment according to the final feature representation corresponding to the nth data segment to obtain a classification result corresponding to the nth data segment.
[0176] Optionally, the nth data segment is classified according to the final feature representation corresponding to the nth data segment by a classifier in the data classification model to obtain a classification result corresponding to the nth data segment.
[0177] The classification result corresponding to the nth data segment is used to indicate the category of the nth data segment. Since the above data classification model is trained, the category indicated by the classification result corresponding to the nth data segment can be directly determined as the category corresponding to the nth data segment.
[0178] Optionally, by processing multiple input data corresponding to the original data through a data classification model, the classification results corresponding to each data segment in the original data can be obtained, and then the analysis of the original data can be completed based on the classification results corresponding to each data segment. Optionally, at the initial sampling stage of the original data, the sampling device may not be stable, and the quality of the first m data segments in the original data cannot be guaranteed. In this case, the first m data segments in the original data can be removed, and then the original data can be analyzed, so as to improve the rationality of the analysis of the original data.
[0179] In some embodiments, after obtaining the classification results corresponding to each data segment in the original data, an interpretability method can also be used to analyze and explain the original data according to the classification results. The interpretability method is used to explore how the neural network model performs inference, and the interpretability method includes at least one of the following: gradient method, integral gradient method, class activation mapping method, and gradient class activation mapping method.
[0180] Optionally, one of the above-mentioned multiple interpretability methods can be selected to interpret the original data, which is the most suitable interpretability method for the original data. The process may include the following:
[0181] 1. Remove the first m data fragments from the original data to obtain the adjusted original data.
[0182] The quality of the first m data segments in the original data cannot be guaranteed and can be discarded.
[0183] 2. Obtain the classification results corresponding to each remaining data segment in the adjusted original data.
[0184] By adopting the above data classification method, each time a new residual data segment is generated, the classification result corresponding to the residual data segment is obtained, thereby obtaining the classification results corresponding to each residual data segment in the original data.
[0185] 3. According to the classification results corresponding to the remaining data fragments, the remaining data fragments are divided to obtain multiple data sets, each data set corresponding to a classification result.
[0186] Exemplarily, if the original data corresponds to w different classification results, then w data sets can be constructed.
[0187] 4. Extract a remaining data segment from multiple data sets multiple times and splice them to obtain multiple grid data.
[0188] Exemplarily, for w data sets, a residual data segment is randomly extracted from each data set each time, and then a grid data can be obtained, that is, for each classification result, the residual data segment corresponding to it appears at most once in the grid data. After multiple extractions, multiple grid data of size 1*n can be obtained. Optionally, the first residual data segment in different grid data can correspond to different classification results, and the first residual data segment in different grid data can be different. For example, the first residual data segment of multiple grid data can cover all classification results corresponding to the original data.
[0189] refer to Figure 6 , taking the heartbeat data fragment as an example, Figure 6 A grid data is shown as an example, and the grid data includes remaining heartbeat data segments of three different heartbeat types, such as sinus rhythm, sinus bradycardia and sinus tachycardia. The remaining heartbeat data segment corresponding to sinus rhythm can be used as the first remaining data segment.
[0190] 5. For various interpretability methods, obtain the importance scores of the interpretability methods under each grid data constraint. The importance score is used to measure the positive attribution value of the first remaining data fragment in the grid data, which accounts for the proportion of the positive attribution value of the grid data.
[0191] Among them, the category corresponding to the first remaining data segment can be defaulted to the category of concern assigned by the data classification model to the grid data, so as to detect whether the interpretability method is suitable for explaining the classification process of the data classification model.
[0192] The higher the importance score, the higher the proportion of positive attribution value of the first remaining data segment. Figure 6In a grid data, the first area 601 represents the area occupied by the positive attribution value of the first remaining data fragment, and the second area 602 represents the area occupied by the positive attribution values of other remaining data fragments in the grid data. The larger the first area 601 is, the more suitable the interpretability method is for explaining the classification process of the data classification model.
[0193] In one example, the process of obtaining the importance score may be as follows:
[0194] 1) For each remaining data segment in the grid data, obtain the positive attribution sum value between the remaining data segment and the interpretability method. The positive attribution sum value refers to the sum of the positive attribution values between each sampled data in the remaining data segment and the interpretability method under the constraint of the classification result corresponding to the remaining data segment.
[0195] Among them, the positive attribution value of the sampled data is used to indicate the contribution of the sampled data to the classification result corresponding to the remaining data segment to which it belongs, that is, the influence of the sampled data in the process of the data classification model determining the classification result of the remaining data segment, such as whether it is important. The positive attribution value acquisition method corresponding to each interpretability method is different, but the expression meaning is consistent.
[0196] Exemplarily, the positive attribution and value can be expressed as:
[0197] Among them, s k is the kth remaining data fragment in the grid data, p is s k The sampling point in A + (p) is the positive attribution value calculated for p by a certain interpretability method.
[0198] 2) The forward attribution sums between each remaining data fragment in the grid data and the interpretability method are summed to obtain a first sum.
[0199] Exemplarily, the first sum value corresponding to a certain interpretability method can be expressed as follows:
[0200] Where n is the total number of remaining data fragments in the grid data.
[0201] 3) Divide the positive attribution sum between the first remaining data segment and the interpretability method by the first sum to obtain the importance score of the interpretability method under the grid data constraint.
[0202] For example, the importance score of a certain interpretability method under the grid data constraint can be expressed as follows:
[0203]
[0204] Among them, L i refers to the importance score of the i-th interpretability method under the grid data constraint, S c is the first remaining data segment in the grid data. If all positive attributions are located in the correct remaining data segment, then L i =1; if the positive attribution is evenly distributed on each remaining data segment, then L i =1 / n.
[0205] 6. According to the importance scores of the interpretability methods under each grid data constraint, obtain the final importance scores corresponding to the interpretability methods.
[0206] The final importance score corresponding to the interpretability method can indicate the extent to which the interpretability method is suitable for explaining the classification process of the data classification model. The higher the final importance score, the more suitable the interpretability method is for explaining the classification process of the data classification model.
[0207] Optionally, processing methods such as summation, averaging, weighted summation, weighted averaging, etc. can be used to process the importance scores of the interpretability methods under each grid data constraint to obtain the final importance score corresponding to the interpretability method. The embodiments of the present application are not limited to this.
[0208] 7. Determine the interpretability method that is suitable for the original data based on the final importance scores corresponding to multiple interpretability methods.
[0209] Optionally, the interpretability method with the highest final importance score is determined as the interpretability method applicable to the original data. The interpretability method applicable to the original data refers to the interpretability method that is most suitable for explaining the classification process of the original data among multiple interpretability methods, that is, the interpretability method that is most suitable for explaining the classification process of the data classification model.
[0210] For the sampled data in each remaining data segment, a thermal value positively correlated with the positive attribution value can be assigned according to the positive attribution value under the above-mentioned interpretability method, thereby obtaining a saliency map, which can be used to visualize the classification basis of the data classification model (i.e., the sampled data that affects the classification result, and its corresponding degree of influence), thereby further improving the interpretability of the data segment classification process. For example, when displaying the saliency map, the display brightness of the sampled data can be adjusted according to the thermal value.
[0211] To summarize, the technical solution provided by the embodiment of the present application determines the continuous feature representation corresponding to the input data based on the independent feature representations corresponding to the first m data fragments, and then obtains the final feature representation corresponding to the nth data fragment based on the continuous feature representation and the independent feature representation corresponding to the nth data fragment. The final feature representation corresponding to the nth data fragment can not only reflect the characteristics of the nth data fragment, but also reflect the influence of the first m data fragments on the nth data fragment, as well as the global characteristics of the nth data fragment in the input data, thereby improving the interpretability and accuracy of the final feature representation, and then improving the interpretability of the data fragment classification process and the accuracy of obtaining the classification results.
[0212] In addition, by adopting the attention mechanism and Hadamard product, the independent feature representation can simultaneously learn the internal features of each sub-data fragment (fully mining the information), which sub-data fragments are more important to the data fragment, and the relationship between each sub-data fragment, thereby improving the interpretability and accuracy of the independent feature representation, and then improving the interpretability of the data fragment classification process and the accuracy of the classification results.
[0213] In addition, by adopting the attention mechanism, the continuous feature representation can not only extract the global features of each adjacent data fragment of the data fragment to be classified (fully mine information), but also capture the correlation between different adjacent data fragments, and better explain which adjacent data fragment has a greater impact on the data fragment to be classified, thereby improving the interpretability and accuracy of the continuous feature representation, and then improving the interpretability of the data fragment classification process, as well as the accuracy of the classification results. In addition, by splicing the above-mentioned continuous feature representation and the above-mentioned independent feature representation, the interpretability and accuracy of the final feature representation can be improved.
[0214] In addition, by adopting the above-mentioned quantitative evaluation method of interpretability, the interpretability method that best matches the data classification task can be determined, and the interpretability method can be used to generate a saliency map (i.e., classification basis), thereby further improving the interpretability of the data segment classification process and the rationality of the use of the interpretability method.
[0215] Please refer to Figure 7 , which shows a flow chart of a method for training a data classification model provided by an embodiment of the present application. The execution subject of each step of the method may be the model training device 10 introduced above. The method may include the following steps (701-706):
[0216] Step 701, obtaining training data, the training data including n data segments that are periodically and continuously changing, each data segment being labeled with a true classification result, and n being an integer greater than 1.
[0217] The above-mentioned training data is used to train the above-mentioned data classification model, which may refer to any data that changes continuously and periodically. The training data may refer to the historical data corresponding to the input data in the above-mentioned embodiment, such as the ECG signal in the historical ECG, historical pulse data, historical voltage and historical current data that change continuously and periodically, etc., which are not limited in the embodiments of the present application. Optionally, for data classification tasks in different scenarios, the historical data in the same scenario may be used to construct training data, and the method for constructing training data is the same as the method for constructing input data. The data segment in the embodiments of the present application may refer to the data corresponding to a cycle in the training data.
[0218] The real classification result is used to indicate the real category of the data segment, which can be used as the label data of the data segment to perform supervised training on the data classification model. The real classification result can be manually labeled, such as the real category obtained by expert labeling.
[0219] Steps 702-705 below are the same as steps 202-205 in the above embodiment. The contents not described in the embodiment of the present application can be referred to the above embodiment and will not be repeated here.
[0220] Step 702: Obtain independent feature representations corresponding to n data segments in the training data through a data classification model, where the independent feature representations are used to characterize the data segments.
[0221] Optionally, the training data is first denoised to obtain denoised training data, and the noise data is filtered out of the denoised training data. Exemplarily, a filter window corresponding to the training data is obtained, and the number of sampling points corresponding to the filter window is an odd number; for the first sampling point in the training data, the sampling data corresponding to the odd number of sampling points are obtained from the training data with the first sampling point as the center, and the data to be denoised corresponding to the first sampling point is generated; the median sampling data in the data to be denoised corresponding to the first sampling point is determined as the denoised data corresponding to the first sampling point; the denoised training data is obtained according to the denoised data corresponding to each sampling point in the training data.
[0222] Then, based on the denoised training data, the embedding vectors corresponding to the n data segments are obtained. Exemplarily, based on the denoised training data, the target sampling points corresponding to the n data segments are obtained, and the target sampling point refers to the sampling point with the largest sampling data among the multiple sampling points corresponding to the data segment; for each data segment, the target sampling point corresponding to the data segment is used as a reference point, a first number of sampling points are obtained forward, and a second number of sampling points are obtained backward to obtain a sampling point sequence corresponding to the data segment; based on the sampling data corresponding to each sampling point in the sampling point sequence corresponding to the data segment, the embedding vector corresponding to the data segment is obtained.
[0223] Among them, the process of obtaining the embedding vector corresponding to the data segment may also include: dividing the sampling data corresponding to the sampling point sequence to obtain multiple sub-data segments, the sub-data segments including the sampling data corresponding to the third number of sampling points; for each sub-data segment, according to the sampling data corresponding to the sub-data segment, obtaining the embedding vector corresponding to the sub-data segment; according to the embedding vectors corresponding to the multiple sub-data segments, respectively, obtaining the embedding vector corresponding to the data segment.
[0224] Finally, the first feature extraction network is used to obtain the independent feature representations corresponding to the n data segments according to the embedding vectors corresponding to the n data segments. Exemplarily, for each data segment, the weight parameters corresponding to each sub-data segment in the data segment are obtained; the embedding vectors corresponding to each sub-data segment in the data segment are fused according to the weight parameters corresponding to each sub-data segment in the data segment by the first feature extraction network to obtain a first fused vector; for each sub-data segment in the data segment, the first feature extraction network is used to obtain the Hadamard product between the sub-data segment and each target sub-data segment corresponding to the sub-data segment; wherein the target sub-data segment refers to the sub-data segment after the sub-data segment in the data segment; the Hadamard product between the sub-data segment and each target sub-data segment corresponding to the sub-data segment is fused by the first feature extraction network to obtain a second fused vector corresponding to the sub-data segment; the second fused vectors corresponding to each sub-data segment in the data segment are fused by the first feature extraction network to obtain a third fused vector; the first fused vector and the third fused vector are fused by the first feature extraction network to obtain an independent feature representation corresponding to the data segment.
[0225] Step 703, using the data classification model, generates a continuous feature representation according to the independent feature representations corresponding to the first m data segments in the training data, where m is a positive integer less than n.
[0226] Optionally, first, based on the independent feature representations corresponding to the first m data segments, weight parameters corresponding to the first m data segments are obtained; then, the independent feature representations corresponding to the first m data segments are dimensionally transformed to obtain converted feature representations corresponding to the first m data segments; finally, the converted feature representations corresponding to the first m data segments are fused through a second feature extraction network based on the weight parameters corresponding to the first m data segments to obtain a continuous feature representation.
[0227] Step 704: Generate a final feature representation corresponding to the nth data segment according to the continuous feature representation and the independent feature representation corresponding to the nth data segment.
[0228] Optionally, the continuous feature representation and the independent feature representation corresponding to the n-th data segment are concatenated to generate a final feature representation corresponding to the n-th data segment.
[0229] Step 705: classify the nth data segment according to the final feature representation corresponding to the nth data segment through the data classification model to obtain a predicted classification result corresponding to the nth data segment.
[0230] Optionally, the nth data segment is classified according to the final feature representation corresponding to the nth data segment by a classifier in the data classification model to obtain a predicted classification result corresponding to the nth data segment, wherein the predicted classification result is used to indicate the predicted classification of the data segment.
[0231] Step 706, training the data classification model according to the predicted classification result and the actual classification result corresponding to the nth data segment to obtain a trained data classification model, and the trained data classification model is used to classify the data segments in the input data.
[0232] Optionally, according to the difference between the predicted classification result and the actual classification result corresponding to the nth data segment, the training loss of the data classification model is obtained; with the goal of minimizing the training loss, the parameters of the data classification model are adjusted to obtain a trained data classification model.
[0233] The training loss is used to indicate the difference between the predicted classification result and the actual classification result. In the embodiment of the present application, the training loss can be constructed by using at least one of the following: a cross entropy loss function, a mean square error loss function, and a focal loss function.
[0234] For example, when the cross entropy loss function is used to construct the training loss, the training loss can be expressed as follows:
[0235]
[0236] Among them, n is the total number of categories that the classifier can predict, y i is the label data, i.e. the real classification result, is the predicted classification result corresponding to the i-th data segment, and θ is the parameter of the data classification model.
[0237] When the mean square error loss function is used to construct the training loss, the training loss can be expressed as follows:
[0238]
[0239] Where n is the total number of training data.
[0240] It should be noted that the training process of the data classification model is an iterative process, but the method used in each iterative process is the same. The above only takes one iterative process as an example. After the data classification model is iteratively trained with multiple training data, a trained data classification model can be obtained.
[0241] To summarize, the technical solution provided by the embodiment of the present application determines the continuous feature representation corresponding to the input data based on the independent feature representations corresponding to the first m data fragments, and then obtains the final feature representation corresponding to the nth data fragment based on the continuous feature representation and the independent feature representation corresponding to the nth data fragment. The final feature representation corresponding to the nth data fragment can not only reflect the characteristics of the nth data fragment, but also reflect the influence of the first m data fragments on the nth data fragment, as well as the global characteristics of the nth data fragment in the input data, thereby improving the interpretability and accuracy of the final feature representation, and then improving the interpretability of the data fragment classification process and the accuracy of obtaining the classification results.
[0242] In addition, by adopting the attention mechanism and Hadamard product, the independent feature representation can simultaneously learn the internal features of each sub-data fragment (fully mining the information), which sub-data fragments are more important to the data fragment, and the relationship between each sub-data fragment, thereby improving the interpretability and accuracy of the independent feature representation, and then improving the interpretability of the data fragment classification process and the accuracy of the classification results.
[0243] In addition, by adopting the attention mechanism, the continuous feature representation can not only extract the global features of each adjacent data fragment of the data fragment to be classified (fully mine information), but also capture the correlation between different adjacent data fragments, and better explain which adjacent data fragment has a greater impact on the data fragment to be classified, thereby improving the interpretability and accuracy of the continuous feature representation, and then improving the interpretability of the data fragment classification process and the accuracy of obtaining the classification results.
[0244] In some embodiments, taking the electrocardiogram classification task as an example, the technical solution provided by the embodiment of the present application is described, and its specific content may be as follows:
[0245] With the introduction of the concept of "smart healthcare", small and sophisticated wearable medical IoT smart devices continue to emerge, such as smart watches, smart bracelets, etc. By wearing these smart devices, the user's daily vital signs such as blood oxygen and electrocardiogram can be detected. After processing, these detected data will be transmitted to the data aggregation platform for data analysis. The data aggregation platform will then feed back the analysis results to applications on terminal devices such as mobile phones, so that users can obtain their physical conditions in near real time.
[0246] The technical solution provided by the embodiment of the present application can be installed on smart devices such as smart watches and smart bracelets to classify the electrocardiograms obtained by the smart devices. In addition, the embodiment of the present application will also screen out the most suitable interpretability method for the electrocardiogram classification task through the above-mentioned interpretability quantitative evaluation method to generate a saliency map of abnormal heartbeats, and feed it back to the user through the application program, so that the user can intuitively perceive the classification basis and trust the classification results of the smart device.
[0247] For example, taking a smart bracelet as an example, the smart bracelet obtains the user's electrocardiogram through the electrodes on the smart bracelet, and then classifies the heartbeat data fragments in the electrocardiogram through the above data classification model to obtain the classification result corresponding to the electrocardiogram. At the same time, the smart bracelet finds the most suitable interpretability method to generate a saliency map corresponding to the electrocardiogram. The smart bracelet combines the classification result and the saliency map. Figure 1 The data is transmitted to the application, through which the user can obtain the classification results and significance map corresponding to the electrocardiogram to understand the abnormal heartbeat, the abnormal heartbeat ratio, the type of abnormal heartbeat, and the reason why the abnormal heartbeat is classified as abnormal.
[0248] For example, refer to Figure 8 , which exemplifies a schematic diagram of the user interface of the above application. Area 801 shows the real-time collected electrocardiogram (you can slide left and right to view it, or you can zoom in to view each heartbeat data fragment), and the data in the upper right corner of area 801 is the average heart rate. Area 802 shows the abnormal heartbeat ratio (click to further display the proportion of abnormal heartbeats in each category). Area 803 shows the diagnosis results, which can give a comprehensive diagnosis result based on the abnormal type of heartbeat and the abnormal heartbeat ratio. Area 804 shows the abnormal classification basis and the significance map of the abnormal heartbeat, wherein the highlighted part in the significance map corresponds one to one with the classification basis (i.e., the sampling data). Area 805 shows the detailed interpretation data of the electrocardiogram. Area 806 is used to display the user's heartbeat condition for a week for before and after comparison, so that the user can obtain the heartbeat condition at a macro level.
[0249] In some feasible examples, the classification results and saliency maps corresponding to the electrocardiogram can be bound to social software. When the user's heartbeat is abnormal, the social software client can remind the user to pay attention to his or her physical condition in time and make appropriate adjustments to his or her living habits. You can also set a threshold based on the user's physical parameters. When the abnormal heartbeat ratio is higher than this threshold, the client will regard it as a "strong abnormal heartbeat". At this time, the social software will send the user's abnormal condition to the user's pre-set emergency contacts (such as relatives and family members) to remind the emergency contacts to care about their health status, or send them to the doctor in time to reduce the occurrence of accidents.
[0250] In other feasible examples, for the measured electrocardiogram, a paid "Internet doctor" function can be launched to send the electrocardiogram to a doctor for further manual diagnosis and issue a diagnosis report, saving the user's time and medical resources in going to the hospital. The existence of the saliency map can also greatly reduce the workload of doctors and assist them in judging the type of heartbeat.
[0251] Since smart devices can also collect vital signs such as blood oxygen and respiratory rate, they can also combine this data with the electrocardiogram to detect sleep apnea.
[0252] For example, reference Fig. 9 , taking the input data as ten consecutive heartbeat data segments as an example, the classification of heartbeat data segments is explained.
[0253] 1. The client obtains input data, which includes 10 consecutive heartbeat data segments.
[0254] Optionally, the input data may be obtained from an electrocardiogram, which may be collected in real time by the above-mentioned smart device, or may be clinical data from a hospital, which is not limited in the present embodiment. For example, after the smart device collects 9 heartbeat data segments, each time a new heartbeat data segment is collected, an input data is constructed, which is recorded as: H i+1 , H i+2 , ..., H i+9 , H i+10 .
[0255] The client may be a client corresponding to an application program related to electrocardiogram classification, which is not limited in this embodiment of the present application.
[0256] 2. The client uses the median filtering method to denoise the input data and obtain the denoised input data.
[0257] For example, the heartbeat data segment is subjected to baseline drift removal processing to obtain a denoised heartbeat data segment.
[0258] 3. The client uses the R peak as the reference point for segmentation and segments the denoised input data to obtain simplified data segments corresponding to the 10 heartbeat data segments.
[0259] For example, for each heartbeat data segment, 90 sampling points are taken before the R peak, and 109 sampling points are taken after the R peak. Then, the 200 sampling points including the 199 sampling points and the sampling point where the R peak is located are taken as one heartbeat, that is, the sampling data corresponding to the 200 sampling points are combined into a simplified data segment, which can be recorded as:
[0260] 4. The client obtains the embedding vectors corresponding to the 10 heartbeat data fragments according to the simplified data fragments corresponding to the 10 heartbeat data fragments.
[0261] For the t-th heartbeat data segment, the process of obtaining the corresponding embedding vector can be expressed as follows:
[0262]
[0263] Therefore, the embedding vectors corresponding to the 10 heartbeat data segments can be recorded as: v1, ..., v9, v 10 .
[0264] 5. The client obtains independent feature representations corresponding to the 10 heartbeat data segments respectively according to the embedding vectors corresponding to the 10 heartbeat data segments through the first feature extraction network 901 in the data classification model.
[0265] For the t-th heartbeat data segment, its corresponding independent feature representation can be expressed as:
[0266]
[0267] 6. The client generates a continuous feature representation based on the independent feature representations corresponding to the first 9 heartbeat data segments through the second feature extraction network 902 in the data classification model.
[0268] Alternatively, the continuous feature representation can be expressed as follows:
[0269]
[0270] 7. The client concatenates the continuous feature representation and the independent feature representation corresponding to the 9th heartbeat data segment to obtain the final feature representation corresponding to the 9th heartbeat data segment.
[0271] The final feature representation corresponding to the 9th heartbeat data segment can be recorded as: [A, s i+10 ]; among them, S i+10 It is the independent feature representation corresponding to the 9th heartbeat data segment in the input data.
[0272] 8. The client obtains the classification result corresponding to the 9th heartbeat data segment according to the final feature representation corresponding to the 9th heartbeat data segment through the classifier 903 in the data classification model.
[0273] 9. The client uses the same method to obtain classification results for the subsequent 59 heartbeat data segments. The client can determine the abnormal heartbeat based on the classification results, and then determine the abnormal heartbeat ratio based on the number of abnormal heartbeats.
[0274] 10. The client constructs multiple grid data according to the classification results of the 60 heartbeat data fragments. For each classification result, at most one heartbeat data fragment corresponding to the classification result appears in the grid data.
[0275] 11. The client calculates the importance scores of various interpretability methods based on multiple grid data, and then determines the most appropriate target interpretability method based on the importance scores.
[0276] 12. The client generates a saliency map corresponding to the abnormal heartbeat through the target interpretability method.
[0277] 13. The client displays the classification results and saliency map to the user.
[0278] In summary, applying the technical solution provided in the embodiment of the present application to the electrocardiogram classification task can improve the parseability of the electrocardiogram data segment classification process and improve the classification accuracy of the electrocardiogram data segment. In addition, based on the technical solution provided in the embodiment of the present application, a saliency map of abnormal heartbeats (i.e., a visual classification basis) can be generated through an interpretability method that is most suitable for the electrocardiogram classification task, thereby further improving the interpretability of the heartbeat data segment classification process and the rationality of the use of the interpretability method.
[0279] The following are device embodiments of the present application, which can be used to execute the method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments of the present application.
[0280] Please refer to Fig.10 , which shows a block diagram of a data classification device provided by an embodiment of the present application. The device can be used to implement the above data classification method. The device 1000 may include: an input data acquisition module 1001, an independent representation acquisition module 1002, a continuous representation acquisition module 1003, a final representation acquisition module 1004 and a classification result acquisition module 1005.
[0281] The input data acquisition module 1001 is used to acquire input data, where the input data includes n data segments that change periodically and continuously, where n is an integer greater than 1.
[0282] The independent representation acquisition module 1002 is used to obtain independent feature representations corresponding to n data segments in the input data, respectively, and the independent feature representations are used to characterize the data segments.
[0283] The continuous representation acquisition module 1003 is used to generate a continuous feature representation according to the independent feature representations corresponding to the first m data fragments in the input data, wherein the continuous feature representation is used to characterize the input data, and m is a positive integer less than n.
[0284] The final representation acquisition module 1004 is used to generate a final feature representation corresponding to the nth data segment according to the continuous feature representation and the independent feature representation corresponding to the nth data segment.
[0285] The classification result acquisition module 1005 is used to classify the nth data segment according to the final feature representation corresponding to the nth data segment to obtain the classification result corresponding to the nth data segment.
[0286] In some embodiments, Fig.11 As shown, the independent representation acquisition module 1002 includes: an input data denoising submodule 1002a, an embedding vector acquisition submodule 1002b and an independent representation acquisition submodule 1002c.
[0287] The input data denoising submodule 1002a is used to denoise the input data to obtain denoised input data, wherein noise data is filtered out of the denoised input data.
[0288] The embedding vector acquisition submodule 1002b is used to acquire the embedding vectors corresponding to the n data segments respectively according to the denoised input data.
[0289] The independent representation acquisition submodule 1002c is used to obtain the independent feature representations corresponding to the n data fragments respectively according to the embedding vectors corresponding to the n data fragments respectively.
[0290] In some embodiments, the data segment includes sampled data corresponding to a plurality of consecutive sampling points; the embedded vector acquisition submodule 1002b is used to:
[0291] According to the denoised input data, the target sampling points corresponding to the n data segments are obtained, wherein the target sampling point refers to the sampling point with the largest sampling data among the multiple sampling points corresponding to the data segments;
[0292] For each of the data segments, taking the target sampling point corresponding to the data segment as a reference point, acquiring a first number of sampling points forward and a second number of sampling points backward, to obtain a sampling point sequence corresponding to the data segment;
[0293] According to the sampling data corresponding to each sampling point in the sampling point sequence corresponding to the data segment, an embedding vector corresponding to the data segment is obtained.
[0294] In some embodiments, the embedding vector acquisition submodule 1002b is further used to:
[0295] Dividing the sampling data corresponding to the sampling point sequence to obtain a plurality of sub-data segments, wherein the sub-data segments include sampling data corresponding to a third number of sampling points;
[0296] For each of the sub-data segments, acquiring an embedding vector corresponding to the sub-data segment according to the sampled data corresponding to the sub-data segment;
[0297] According to the embedding vectors respectively corresponding to the multiple sub-data segments, the embedding vector corresponding to the data segment is obtained.
[0298] In some embodiments, the independent representation acquisition submodule 1002c is used to:
[0299] For each of the data segments, obtaining weight parameters corresponding to each of the sub-data segments in the data segment;
[0300] According to the weight parameters corresponding to the sub-data segments in the data segment, respectively, the embedding vectors corresponding to the sub-data segments in the data segment are fused to obtain a first fused vector;
[0301] For each sub-data segment in the data segment, obtaining a Hadamard product between the sub-data segment and each target sub-data segment corresponding to the sub-data segment; wherein the target sub-data segment refers to a sub-data segment after the sub-data segment in the data segment;
[0302] fusing the Hadamard products between the sub-data segment and each target sub-data segment corresponding to the sub-data segment to obtain a second fused vector corresponding to the sub-data segment;
[0303] fusing the second fusion vectors corresponding to the sub-data segments in the data segment to obtain a third fusion vector;
[0304] The first fused vector and the third fused vector are fused to obtain an independent feature representation corresponding to the data segment.
[0305] In some embodiments, the input data denoising submodule 1002a is used to:
[0306] Obtaining a filter window corresponding to the input data, where the number of sampling points corresponding to the filter window is an odd number;
[0307] For a first sampling point in the input data, taking the first sampling point as the center, acquiring sampling data corresponding to the odd number of sampling points from the input data, and generating data to be denoised corresponding to the first sampling point;
[0308] Determine the median sampled data in the to-be-denoised data corresponding to the first sampling point as the denoised data corresponding to the first sampling point;
[0309] The denoised input data is obtained according to the denoised data corresponding to each sampling point in the input data.
[0310] In some embodiments, the continuous representation acquisition module 1003 is used to:
[0311] Obtaining weight parameters corresponding to the first m data segments respectively according to the independent feature representations corresponding to the first m data segments respectively;
[0312] Performing dimension conversion on the independent feature representations corresponding to the first m data segments respectively, to obtain converted feature representations corresponding to the first m data segments respectively;
[0313] According to the weight parameters respectively corresponding to the first m data segments, the transformed feature representations respectively corresponding to the first m data segments are fused to obtain the continuous feature representation.
[0314] In some embodiments, the final representation acquisition module 1004 is used to concatenate the continuous feature representation and the independent feature representation corresponding to the n-th data segment to generate a final feature representation corresponding to the n-th data segment.
[0315] In some embodiments, the input data is obtained by intercepting the original data; Fig.11 As shown, the device 1000 further includes: an original data adjustment module 1006 , a data set acquisition module 1007 , a grid data acquisition module 1008 , an importance score acquisition module 1009 and an explanatory method determination module 1010 .
[0316] The original data adjustment module 1006 is used to remove the first m data segments in the original data from the original data to obtain adjusted original data.
[0317] The classification result acquisition module 1005 is further used to obtain classification results corresponding to each remaining data segment in the adjusted original data.
[0318] The data set acquisition module 1007 is used to divide the remaining data fragments according to the classification results corresponding to the remaining data fragments to obtain multiple data sets, each of which corresponds to one of the classification results.
[0319] The grid data acquisition module 1008 is used to extract one of the remaining data segments from the multiple data sets for multiple times and splice them to obtain multiple grid data.
[0320] The importance score acquisition module 1009 is used to obtain the importance scores of various interpretability methods under the constraints of each grid data, and the importance score is used to measure the positive attribution value of the first remaining data fragment in the grid data, and its proportion to the positive attribution value of the grid data.
[0321] The importance score acquisition module 1009 is further used to acquire a final importance score corresponding to the interpretability method according to the importance scores of the interpretability method under each of the grid data constraints.
[0322] The interpretability method determination module 1010 is used to determine the interpretability method suitable for the original data according to the final importance scores corresponding to the various interpretability methods.
[0323] In some embodiments, the importance score acquisition module 1009 is further used to:
[0324] For each remaining data segment in the grid data, obtain a positive attribution sum value between the remaining data segment and the interpretability method, wherein the positive attribution sum value refers to the sum of positive attribution values between each sampled data in the remaining data segment and the interpretability method under the constraint of the classification result corresponding to the remaining data segment;
[0325] Summing the positive attribution sums between each remaining data fragment in the grid data and the interpretability method to obtain a first sum value;
[0326] The forward attribution sum between the first remaining data segment and the interpretability method is divided by the first sum to obtain an importance score of the interpretability method under the grid data constraint.
[0327] To summarize, the technical solution provided by the embodiment of the present application determines the continuous feature representation corresponding to the input data based on the independent feature representations corresponding to the first m data fragments, and then obtains the final feature representation corresponding to the nth data fragment based on the continuous feature representation and the independent feature representation corresponding to the nth data fragment. The final feature representation corresponding to the nth data fragment can not only reflect the characteristics of the nth data fragment, but also reflect the influence of the first m data fragments on the nth data fragment, as well as the global characteristics of the nth data fragment in the input data, thereby improving the interpretability and accuracy of the final feature representation, and then improving the interpretability of the data fragment classification process and the accuracy of obtaining the classification results.
[0328] Please refer to Fig.12, which shows a block diagram of a data classification model training device provided by an embodiment of the present application. The device can be used to implement the above-mentioned data classification model training method. The device 1200 may include: a training data acquisition module 1201, an independent representation acquisition module 1202, a continuous representation acquisition module 1203, a final representation acquisition module 1204, a classification result acquisition module 1205 and a classification model training module 1206.
[0329] The training data acquisition module 1201 is used to acquire training data, wherein the training data includes n data segments that are periodically and continuously changing, each of the data segments is labeled with a true classification result, and n is an integer greater than 1.
[0330] The independent representation acquisition module 1202 is used to obtain independent feature representations corresponding to n data segments in the training data respectively through the data classification model, and the independent feature representations are used to characterize the data segments.
[0331] The continuous representation acquisition module 1203 is used to generate a continuous feature representation through the data classification model according to the independent feature representations corresponding to the first m data segments in the training data, wherein the continuous feature representation is used to characterize the training data, and m is a positive integer less than n.
[0332] The final representation acquisition module 1204 is used to generate a final feature representation corresponding to the nth data segment according to the continuous feature representation and the independent feature representation corresponding to the nth data segment.
[0333] The classification result acquisition module 1205 is used to classify the nth data segment according to the final feature representation corresponding to the nth data segment through the data classification model to obtain the predicted classification result corresponding to the nth data segment.
[0334] The classification model training module 1206 is used to train the data classification model according to the predicted classification result and the actual classification result corresponding to the nth data segment to obtain a trained data classification model, and the trained data classification model is used to classify the data segments in the input data.
[0335] In some embodiments, the classification model training module 1206 is used to:
[0336] Obtaining a training loss of the data classification model according to a difference between a predicted classification result and a true classification result corresponding to the nth data segment;
[0337] With the goal of minimizing the training loss, the parameters of the data classification model are adjusted to obtain the trained data classification model.
[0338] In some embodiments, the data classification model includes a first feature extraction network; Fig.13 As shown, the independent representation acquisition module 1202 includes: an input data denoising submodule 1202a, an embedding vector acquisition submodule 1202b and an independent representation acquisition submodule 1202c.
[0339] The input data denoising submodule 1202a is used to denoise the training data to obtain denoised training data, wherein noise data is filtered out of the denoised training data.
[0340] The embedding vector acquisition submodule 1202b is used to acquire the embedding vectors corresponding to the n data segments respectively according to the denoised training data.
[0341] The independent representation acquisition submodule 1202c is used to obtain the independent feature representations corresponding to the n data fragments respectively according to the embedding vectors corresponding to the n data fragments respectively through the first feature extraction network.
[0342] In some embodiments, the data segment includes sampled data corresponding to a plurality of consecutive sampling points; the embedded vector acquisition submodule 1202b is used to:
[0343] According to the denoised training data, the target sampling points corresponding to the n data segments are obtained, wherein the target sampling point refers to the sampling point with the largest sampling data among the multiple sampling points corresponding to the data segments;
[0344] For each of the data segments, taking the target sampling point corresponding to the data segment as a reference point, acquiring a first number of sampling points forward and a second number of sampling points backward, to obtain a sampling point sequence corresponding to the data segment;
[0345] According to the sampling data corresponding to each sampling point in the sampling point sequence corresponding to the data segment, an embedding vector corresponding to the data segment is obtained.
[0346] In some embodiments, the embedding vector acquisition submodule 1202b is further used to:
[0347] Dividing the sampling data corresponding to the sampling point sequence to obtain a plurality of sub-data segments, wherein the sub-data segments include sampling data corresponding to a third number of sampling points;
[0348] For each of the sub-data segments, acquiring an embedding vector corresponding to the sub-data segment according to the sampled data corresponding to the sub-data segment;
[0349] According to the embedding vectors respectively corresponding to the multiple sub-data segments, the embedding vector corresponding to the data segment is obtained.
[0350] In some embodiments, the independent representation acquisition submodule 1202c is used to:
[0351] For each of the data segments, obtaining weight parameters corresponding to each of the sub-data segments in the data segment;
[0352] fusing, by the first feature extraction network, the embedding vectors corresponding to the sub-data segments in the data segment according to the weight parameters corresponding to the sub-data segments in the data segment, to obtain a first fused vector;
[0353] For each sub-data segment in the data segment, obtaining, through the first feature extraction network, a Hadamard product between the sub-data segment and each target sub-data segment corresponding to the sub-data segment; wherein the target sub-data segment refers to a sub-data segment after the sub-data segment in the data segment;
[0354] fusing the Hadamard products between the sub-data segment and each target sub-data segment corresponding to the sub-data segment through the first feature extraction network to obtain a second fused vector corresponding to the sub-data segment;
[0355] fusing the second fusion vectors corresponding to the sub-data segments in the data segment through the first feature extraction network to obtain a third fusion vector;
[0356] The first fusion vector and the third fusion vector are fused through the first feature extraction network to obtain an independent feature representation corresponding to the data segment.
[0357] In some embodiments, the input data denoising submodule 1202a is used to:
[0358] Obtaining a filter window corresponding to the training data, wherein the number of sampling points corresponding to the filter window is an odd number;
[0359] For a first sampling point in the training data, taking the first sampling point as the center, acquiring sampling data corresponding to the odd number of sampling points from the training data, and generating data to be denoised corresponding to the first sampling point;
[0360] Determine the median sampled data in the to-be-denoised data corresponding to the first sampling point as the denoised data corresponding to the first sampling point;
[0361] The denoised training data is obtained according to the denoised data corresponding to each sampling point in the training data.
[0362] In some embodiments, the data classification model includes a second feature extraction network; the continuous representation acquisition module 1203 is used to:
[0363] Obtaining weight parameters corresponding to the first m data segments respectively according to the independent feature representations corresponding to the first m data segments respectively;
[0364] Performing dimension conversion on the independent feature representations corresponding to the first m data segments respectively, to obtain converted feature representations corresponding to the first m data segments respectively;
[0365] The second feature extraction network fuses the transformed feature representations corresponding to the first m data segments according to the weight parameters corresponding to the first m data segments, so as to obtain the continuous feature representation.
[0366] In some embodiments, the final representation acquisition module 1204 is used to concatenate the continuous feature representation and the independent feature representation corresponding to the n-th data segment to generate a final feature representation corresponding to the n-th data segment.
[0367] To summarize, the technical solution provided by the embodiment of the present application determines the continuous feature representation corresponding to the input data based on the independent feature representations corresponding to the first m data fragments, and then obtains the final feature representation corresponding to the nth data fragment based on the continuous feature representation and the independent feature representation corresponding to the nth data fragment. The final feature representation corresponding to the nth data fragment can not only reflect the characteristics of the nth data fragment, but also reflect the influence of the first m data fragments on the nth data fragment, as well as the global characteristics of the nth data fragment in the input data, thereby improving the interpretability and accuracy of the final feature representation, and then improving the interpretability of the data fragment classification process and the accuracy of obtaining the classification results.
[0368] It should be noted that the device provided in the above embodiment, when implementing its functions, is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.
[0369] Please refer to Fig.14 , which shows a schematic diagram of the structure of a computer device provided by an embodiment of the present application. The computer device can be any electronic device with data calculation, processing and storage functions, and the computer device can be implemented as Figure 1The model training device 10 and the model using device 20 in the implementation environment of the solution shown. Specifically:
[0370] The computer device 1400 includes a central processing unit (such as a CPU (Central Processing Unit), a GPU (Graphics Processing Unit) and an FPGA (Field Programmable Gate Array)) 1401, a system memory 1404 including a RAM (Random-Access Memory) 1402 and a ROM (Read-Only Memory) 1403, and a system bus 1405 connecting the system memory 1404 and the central processing unit 1401. The computer device 1400 also includes a basic input / output system (Input Output System, I / O system) 1406 for helping various devices in the server to transmit information, and a large-capacity storage device 1407 for storing an operating system 1413, application programs 1414 and other program modules 1415.
[0371] In some embodiments, the basic input / output system 1406 includes a display 1408 for displaying information and an input device 1409 such as a mouse and a keyboard for user inputting information. The display 1408 and the input device 1409 are connected to the central processing unit 1401 through an input / output controller 1410 connected to the system bus 1405. The basic input / output system 1406 may also include an input / output controller 1410 for receiving and processing inputs from a plurality of other devices such as a keyboard, a mouse, or an electronic stylus. Similarly, the input / output controller 1410 also provides output to a display screen, a printer, or other types of output devices.
[0372] The mass storage device 1407 is connected to the central processing unit 1401 via a mass storage controller (not shown) connected to the system bus 1405. The mass storage device 1407 and its associated computer readable medium provide non-volatile storage for the computer device 1400. That is, the mass storage device 1407 may include a computer readable medium (not shown) such as a hard disk or a CD-ROM (Compact Disc Read-Only Memory) drive.
[0373] Without loss of generality, the computer-readable medium may include computer storage media and communication media. Computer storage media include volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer-readable instructions, data structures, program modules or other data. Computer storage media include RAM, ROM, EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electrically Erasable Programmable Read-Only Memory), flash memory or other solid-state storage technology, CD-ROM, DVD (Digital Video Disc) or other optical storage, cassettes, tapes, disk storage or other magnetic storage devices. Of course, those skilled in the art will know that the computer storage medium is not limited to the above. The above-mentioned system memory 1404 and mass storage device 1407 can be collectively referred to as memory.
[0374] According to the embodiment of the present application, the computer device 1400 can also be connected to a remote computer on the network through a network such as the Internet. That is, the computer device 1400 can be connected to the network 1412 through the network interface unit 1411 connected to the system bus 1405, or the network interface unit 1411 can be used to connect to other types of networks or remote computer systems (not shown).
[0375] The memory also includes a computer program, which is stored in the memory and configured to be executed by one or more processors to implement the above-mentioned data classification method, or the above-mentioned data classification model training method.
[0376] In some embodiments, a computer-readable storage medium is also provided, in which a computer program is stored. When the computer program is executed by a processor, it implements the above-mentioned data classification method, or implements the above-mentioned data classification model training method.
[0377] Optionally, the computer readable storage medium may include: ROM (Read-Only Memory), RAM (Random-Access Memory), SSD (Solid State Drives) or optical disks, etc. Among them, the random access memory may include ReRAM (Resistance Random Access Memory) and DRAM (Dynamic Random Access Memory).
[0378] In some embodiments, a computer program product is further provided, the computer program product comprising a computer program, the computer program being stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the above-mentioned data classification method, or executes the above-mentioned data classification model training method.
[0379] It should be noted that, before collecting the relevant data of the user and during the process of collecting the relevant data of the user, the embodiment of the present application can display a prompt interface, a pop-up window or output a voice prompt information, and the prompt interface, pop-up window or voice prompt information is used to prompt the user that the relevant data is currently being collected, so that the present application only starts to execute the relevant steps of obtaining the relevant data of the user after obtaining the confirmation operation issued by the user to the prompt interface or pop-up window, otherwise (that is, when the confirmation operation issued by the user to the prompt interface or pop-up window is not obtained), the relevant steps of obtaining the relevant data of the user are terminated, that is, the relevant data of the user is not obtained. In other words, all user data collected by this application are processed strictly in accordance with the requirements of the laws and regulations of the relevant countries, and the informed consent or separate consent of the subject of personal information is obtained with the consent and authorization of the user. The subsequent data use and processing behavior is carried out within the scope of authorization of the laws and regulations and the subject of personal information, and the collection, use and processing of relevant user data need to comply with the relevant laws, regulations and standards of the relevant countries and regions. For example, the input data, training data, real classification results, etc. involved in this application are all obtained with full authorization.
[0380] It should be understood that the "multiple" mentioned in this article refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. In addition, the step numbers described in this article only illustrate a possible execution sequence between the steps. In some other embodiments, the above steps may not be executed in the order of the numbers, such as two steps with different numbers are executed at the same time, or two steps with different numbers are executed in the opposite order to the diagram. The embodiments of the present application are not limited to this.
[0381] The above description is only an exemplary embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A data classification method, characterized in that: The method comprises: Acquire input data, wherein the input data includes n data segments that are periodically and continuously changed, where n is an integer greater than 1; Obtaining independent feature representations corresponding to n data segments in the input data, respectively, wherein the independent feature representations are used to characterize the data segments; Generate a continuous feature representation according to the independent feature representations corresponding to the first m data fragments in the input data, where the continuous feature representation is used to characterize the input data, and m is a positive integer less than n; Generating a final feature representation corresponding to the nth data segment according to the continuous feature representation and the independent feature representation corresponding to the nth data segment; The nth data segment is classified according to the final feature representation corresponding to the nth data segment to obtain a classification result corresponding to the nth data segment.
2. The method according to claim 1, characterized in that The obtaining of independent feature representations corresponding to the n data segments in the input data includes: Denoising the input data to obtain denoised input data, wherein noise data is filtered out of the denoised input data; According to the denoised input data, acquiring embedding vectors corresponding to the n data segments respectively; According to the embedding vectors respectively corresponding to the n data fragments, independent feature representations respectively corresponding to the n data fragments are obtained.
3. The method according to claim 2, characterized in that The data segment includes sampling data corresponding to a plurality of continuous sampling points respectively; The acquiring, according to the denoised input data, the embedding vectors respectively corresponding to the n data segments comprises: According to the denoised input data, the target sampling points corresponding to the n data segments are obtained, wherein the target sampling point refers to a sampling point with the largest sampling data among the multiple sampling points corresponding to the data segments; For each of the data segments, taking the target sampling point corresponding to the data segment as a reference point, acquiring a first number of sampling points forward and a second number of sampling points backward, to obtain a sampling point sequence corresponding to the data segment; According to the sampling data corresponding to each sampling point in the sampling point sequence corresponding to the data segment, an embedding vector corresponding to the data segment is obtained.
4. The method according to claim 3, characterized in that The acquiring, according to the sampling data corresponding to each sampling point in the sampling point sequence corresponding to the data segment, the embedding vector corresponding to the data segment comprises: Dividing the sampling data corresponding to the sampling point sequence to obtain a plurality of sub-data segments, wherein the sub-data segments include sampling data corresponding to a third number of sampling points; For each of the sub-data segments, acquiring an embedding vector corresponding to the sub-data segment according to the sampled data corresponding to the sub-data segment; According to the embedding vectors respectively corresponding to the multiple sub-data segments, the embedding vector corresponding to the data segment is obtained.
5. The method according to claim 4, characterized in that The obtaining, according to the embedding vectors respectively corresponding to the n data segments, the independent feature representations respectively corresponding to the n data segments, comprises: For each of the data segments, obtaining weight parameters corresponding to each of the sub-data segments in the data segment; According to the weight parameters corresponding to the sub-data segments in the data segment, respectively, the embedding vectors corresponding to the sub-data segments in the data segment are fused to obtain a first fused vector; For each sub-data segment in the data segment, obtaining a Hadamard product between the sub-data segment and each target sub-data segment corresponding to the sub-data segment; wherein the target sub-data segment refers to a sub-data segment after the sub-data segment in the data segment; fusing the Hadamard products between the sub-data segment and each target sub-data segment corresponding to the sub-data segment to obtain a second fused vector corresponding to the sub-data segment; fusing the second fusion vectors corresponding to the sub-data segments in the data segment to obtain a third fusion vector; The first fused vector and the third fused vector are fused to obtain an independent feature representation corresponding to the data segment.
6. The method according to claim 2, characterized in that The step of denoising the input data to obtain denoised input data includes: Obtaining a filter window corresponding to the input data, where the number of sampling points corresponding to the filter window is an odd number; For a first sampling point in the input data, taking the first sampling point as the center, acquiring sampling data corresponding to the odd number of sampling points from the input data, and generating data to be denoised corresponding to the first sampling point; Determine the median sampled data in the to-be-denoised data corresponding to the first sampling point as the denoised data corresponding to the first sampling point; The denoised input data is obtained according to the denoised data corresponding to each sampling point in the input data.
7. The method according to claim 1, characterized in that The step of generating a continuous feature representation according to the independent feature representations respectively corresponding to the first m data segments in the input data includes: Obtaining weight parameters corresponding to the first m data segments respectively according to the independent feature representations corresponding to the first m data segments respectively; Performing dimension conversion on the independent feature representations corresponding to the first m data segments respectively, to obtain converted feature representations corresponding to the first m data segments respectively; According to the weight parameters respectively corresponding to the first m data segments, the transformed feature representations respectively corresponding to the first m data segments are fused to obtain the continuous feature representation.
8. The method according to claim 1, characterized in that The generating a final feature representation corresponding to the nth data segment according to the continuous feature representation and the independent feature representation corresponding to the nth data segment includes: The continuous feature representation and the independent feature representation corresponding to the n-th data segment are concatenated to generate a final feature representation corresponding to the n-th data segment.
9. The method according to claim 1, characterized in that: The input data is obtained by intercepting the original data; the method further comprises: Remove the first m data segments in the original data from the original data to obtain adjusted original data; Obtaining classification results corresponding to each remaining data segment in the adjusted original data; According to the classification results respectively corresponding to the respective remaining data fragments, the respective remaining data fragments are divided to obtain a plurality of data sets, each of the data sets corresponding to one of the classification results; Extracting one of the remaining data segments from the multiple data sets for multiple times respectively, and splicing them to obtain multiple grid data; For various interpretability methods, obtaining the importance scores of the interpretability methods under the constraints of each of the grid data, wherein the importance scores are used to measure the proportion of the positive attribution value of the first remaining data fragment in the grid data to the positive attribution value of the grid data; According to the importance scores of the interpretability method under each of the grid data constraints, a final importance score corresponding to the interpretability method is obtained; According to the final importance scores corresponding to the various interpretability methods, an interpretability method suitable for the original data is determined.
10. The method according to claim 9, characterized in that The obtaining of the importance scores of the interpretability methods under the constraints of each of the grid data comprises: For each remaining data segment in the grid data, obtain a positive attribution sum value between the remaining data segment and the interpretability method, wherein the positive attribution sum value refers to the sum of positive attribution values between each sampled data in the remaining data segment and the interpretability method under the constraint of the classification result corresponding to the remaining data segment; Summing the positive attribution sum values between each remaining data fragment in the grid data and the interpretability method to obtain a first sum value; The forward attribution sum between the first remaining data segment and the interpretability method is divided by the first sum to obtain an importance score of the interpretability method under the grid data constraint.
11. A method for training a data classification model, characterized in that: The method comprises: Acquire training data, wherein the training data includes n data segments that are periodically and continuously changing, each of the data segments is labeled with a true classification result, and n is an integer greater than 1; Obtaining, by means of the data classification model, independent feature representations corresponding to the n data segments in the training data, respectively, wherein the independent feature representations are used to characterize the data segments; Generate a continuous feature representation through the data classification model according to the independent feature representations corresponding to the first m data segments in the training data, wherein the continuous feature representation is used to characterize the training data, and m is a positive integer less than n; Generating a final feature representation corresponding to the nth data segment according to the continuous feature representation and the independent feature representation corresponding to the nth data segment; Classifying the nth data segment according to the final feature representation corresponding to the nth data segment by the data classification model to obtain a predicted classification result corresponding to the nth data segment; The data classification model is trained according to the predicted classification result and the actual classification result corresponding to the nth data segment to obtain a trained data classification model, and the trained data classification model is used to classify the data segments in the input data.
12. A data classification device, characterized in that: The device comprises: An input data acquisition module, used to acquire input data, wherein the input data includes n data segments that change periodically and continuously, where n is an integer greater than 1; An independent representation acquisition module, used to acquire independent feature representations corresponding to n data segments in the input data, respectively, wherein the independent feature representations are used to characterize the data segments; A continuous representation acquisition module, used to generate a continuous feature representation according to the independent feature representations corresponding to the first m data fragments in the input data, wherein the continuous feature representation is used to characterize the input data, and m is a positive integer less than n; A final representation acquisition module, used to generate a final feature representation corresponding to the nth data segment according to the continuous feature representation and the independent feature representation corresponding to the nth data segment; A classification result acquisition module is used to classify the nth data segment according to the final feature representation corresponding to the nth data segment to obtain a classification result corresponding to the nth data segment.
13. A training device for a data classification model, characterized in that: The device comprises: A training data acquisition module, used to acquire training data, wherein the training data includes n data segments that are periodically and continuously changing, each of the data segments is labeled with a true classification result, and n is an integer greater than 1; An independent representation acquisition module, used to acquire independent feature representations corresponding to n data segments in the training data respectively through the data classification model, wherein the independent feature representations are used to characterize the data segments; A continuous representation acquisition module, used to generate a continuous feature representation according to the independent feature representations corresponding to the first m data segments in the training data through the data classification model, wherein the continuous feature representation is used to characterize the training data, and m is a positive integer less than n; A final representation acquisition module, used to generate a final feature representation corresponding to the nth data segment according to the continuous feature representation and the independent feature representation corresponding to the nth data segment; a classification result acquisition module, configured to classify the nth data segment according to the final feature representation corresponding to the nth data segment through the data classification model, and obtain a predicted classification result corresponding to the nth data segment; The classification model training module is used to train the data classification model according to the predicted classification result and the actual classification result corresponding to the nth data segment to obtain a trained data classification model, and the trained data classification model is used to classify the data segments in the input data.
14. A computer device, characterized in that: The computer device includes a processor and a memory, wherein a computer program is stored in the memory, and the computer program is loaded and executed by the processor to implement the data classification method according to any one of claims 1 to 10, or the training method of the data classification model according to claim 11.
15. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which is loaded and executed by a processor to implement the data classification method described in any one of claims 1 to 10, or the data classification model training method described in claim 11.
