Weighting method, data classification method, device and medium

TWI934289BActive Publication Date: 2026-08-01HON HAI PRECISION INDUSTRY CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Authority / Receiving Office
TW · TW
Patent Type
Patents
Current Assignee / Owner
HON HAI PRECISION INDUSTRY CO LTD
Filing Date
2024-09-24
Publication Date
2026-08-01

AI Technical Summary

Technical Problem

Neural networks struggle to capture features that significantly influence classification in data processing, leading to poor classification accuracy, particularly in electrocardiogram (ECG) signal data.

Method used

A weighting method that involves performing a linear transformation on data to obtain linear weighted values, normalizing these values, and using a fully connected layer to identify elements with greater impact on classification, followed by data compression, feature extraction, and weighted operations to enhance classification accuracy.

Benefits of technology

The method improves classification accuracy by focusing on elements with greater impact on classification, preserving temporal characteristics, and optimizing feature data, ensuring accurate data category classification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure TWG2TB001903630_001
    Figure TWG2TB001903630_001
  • Figure TWG2TB001903630_002
    Figure TWG2TB001903630_002
  • Figure TWG2TB001903630_003
    Figure TWG2TB001903630_003
Patent Text Reader

Abstract

This application provides a weighting method, a data classification method, an apparatus, and a medium. The weighting method includes: performing a preset operation on the data to obtain multiple linear weighted values; and normalizing each of the linear weighted values ​​to obtain a normalized weighted value; wherein the preset operation includes a linear transformation, and the data includes multiple elements. Using the above method, classification can focus more on elements in the data that have a greater impact on classification, and can avoid interference from different scales, thereby improving classification accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical Field]

[0001] This application relates to the field of data processing technology, and in particular to a weighting method, a data classification method, an apparatus and a medium. [Previous Technology]

[0002] In the process of data classification, the relevant technology often directly inputs the data into the neural network for classification. However, the neural network often has difficulty capturing the features that have a significant impact on the classification from the data, resulting in poor classification accuracy.

[0003] Taking the field of electrocardiogram (ECG) signal data processing as an example, if neural networks are used directly to classify ECG signal data, the neural networks have difficulty capturing features that have a significant impact on classification, resulting in poor classification accuracy of ECG signal data. [Summary of the Invention]

[0004] In view of the above, it is necessary to provide a weighting method, a data classification method, an apparatus and a medium that can solve the technical problem of poor data classification accuracy.

[0005] On one hand, embodiments of this application provide a weighting method, the weighting method comprising: performing a preset operation on data to obtain multiple linear weighted values, and normalizing each of the linear weighted values ​​to obtain a normalized weighted value, wherein the preset operation includes a linear transformation, and wherein the data includes multiple elements.

[0006] In some embodiments of this application, the data has multiple dimensions, including a first dimension, and each element in the data has a corresponding first index on the first dimension. The preset operation further includes: extracting multiple sequences from the data, wherein each sequence includes multiple elements in the data that have the same first index, performing a linear transformation on each sequence to obtain a linear weighted value corresponding to each first index.

[0007] In some embodiments of this application, the weighting method further includes: determining a normalized weighting value corresponding to each element based on a first index corresponding to each element in the data, and multiplying each element with the corresponding normalized weighting value to obtain multiplied data.

[0008] In some embodiments of this application, the plurality of dimensions further includes a second dimension, each element having a corresponding second index on the second dimension, and the weighting method further includes: adding the multiplied data having the same second index on the second dimension to obtain a plurality of weighted data.

[0009] In some embodiments of this application, the weighting method further includes: using a fully connected layer to perform a linear transformation on the data to obtain the plurality of linear weighted values.

[0010] In the weighting method provided in this application embodiment, by performing a linear transformation on the data, the correlation between different elements in the data can be obtained, and the elements in the data with greater and lesser influence on classification can be determined. Therefore, a corresponding linear weighting value can be assigned to each element based on its influence on the data classification. For example, a higher linear weighting value is assigned to elements with a greater influence on classification, and a lower linear weighting value is assigned to elements with a smaller influence on classification. Thus, elements with a greater influence on classification are more significant than those with a smaller influence, allowing the classification to focus more on elements with a greater influence on classification, thereby improving classification accuracy. Normalizing the linear weighting values ​​can unify the scale of the linear weighting values, thereby eliminating the influence of different scales on classification and further improving classification accuracy.

[0011] On the other hand, this application provides a data classification method, the data classification method comprising: acquiring time-series data, performing compression operation on the time-series data to obtain compressed data, the compressed data including multiple compressed data arranged in time, performing feature extraction operation on the compressed data to obtain target data features, using the weighting method to perform weighted operation on the target data features to obtain weighted data features, and performing classification operation on the weighted data features to obtain data categories.

[0012] In some embodiments of this application, the feature extraction operation is a circular convolution operation.

[0013] In the data classification method provided in this application embodiment, by performing compression operations on time-series data, the temporal characteristics of the time-series data can be preserved in the compressed data, ensuring the temporal sequence of the compressed data. Through feature extraction operations, effective target data features can be extracted from the compressed data. By performing weighted operations on the target data features, the correlation between different feature data in the target data features can be learned, thereby optimizing the target data features. For example, strengthening the feature data in the target data features that have a greater impact on classification, and weakening the feature data in the target data features that have a smaller impact on classification, to obtain weighted data features. Classifying the weighted data features can accurately capture the feature data in the weighted data features that have a greater impact on classification, thereby ensuring the accuracy of data category classification.

[0014] On the other hand, this application provides an electronic device, the electronic device comprising: a memory storing at least one instruction; and a processor executing the at least one instruction to implement the weighting method or the data classification method.

[0015] On the other hand, this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the weighting method or the data classification method.

Implementation Method

[0023] It should be noted that in this application, "at least one" means one or more, and "more than one" means two or more. "And / or" describes the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist simultaneously, or B exists alone, where A and B can be singular or plural. The terms "first," "second," "third," "fourth," etc. (if present) in the specification, scope of the invention application, and drawings of this application are used to distinguish similar objects, rather than to describe a specific order or sequence.

[0024] It should be noted that the definitions of rows and columns in an array or matrix in this application are as follows:

[0025] Row: Equivalent to the English word "row", the direction is horizontal;

[0026] Column: Equivalent to the English word "column", the direction is vertical.

[0027] In the embodiments of this application, the terms "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design solutions. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a specific manner. Unless otherwise specified, the following embodiments and features described herein can be combined with each other.

[0028] This application provides a weighting method that can assign a corresponding linear weighting value to each element in the data according to the magnitude of its influence on the data classification, so that the classification can focus more on the elements in the data that have a greater impact on the classification, avoid interference from different scales, and thus improve the classification accuracy.

[0029] Figure 1 shows a flowchart of a weighting method provided in an embodiment of this application. Depending on different needs, the order of the steps in this flowchart can be adjusted according to actual requirements, and some steps can be omitted. The weighting method is applied to electronic devices, such as the electronic device 10 shown in Figure 7.

[0030] S11, perform preset operations on the data to obtain multiple linear weighted values.

[0031] In some embodiments of this application, the data includes multiple elements, and this application does not limit the type of data. For example, the data may be time-series data such as electrocardiogram (ECG) signal data, industrial production data, and weather data, or data obtained after data compression and feature extraction operations on ECG signal data, industrial production data, and weather data. The data has multiple dimensions, including a first dimension and a second dimension. For example, the data may be in the form of a two-dimensional matrix or array. Each element in the data has a corresponding first index on the first dimension and a corresponding second index on the second dimension.

[0032] For example, if the data is in the form of a matrix, the first dimension can be a column, the second dimension can be a row, and the first index corresponding to each element in the first dimension can be a column number, such as column 1, column 2, column 3, etc. The second index corresponding to each element in the second dimension can be a row number, such as row 1, row 2, row 3, etc.

[0033] In some embodiments of this application, the preset operation may include a linear transformation. The electronic device performs a preset operation on the data to obtain multiple linear weighted values, including: extracting multiple sequences from the data, wherein each sequence includes multiple elements in the data that have the same first index, performing a linear transformation on each sequence to obtain a linear weighted value corresponding to each first index.

[0034] For example, if the data is in the form of a matrix, multiple elements with the same first index can be elements in the same column of the matrix. Performing a linear transformation on multiple elements with the same first index in the data can be a linear transformation on the elements in the same column. Performing a linear transformation on the elements of each column in the data can obtain the linear weighted value corresponding to that column. For example, performing a linear transformation on the elements of the second column in the data can obtain the linear weighted value corresponding to the second column.

[0035] For example, an electronic device can use a fully connected layer to perform a linear transformation on the data to obtain the plurality of linearly weighted values. The number of neurons at the input and output ends of the fully connected layer is different. For example, if the data is in matrix form, the number of neurons at the input end of the fully connected layer can be the same as the number of rows in the data, and the number of neurons at the output end of the fully connected layer can be one.

[0036] The method of obtaining the multiple linear weighted values ​​by performing linear transformation on the data through a fully connected layer can refer to the fully connected operation process in related technologies, and will not be repeated in this application.

[0037] In this embodiment, by performing a linear transformation on the data, the correlation between different elements in the data can be obtained, and the elements with a greater or lesser impact on classification can be identified. Therefore, a corresponding linear weighting value can be assigned to each element based on its influence on the data classification. For example, elements with a greater impact on classification can be assigned a higher linear weighting value, while elements with a lesser impact can be assigned a lower linear weighting value. Thus, elements with a greater impact on classification are more significant than those with a smaller impact, allowing the classification process to focus more on the elements with a greater impact on classification, thereby improving classification accuracy.

[0038] S12, normalize each of the linear weighted values ​​to obtain normalized weighted values.

[0039] In some embodiments of this application, the electronic device can normalize each of the linear weighted values ​​according to a normalization function to obtain a normalized weighted value. The normalization function can be softmax, etc.

[0040] The electronic device can determine the normalized weighted value corresponding to each element according to the first index corresponding to each element in the data, multiply each element with the corresponding normalized weighted value to obtain the multiplied data corresponding to each element, and add the multiplied data with the same second index in the second dimension to obtain multiple weighted data.

[0041] Since the normalized weighted value is obtained by normalizing the linear weighted value, each normalized weighted value has a corresponding first index in the first dimension. For example, continuing with the above embodiment, if the first dimension is a column, then each column has a corresponding normalized weighted value.

[0042] For example, the normalized weighted value corresponding to the first index of each element can be determined as the normalized weighted value corresponding to each element. For instance, for each element in the first column of the data, the normalized weighted value corresponding to the first column can be determined as the normalized weighted value corresponding to each element in the first column; for each element in the second column of the data, the normalized weighted value corresponding to the second column can be determined as the normalized weighted value corresponding to each element in the second column. The normalized weighted value corresponding to the second index of each element can be the normalized weighted value corresponding to the row in which the element is located. Multiplied data with the same second index in the second dimension can be multiplied data from the same row. Adding the multiplied data from each row can obtain the weighted data corresponding to that row. In this way, multiple weighted data can be obtained from the multiplied data of multiple rows.

[0043] In this embodiment, normalizing the linear weighted values ​​can unify the scale of the linear weighted values, thereby eliminating the influence of different scales on classification and further improving classification accuracy.

[0044] This application also provides a data classification method that can accurately capture the feature data that has a significant impact on classification among the weighted data features, thereby ensuring the accuracy of data category classification. Figure 2 shows a flowchart of a data classification method provided in an embodiment of this application. Depending on different needs, the order of each step in the flowchart can be adjusted according to actual requirements, and some steps can be omitted. The data classification method is applied to electronic devices, such as the electronic device 10 shown in Figure 7.

[0045] S21, Obtain time series data.

[0046] In some embodiments of this application, time-series data can be data that changes over time. This time-series data can include biomedical data, industrial production data, and weather data, etc., and this application does not limit the specific type of time-series data. For example, biomedical data can be electrocardiogram (ECG) data or electroencephalogram (EEG) data. Industrial production data can be data such as machine operating status and product output that change over time.

[0047] Taking electrocardiogram (ECG) signal data as an example, ECG signal data consists of a series of waveform signals that change over time; therefore, ECG signal data can be considered as time-series data. Figure 3 shows a schematic diagram of ECG signal data provided in an embodiment of this application. Electronic devices can acquire ECG signal data in various ways, and this application does not limit the method of acquiring ECG signal data.

[0048] For example, an electronic device can acquire electrocardiogram (ECG) signal data from an ECG monitoring device that is communicatively connected to the electronic device. The ECG monitoring device is a device for monitoring cardiac electrical activity, such as a wearable ECG wristband. The ECG monitoring device can collect ECG signal data from a living organism, which can be a human or an animal, according to a preset sampling frequency and a preset sampling duration. The sampling frequency and sampling duration can be customized, and this application does not limit them. For example, the sampling frequency can be 250Hz and the sampling duration can be 30s. By collecting data at a sampling frequency of 250Hz and a sampling duration of 30s, ECG signal data with a sequence length of 7500 = 250 * 30 can be obtained.

[0049] The above examples of methods for acquiring electrocardiogram signal data are merely examples of methods for acquiring time-series data. In practical applications, the methods for acquiring time-series data are not limited to these. For example, electronic devices can also acquire time-series data from a preset database.

[0050] S22, Perform compression operation on the time series data to obtain compressed data.

[0051] In some embodiments of this application, a data compression network in a data classification model can be used to compress time-series data. The data classification model can be trained using training data with category labels, and the training data can be time-series data such as electrocardiogram signal data.

[0052] Time-series data may include original data X sorted by time. Each compressed data Y may have a corresponding data set, and the data set corresponding to each compressed data Y may include multiple original data X sorted by time. The size of the data set corresponding to each compressed data may be controlled by a window value w. The data sets corresponding to two adjacent compressed data are interconnected. The size of the data set may be the number of original data included in the data set. In each data set, the first original data in the sorted order is the first data. The first data in interconnected data sets are separated by N original data, and the value of N may be controlled by an interval value d. The N original data separated by the first data in interconnected data sets may be the overlapping original data between the two interconnected data sets.

[0053] In some embodiments of this application, the data compression network may include multiple network modules, and the network parameters of each network module may include stride and kernel size. The window value may be determined by the kernel size of the multiple network modules, and the interval value d may be determined by the stride of the multiple network modules. For example, the window value w is proportional to the kernel size of the multiple network modules, and the interval value d is proportional to the stride of the multiple network modules.

[0054] For example, the method for determining the data set corresponding to each compressed data can refer to the following formula (1):

[0055] , t=1,2...T; (1)

[0056] As shown in Figure 4, this is a schematic diagram of time series data compression provided in an embodiment of this application. In Figure 4, time series data X with a sequence length of n includes X1 to Xn original data. By using a data compression network to compress the time series data (e.g., electrocardiogram signal data), compressed data Y with a sequence length of T can be obtained. Y includes Y1 to YT compressed data. The window value w=4 and the interval value d=2 are determined according to the network parameters of the data compression network. Through formula (1), it can be determined that the data set corresponding to Y1 includes the original data X1~X4, the data set corresponding to Y2 includes the original data X3~X6, the data set corresponding to Y3 includes the original data X5~X8, and so on, the data set corresponding to each compressed data can be determined.

[0057] In some embodiments of this application, the sequence length of the compressed data is T=n / c, where n represents the number of original data in the time series data and c represents the compression ratio.

[0058] The compression ratio c of the compressed data is inversely proportional to the interval d. The compression ratio c can be determined by the stride of each network module in the compressed data network. For example, if the data compression network contains three network modules, the stride of the first network module is S1, the stride of the third network module is S2, and the stride of the fourth network module is S3, then the relationship between the compression ratio c and the stride of the network module can be expressed as: .

[0059] In some embodiments of this application, in order to preserve the temporal characteristics in the compressed data, it is necessary to ensure that the compressed data has temporal characteristics. The temporal characteristics of the compressed data can be determined by the temporal degree, and the compressed data with a higher temporal degree has better temporal characteristics.

[0060] For example, the electronic device can calculate the difference between the window value and the interval value to obtain the intersection difference, calculate the quotient of the intersection difference and the window value to obtain the time sequence degree corresponding to the compressed data.

[0061] For example, the calculation method for the temporal degree of compressed data can refer to the following formula (2):

[0062] ;(2)

[0063] Where TS degree represents time degree, w represents window value, and d represents interval value.

[0064] In some embodiments of this application, the timing degree (TS degree) is greater than 0.7.

[0065] In some embodiments of this application, the data compression network may be a convolutional neural network, and the multiple network modules in the data compression network may include network modules such as convolutional layers, pooling layers, and residual network layers. For example, the convolutional layer may be a one-dimensional convolutional layer (conv1D), and the pooling layer may be a one-dimensional max pooling layer (MaxPool1D). The residual network layer includes multiple residual modules, each residual module including multiple convolutional layers with skip connections or residual connections. This application does not limit the number of multiple residual modules or the number of convolutional layers in each residual module. The above examples of the structure of the data compression network are merely examples and do not constitute a limitation on the data compression network.

[0066] In other embodiments, the data compression network may further include more or fewer network layers. For example, convolutional layers and pooling layers may be connected via cascaded batch normalization layers and activation function layers. Each convolutional layer in the residual module may be followed by a batch normalization layer, or a batch normalization layer and an activation function layer may be connected. For example, the activation function layer may be a rectified linear unit (ReLU).

[0067] Taking a data compression network including convolutional layers, pooling layers, and residual network layers as an example, an electronic device uses a data compression network to compress time-series data to obtain compressed data, including: using a convolutional layer to perform convolution processing on the time-series data to obtain a convolutional feature map; using a pooling layer to perform pooling processing on the convolutional feature map to obtain a pooling feature map; inputting the pooling feature map into a residual network layer to obtain a residual feature map output by each of the multiple residual modules; wherein, the residual feature map output by the earlier residual module is used as the feature map input to the later residual module; and the residual feature map output by the last residual module is determined as the compressed data.

[0068] Wherein, each residual module includes multiple convolutional layers. The feature map output by each convolutional layer is obtained by convolutional processing of the input feature map. The feature map output by the preceding convolutional layer is used as the feature map input to the subsequent convolutional layer. The residual feature map output by each residual module is obtained by feature fusion of the feature map input to the first convolutional layer and the feature map output by the last convolutional layer. This application does not limit the feature fusion method. For example, the feature fusion method for the feature map input to the first convolutional layer and the feature map output by the last convolutional layer can be to add the feature values ​​at corresponding positions between the feature map input to the first convolutional layer and the feature map output by the last convolutional layer.

[0069] In this embodiment of the application, the window value and the interval value can be controlled through the network parameters of the data compression network. The window value can control the size of the data set corresponding to each compressed data and the time-series data, and the interval value can control the amount of overlapping original data between related data sets. By controlling the size of the data set corresponding to each compressed data and the amount of overlapping original data between related data sets, the timeliness of the compressed data can be controlled, thereby ensuring the timeliness of the compressed data.

[0070] S23, Perform feature extraction operation on the compressed data to obtain the target data features.

[0071] In some embodiments of this application, the electronic device can use the feature extraction network in the data classification model to perform feature extraction operations on compressed data to obtain target data features.

[0072] The feature extraction network can be a convolutional network, and the feature extraction operation can be a convolution operation. For example, the feature extraction network can be LeNet-5, AlexNet, VGGNet, Inception, etc. Alternatively, the feature extraction network can also be a variant of a convolutional neural network, wherein the variant of the convolutional neural network can be a recurrent neural network (RNN) or a variant of a recurrent neural network, and the feature extraction operation can be a recurrent convolution operation. The variant of the recurrent neural network can be a Long Short-Term Memory (LSTM), a gated recurrent unit (GRU), or a bidirectional gated recurrent unit (BiGRU), etc. To more clearly illustrate the data classification method provided in the embodiments of this application, the following description will use a bidirectional gated recurrent unit module as an example.

[0073] The bidirectional gated recurrent unit module includes a forward-gated recurrent unit and a backward-gated recurrent unit. The forward-gated recurrent unit includes multiple first hidden neurons, and the backward-gated recurrent unit includes multiple second hidden neurons. The electronic device performs convolution operations on the compressed data in the compressed data according to the data classification model to obtain target data features. This includes: reversing the sorting of the compressed data to obtain reverse-order compressed data; inputting the compressed data into the forward-gated recurrent unit to obtain multiple first data features output by each first hidden neuron; inputting the reverse-order compressed data into the backward-gated recurrent unit to obtain multiple second data features output by each second hidden neuron; and concatenating the first and second data features to obtain the target data features. The target data features contain multiple feature data, where the target data features can be represented as a two-dimensional matrix, and feature data in the same column of the matrix corresponds to the same compressed data.

[0074] The method for generating the first data feature and the second data feature can refer to the method of calculating the hidden state through the gating mechanism in the bidirectional gating loop unit in the related art, and will not be described in detail in this application.

[0075] For example, following the above embodiments, if the compressed data is , then the reverse sorting to obtain the reverse-order compressed data can be . The multiple first data features output by each first hidden neuron for the multiple compressed data in the compressed data can be , and the multiple second data features output by each second hidden neuron for the compressed data in the reverse-order compressed data can be . Through concatenation, the target data feature Z can be obtained. If the number of first hidden neurons and second hidden neurons is H, the target data feature Z can be represented as a two-dimensional matrix , and the feature data in the i-th row and i-th column of the target data feature Z can be represented as , =1,2…2H, =1,2…T.

[0076] For example, the target data features can be represented by the matrix shown in the following formula (3):

[0077] Z= ;(3)

[0078] Where Z represents the target data feature.

[0079] In this embodiment, the bidirectional gated recurrent unit can capture forward dependencies in time-series data from compressed data and backward dependencies in time-series data from reverse-order compressed data. The bidirectional processing method enables the bidirectional gated recurrent unit to capture target data features in time-series data more comprehensively and effectively, thereby improving the accuracy of subsequent classification networks.

[0080] S24, perform weight calculation on the target data features to obtain a weight vector.

[0081] In some embodiments of this application, the electronic device can use the attention module in the data classification model to perform weight calculation on the target data features to obtain a weight vector.

[0082] The attention module may include a linear layer and / or a normalization function. For example, the linear layer may be a fully connected layer, and the normalization function may be a softmax function.

[0083] The method for obtaining a weight vector by performing weight calculations on the target data features using an attention module can be referred to the description of the method for generating linear weighted values ​​in step S11. For example, if the attention module includes a fully connected layer and a normalization function, the electronic device uses the attention module to perform weight calculations on the target data features to obtain a weight vector, which includes: performing a linear transformation on each column of feature data in the target data features using a fully connected layer to obtain the original score corresponding to each column of feature data; normalizing the original score corresponding to each column of feature data using a normalization function to obtain the weight corresponding to each column of feature data; and arranging the weights corresponding to each column of feature data in sequence to obtain a weight vector, wherein the weight vector is a one-dimensional array, and the weight vector includes weights that correspond one-to-one with each column of feature data in the target data features.

[0084] Example, following the above embodiments, if the target data feature is a matrix as shown in formula (3), as shown in Figure 5, it is a schematic diagram of weight calculation provided by an embodiment of this application. In Figure 5, the j-th column feature data is selected from the target data feature Z as shown in formula (3), and the selected j-th column feature data is input into the fully connected layer to obtain the original score corresponding to the j-th column feature data. Since =1,2…T, the original score corresponding to the 1st column feature data, the original score corresponding to the 2nd column feature data, and the original score corresponding to the Tth column feature data can be obtained. Inputting , … into the softmax layer, the weights corresponding to the 1st column feature data, the weights corresponding to the 2nd column feature data, and the weights corresponding to the Tth column feature data can be obtained. In order to facilitate the calculation with the target data feature in the following text, the weights can be arranged in order to obtain a weight vector W= of shape.

[0085] In some embodiments of this application, the fully connected layer may include neurons at the input end, hidden layers, and neurons at the output end. The number of neurons at the input end of the fully connected layer is different from the number of neurons at the output end. Figure 6 shows a schematic diagram of the neurons in a fully connected layer provided in an embodiment of this application. In Figure 6, the fully connected layer has 2H neurons at the input end and 1 neuron at the output end, thereby enabling the conversion of 2H feature data in each column of the target data features into a raw score f.

[0086] Considering that directly inputting the target data features into the classification network of the data classification model would make it difficult for the classification network to capture the feature data that has a greater impact on classification, in this embodiment, by using a fully connected layer to perform a linear transformation on each column of feature data in the target data features, the correlation between different feature data in the target data features can be learned. Therefore, it is possible to determine the feature data in the target data features that have a greater impact on classification and the feature data that have a lesser impact on classification, so that higher weights can be assigned to the feature data in the target data features that have a greater impact on classification in the weight vector, and lower weights can be assigned to the feature data in the target data features that have a lesser impact on classification.

[0087] S25, perform a weighted operation on the weight vector and the target data features to obtain the weighted data features.

[0088] In some embodiments of this application, the electronic device uses a weighting module to multiply the target data features and the weight vector to obtain weighted data features.

[0089] The method for performing weighted operations on the weight vector and the target data feature can be found in the description of the method for generating multiplied data and weighted data in step S12. For example, the electronic device can multiply the target data feature Z of shape 2H×T with the weight vector W of shape T×1 to obtain a vector Q of shape 2H×1. By transposing the vector Q, the weighted data feature K can be obtained.

[0090] For example, the calculation method for vector Q can refer to the following formula (4), and the calculation method for weighted data feature K can refer to the following formula (5):

[0091] ;(4)

[0092] ;(5)

[0093] In this embodiment, since the feature data that has a greater impact on classification in the target data features has a higher weight in the weight vector, and the feature data that has a smaller impact on classification has a lower weight in the weight vector, the target data features can be optimized by multiplying the target data features and the weight vector. For example, the feature data that has a greater impact on classification in the target data features can be strengthened, and the feature data that has a smaller impact on classification in the target data features can be weakened, thereby obtaining weighted data features.

[0094] S26, Classify the weighted data features to obtain data categories.

[0095] In some embodiments of this application, the electronic device can use a classification network to classify weighted data features to obtain data categories. The classification network may include linear layers and a normalization function. For example, the linear layer in the classification network may be a fully connected layer, and the normalization function may be a softmax function. For instance, if the time-series data is electrocardiogram (ECG) signal data, the data category may be a cardiac rhythm state category such as normal sinus rhythm, atrial fibrillation, and early ventricular contractions; if the time-series data is electroencephalogram (EEG) data, the data category may be a state category such as awake, deep sleep, and light sleep; if the time-series data is weather data, the data category may be a weather state category such as sunny, cloudy, and rainy.

[0096] The electronic device uses a classification network to classify weighted data features to obtain data categories, including: using a classification network to map weighted data features to multiple preset categories, obtaining the confidence level of time series data corresponding to each preset category, and determining the data category from multiple preset categories based on the confidence level.

[0097] The multiple preset categories can be customized based on the time-series data, and this application does not impose any restrictions on this. For example, if the time-series data is electrocardiogram signal data, the multiple preset categories may include: normal sinus rhythm, atrial fibrillation, and premature ventricular contractions, etc.; if the time-series data is weather data, the multiple preset categories may include: sunny, cloudy, rainy, etc. The data category can be the preset category corresponding to the highest confidence level. The calculation method for the time-series data corresponding to each preset category can be referred to the description of the calculation method for the weight vector in step S24, and will not be repeated in this application.

[0098] In this embodiment, since the weighted data features are obtained by strengthening the feature data that has a greater impact on classification in the target data features and weakening the feature data that has a smaller impact on classification in the target data features, the feature data that has a greater impact on classification is more significant in the weighted data features compared to the feature data that has a smaller impact on classification. Therefore, the classification network can accurately capture the feature data that has a greater impact on classification in the weighted data features, thereby ensuring the accuracy of the classification of data categories.

[0099] In other embodiments of this application, the electronic device can use a classification network to classify target data features and obtain data categories. The method for classifying target data features using a classification network can be found in the description of the weight vector calculation method in step S24, and will not be repeated here.

[0100] As shown in Figure 7, this is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device 10 can be a computer, tablet computer, laptop computer, mobile phone, server, or other electronic devices. This application embodiment does not impose any restrictions on the specific type of electronic device.

[0101] In Figure 7, the electronic device 10 may include a communication module 101, a memory 102, a processor 103, an input / output (I / O) interface 104, and a bus 105. The processor 103 is coupled to the communication module 101, the memory 102, and the input / output interface 104 through the bus 105.

[0102] Communication module 101 may include a wired communication module and / or a wireless communication module. The wired communication module may provide one or more wired communication solutions such as Universal Serial Bus (USB) and Controller Area Network (CAN). The wireless communication module may provide one or more wireless communication solutions such as Wireless Fidelity (Wi-Fi), Bluetooth (BT), mobile communication networks, frequency modulation (FM), near field communication (NFC), and infrared (IR).

[0103] Memory 102 may include one or more random access memory (RAM) and one or more non-volatile memory (NVM). The RAM can be directly read and written by the processor 103, and can be used to store executable programs (e.g., machine instructions) of other running programs, as well as user and application data. The RAM may include static random-access memory (SRAM), dynamic random-access memory (DRAM), synchronous dynamic random-access memory (SDRAM), double data rate synchronous dynamic random-access memory (DDR SDRAM), etc.

[0104] Non-volatile memory can also store executable programs and user and application data, etc., and can be pre-loaded into random access memory for direct reading and writing by the processor 103. Non-volatile memory may include disk memory and flash memory. For example, flash memory can be NAND flash.

[0105] Memory 102 is used to store one or more computer programs. The one or more computer programs are configured to be executed by processor 103. The one or more computer programs include multiple instructions that, when executed by processor 103, can implement a weighting method or a data classification method that is executed on electronic device 10.

[0106] In other embodiments, the electronic device 10 shown in FIG7 further includes an external memory interface for connecting to an external memory to expand the storage capacity of the electronic device 10.

[0107] The processor 103 may include one or more processing units, such as: the processor 103 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video transcoder, a digital signal processor (DSP), and / or a neural network processing unit (NPU), etc. The different processing units may be independent devices or integrated into one or more processors.

[0108] The processor 103 provides computing and control capabilities. For example, the processor 103 is used to execute computer programs stored in the memory 102 to implement the weighting method or data classification method described above.

[0109] The input / output interface 104 is used to provide a channel for user input or output. For example, the input / output interface 104 can be used to connect various input / output devices, such as mice, keyboards, touch devices, and display screens, so that users can enter information or visualize information.

[0110] Bus 105 is used at least to provide a channel for communication between communication modules 101, memory 102, processor 103 and input / output interface 104 in electronic device 10.

[0111] It is understood that the structure illustrated in the embodiments of this application does not constitute a specific limitation on the electronic device 10. In other embodiments of this application, the electronic device 10 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0112] This application also provides a computer-readable storage medium storing a computer program. The computer program includes program instructions, and the method implemented when the program instructions are executed can refer to the methods in the above embodiments of this application.

[0113] The computer-readable storage medium may be the internal memory of the electronic device described in the above embodiments, such as the hard drive or memory of the electronic device. The computer-readable storage medium may also be an external storage device of the electronic device, such as a plug-in hard drive, smart media card (SMC), secure digital (SD) card, flash memory card, etc. equipped on the electronic device.

[0114] In some embodiments, the computer-readable storage medium may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function, etc.; and the data storage area may store data created based on the use of the electronic device, etc.

[0115] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For example, the division of the modules is merely a logical functional division, and there may be other division methods in actual implementation.

[0116] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0117] In addition, the functional modules in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware form or in the form of hardware plus software functional modules.

[0118] Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of this application is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be incorporated into this application. No appended diagram markings in the claims should be construed as limiting the scope of the claims involved.

[0119] Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices described in this application may also be implemented by a single unit or device through software or hardware. The terms "first," "second," etc., are used to indicate names and do not indicate any particular order.

[0120] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application and are not intended to limit it. Although this application has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of this application without departing from the spirit and scope of the technical solutions of this application. [Simplified Explanation of the Diagram]

[0016] Figure 1 is a flowchart of a weighting method provided in an embodiment of this application.

[0017] Figure 2 is a flowchart of a data classification method provided in an embodiment of this application.

[0018] Figure 3 is a schematic diagram of electrocardiogram signal data provided in an embodiment of this application.

[0019] Figure 4 is a schematic diagram of time series data compression provided in an embodiment of this application.

[0020] Figure 5 is a schematic diagram of weight calculation provided in an embodiment of this application.

[0021] Figure 6 is a schematic diagram of neurons in a fully connected layer provided in an embodiment of this application.

[0022] Figure 7 is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.

Claims

1. A weighted method, wherein, include: Perform preset operations on the data to obtain multiple linearly weighted values; The data has multiple dimensions, including a first dimension, where each element in the data has a corresponding first index. Each linear weighted value is normalized to obtain a normalized weighted value. The preset operation includes a linear transformation; a fully connected layer is used to perform a linear transformation on the data to obtain the multiple linear weighted values. The preset operation further includes extracting multiple sequences from the data, where each sequence includes multiple elements in the data with the same first index; a linear transformation is performed on each sequence to obtain a linear weighted value corresponding to each first index. The data is electrocardiogram (ECG) signal data or electroencephalogram (EEG) data. The data includes multiple elements, and each element is sorted by time.

2. The weighting method as described in claim 1, wherein, The weighting method further includes: determining a normalized weighted value corresponding to each element based on a first index corresponding to each element in the data, and multiplying each element with the corresponding normalized weighted value to obtain multiplied data.

3. The weighting method as described in claim 2, wherein, The multiple dimensions also include a second dimension, and each element has a corresponding second index in the second dimension. The weighting method further includes: adding the multiplied data that have the same second index in the second dimension to obtain multiple weighted data.

4. The weighting method as described in claim 1, wherein, The number of neurons at the input and output ends of the fully connected layer is not the same.

5. A data classification method, wherein, include: Acquire time series data; The time-series data is compressed to obtain compressed data, which includes multiple compressed data items arranged in time. The compressed data is subjected to feature extraction operations to obtain target data features; the target data features are weighted using the weighting method described in any one of claims 1 to 4 to obtain weighted data features; the weighted data features are then classified to obtain data categories.

6. The data classification method as described in request item 5, wherein, The feature extraction operation is a circular convolution operation.

7. An electronic device, wherein, It includes a processor and memory, the processor being configured to execute a computer program stored in the memory to implement the weighting method as described in any one of claims 1 to 4 or the data classification method as described in any one of claims 5 to 6.

8. A computer-readable storage medium, wherein, The computer-readable storage medium stores at least one instruction that, when executed by a processor, implements the weighting method as described in any one of claims 1 to 4 or the data classification method as described in any one of claims 5 to 6.