Data enhancement method and device

By enhancing data within and between categories in the index timing data, the problems of low data labeling efficiency and category imbalance are solved, and the training efficiency and prediction accuracy of the model are improved.

CN119474969APending Publication Date: 2025-02-18E SURFING VISION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411494539.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-24
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

In the prior art, the labeling efficiency of index timing data is low, which makes it difficult to collect training data and imbalance in data categories, making it difficult for the model to converge.

Method used

A data augmentation method is proposed to improve data diversity through data augmentation within and between categories. In-category data enhancement includes product transformation and addition and subtraction transformation, and inter-category data enhancement includes independent transformation, inter-category product transformation and combination transformation.

Benefits of technology

Through the data augmentation method, the diversity of training data is improved, the problem of data category imbalance is solved, the convergence speed of model training is accelerated, and the accuracy of model prediction is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119474969A_ABST
    Figure CN119474969A_ABST
Patent Text Reader

Abstract

The invention relates to a data enhancement method and device, and belongs to the field of operation and maintenance intellectualization. The method comprises the following steps: performing intra-category data enhancement on data of the same category; and performing inter-category data enhancement on different categories of data. The invention further provides a data enhancement device and a storage medium. According to the method, the problem of imbalance of index training data is solved, the diversity of the data is improved, the convergence speed of model training is accelerated, and the accuracy of model prediction is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of intelligent operation and maintenance, and in particular relates to a data enhancement method and device. Background Art

[0002] Operation and maintenance indicator data usually refers to the usage data of hardware such as CPU, memory, and disk, which changes over time and is a kind of time series data. Through the observation and analysis of operation and maintenance indicator data, it can be seen that indicator data has a certain periodicity, increases linearly, or changes steadily within a controllable range. With the rapid development of intelligent operation and maintenance, more and more artificial intelligence (AI) algorithms are used to solve operation and maintenance related problems, and the classification of various indicator time series data is one of the basic issues.

[0003] However, the labeling of indicator time series data requires manual inspection of the waveform of the indicator data and placing the corresponding files in a specified folder to complete the labeling. Inefficient labeling makes it more difficult to collect training data. In addition, the difficulty of obtaining different types of time series data varies, which leads to the problem of imbalanced training data categories. The small amount of training data and the imbalanced categories often make it difficult for the model to converge. Therefore, how to obtain diverse training data is a technical problem that needs to be solved in the field of indicator time series data classification. Summary of the invention

[0004] In view of the above deficiencies in the prior art, the object of the present invention is to provide a data enhancement method and device, which improves the diversity of training data acquisition and improves the quality of model training.

[0005] A first aspect of the present invention provides a data enhancement method, comprising:

[0006] For data of the same category, perform intra-category data enhancement;

[0007] For data of different categories, inter-category data enhancement is performed.

[0008] In the present invention, not only intra-category data enhancement is performed, but also inter-category data enhancement is performed, thereby realizing data diversity, accelerating the convergence speed of model training, and improving the accuracy of model prediction.

[0009] Furthermore, intra-category data enhancement includes:

[0010] Get data and label name, label name is one of the following: periodic, linear or stable;

[0011] Setting the probability p of product transformation and the probability q of addition and subtraction transformation, wherein p and q are both numbers greater than zero and less than 1, and q is greater than p;

[0012] Get the maximum value max and the minimum value min of data data;

[0013] Generate a first random number r1 between 0 and 1;

[0014] If r1 is less than p, perform intra-category product transformation;

[0015] If r1 is greater than or equal to p and less than or equal to q, perform intra-category addition and subtraction transformations;

[0016] If r1 is greater than q, both intra-category addition and subtraction transformations and intra-category multiplication transformations are performed simultaneously;

[0017] Returns the transformed data.

[0018] Furthermore, performing intra-category product transformation includes:

[0019] If the tag name is stable, a second random number a2 between 0 and 1 is generated;

[0020] If the tag name is a periodic type or a linear type, then: obtain the variation range amp of the data data, where amp=max-min, set the minimum value amp_min after the data transformation, and generate a second random number a2 between amp_min / amp and 1 / max;

[0021] Multiply each value in the data data by the second random number a2 to obtain new data.

[0022] Furthermore, performing intra-category addition and subtraction transformations includes:

[0023] Generate a third random number a3 between -min and 1-max;

[0024] Add a3 to each value in the data to obtain new data.

[0025] Furthermore, performing inter-category data enhancement includes one or a combination of the following:

[0026] Self-transformation, inter-class product transformation and combination transformation.

[0027] Furthermore, the inter-category product transformation includes:

[0028] Get data data and label name label;

[0029] If the label name label is stable, directly return the data data and the label name label, otherwise execute the following steps:

[0030] Set the maximum change range of stable data max_range;

[0031] Obtain the maximum value max and the minimum value min of the data data, and obtain the variation range amp=max-min of the data data;

[0032] Generate a seventh random number a7 between 0 and max_range / amp;

[0033] Multiply each value in the data data by a7 to obtain new data data_mult;

[0034] Set the label name label to stable type and return new data data_mult and label.

[0035] Furthermore, the combined transformation includes:

[0036] Randomly obtain a data data1 and its label name label from the linear data set or periodic data set;

[0037] Randomly obtain a data data from the stable data set data2;

[0038] If the data size len2 of data2 is larger than the data size len1 of data1, then data2 only takes the first len1 data, otherwise the data size in data2 and data1 is made the same;

[0039] Add the corresponding elements of data1 and data2 to get the new data data_new;

[0040] Returns new data data_new and its label label.

[0041] Furthermore, the self-transformation includes:

[0042] Get data data and label name, the label name is periodic type, linear type or stable type;

[0043] If the label name of the data is periodic, directly return the data data and the label name label, otherwise perform the following steps:

[0044] Set the data sampling interval days, where days is the duration of the data;

[0045] Calculate the total number of sample nums;

[0046] Randomly sampling the data at the interval days to obtain a sampling sequence samples;

[0047] If the label name label is a stable type, square wave synthesis is performed on the sampling sequence samples to obtain self-transformed data;

[0048] If the label name label is a linear type, synthesize the sampling sequence samples by sawtooth wave and triangle wave to obtain self-transformed data;

[0049] Returns the self-transformed data.

[0050] A second aspect of the present invention provides a device for implementing a data enhancement method, comprising:

[0051] The intra-category enhancement module is configured to perform intra-category data enhancement on the data of the same category;

[0052] The inter-category enhancement module is configured to perform inter-category data enhancement on data of different categories.

[0053] A third aspect of the present invention provides a device for implementing a data enhancement method, comprising: a memory, a processor, and a user interface;

[0054] Memory for storing computer programs;

[0055] User interface, used to interact with users;

[0056] The processor is used to read the computer program in the memory, and when the processor executes the computer program, the above-mentioned data enhancement method is implemented.

[0057] A fourth aspect of the present invention is a processor-readable storage medium, wherein the processor-readable storage medium stores a computer program, and the processor implements the above-mentioned data enhancement method when executing the computer program.

[0058] The beneficial effects of the present invention are as follows:

[0059] The method and device described in the present invention not only enhances data within a category, but also enhances data between categories. Data enhancement within a category does not change the label of the data, and uses the relevant mathematical properties of the function to enhance the original data; data enhancement between categories changes the original label of the data, and transforms data of one category into data of another category. Thus, the problem of imbalanced indicator training data is solved, the diversity of data is improved, the convergence speed of model training is accelerated, and the accuracy of model prediction is improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0060] The accompanying drawings are only used to illustrate specific embodiments and are not considered to limit the present invention. In the entire drawings, the same reference symbols represent the same components. Obviously, the drawings described below are only some embodiments recorded in the embodiments of the present invention. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings.

[0061] Figure 1 This is a flow chart of a data enhancement method according to an embodiment of the present invention;

[0062] Figure 2 This is another flow chart of a data enhancement method according to an embodiment of the present invention;

[0063] Figure 3 A schematic diagram of a data enhancement device according to an embodiment of the present invention;

[0064] Figure 4 Schematic diagram of another data enhancement device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0065] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, the technical solutions of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. It should be understood that these descriptions are only exemplary and are not intended to limit the scope of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in the field without making creative work should fall within the scope of protection of the present invention.

[0066] Furthermore, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessarily obscuring the concepts disclosed in the present invention.

[0067] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the orientation or position relationship indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inside", "outside", etc. is based on the orientation or position relationship shown in the drawings, which is only for the convenience of describing the present invention and simplifying the description, and does not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation of the present invention. In addition, the terms "first", "second", and "third" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. The terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be a connection between the two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0068] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Instead, they are merely examples of methods and systems consistent with some aspects of the present invention as detailed in the appended claims.

[0069] Operation and maintenance indicator data usually includes but is not limited to: data related to the usage of resources such as the server's central processing unit CPU, memory, disk space, network traffic, etc. Operation and maintenance indicator data changes over time and is a kind of time series data. Through the visual observation and analysis of indicator data, it can be seen that indicator data may have a certain periodicity, increase linearly, or change steadily within a controllable range. With the development of intelligent operation and maintenance, more and more artificial intelligence (AI) algorithms are used to solve problems related to operation and maintenance, and the classification of various types of indicator time series data is one of the basic problems. However, the labeling of indicator time series data is relatively complicated. It is necessary to manually view the waveform of the indicator data and put the corresponding files into the specified folder to complete the labeling. This inefficient labeling method makes it more difficult to collect training data. Moreover, the difficulty of obtaining different types of time series data is different. For example, linear indicator data is difficult to obtain, which leads to the problem of imbalanced training data categories. The small amount of training data and imbalanced categories often make it difficult for the model to converge. However, the data generated by functions such as sine functions and linear functions cannot obtain diverse data. Models trained using data generated by these functions are often prone to overfitting problems. Therefore, how to obtain diverse training data is a technical problem that needs to be solved urgently in the field of indicator time series data classification.

[0070] The present invention proposes a data enhancement method and device, which improves the diversity of data through intra-category and inter-category data enhancement, solves the problem of imbalanced training sample categories, improves the generalization ability of the model, accelerates the convergence speed of model training, and improves the accuracy of model prediction. The data enhancement method, device and storage medium of the present invention can be applied not only to the enhancement of operation and maintenance indicator data, but also to the enhancement of other data.

[0071] It should be noted that in the present invention, the relationship between categories and labels is as follows: category information includes three categories: periodic, linear and stable. Periodic is a category, stable is also a category, and linear is also a category. For example, according to the waveform graph of sequence data (in the present invention, sequence data is also referred to as data, and the two express the same meaning), if it is stable, it is judged as stable data, that is, the category label is stable. Intra-category data enhancement is data enhancement within the same category. For example, intra-category data enhancement only involves periodic data and does not involve other categories. Inter-category data enhancement is data enhancement of different categories, such as data enhancement between stable and periodic data. The label of the data is the category information of the data, that is, one of the following: periodic, linear or stable.

[0072] It should be noted that, in the present invention, data enhancement within a category does not change the label of the data, and mainly uses the relevant mathematical properties of the function to enhance the original data; data enhancement between categories changes the original label of the data, and transforms one category of data into another category of data, such as constructing rectangular periodic data from stable data, constructing sawtooth periodic functions from linear data, etc. Data enhancement within a category is conducive to improving the diversity of data within a category, and data enhancement between categories is conducive to better distinguishing data between categories.

[0073] Method Embodiment

[0074] In a first aspect, the present invention provides a data enhancement method, such as Figure 1 As shown, specifically, the method includes step S101 and step S102.

[0075] S101, for data of the same category, perform intra-category data enhancement;

[0076] S102: Perform inter-category data enhancement on data of different categories.

[0077] It should be noted that, for the convenience of description, it is assumed in the present invention that all data have been normalized and all data include category information and labels of the data.

[0078] As an optional example, if the data is not normalized, or does not include category information or labels, the data enhancement method of the present invention may further include, before S101 and S102: S100, if the data is not normalized, or does not include category information or labels, normalize the data and mark the category information and labels of the data.

[0079] It should be noted that, in the data enhancement method of the present invention, there is no specific order for executing step S101 and step S102, that is, S101 may be executed first to perform intra-category data enhancement, and then S102 may be executed to perform inter-category data enhancement, or S102 may be executed first to perform inter-category data enhancement, and then S101 may be executed to perform intra-category data enhancement, or S101 may be executed to perform intra-category data enhancement and S102 may be executed simultaneously to perform inter-category data enhancement.

[0080] It should be noted that intra-category data enhancement for the same category of data means that the category of the data does not change after the data enhancement process. For example, data A is periodic data, and after the enhancement process, data B is obtained, and data B is still periodic data.

[0081] As an optional example, for periodic data, it can be defined as:

[0082] y1=a*f(w*x)+b Formula (1);

[0083] Among them, y1 is periodic data, a1 is the amplitude of periodic data, b1 is a constant, w1 is the angular frequency, x1 is the input variable, and f() is a periodic function. For periodic data, the following transformations can be made:

[0084] Transformation 1: By changing b1, the periodic function can be moved up and down without changing its shape; that is, y plus or minus a constant can be moved up and down;

[0085] Transformation 2: The amplitude of the periodic function can be changed by changing a1; that is, the amplitude of the data can be changed by multiplying y1 by a constant;

[0086] Since it is difficult to obtain an expression like (1) in actual periodic data, we often only get y, so it is impossible to change the period by changing w1 or x1.

[0087] The above formula (1) can be used to perform intra-category transformation to obtain more periodic data.

[0088] As an alternative example, for linear data, it can be defined as:

[0089] y2=k*x2 + b2 Formula (2);

[0090] Among them, y2 is linear data, k is the slope, and b2 is a constant. For linear data, the following transformation can be performed:

[0091] Transformation 3: The slope of the linear data can be changed by changing k. Changing k can be achieved by multiplying y2 by a constant or by adding two linear data.

[0092] Transformation 4: The linear function is moved up and down by changing b2, that is, the original data y2 is added or subtracted to move the data up and down.

[0093] As an alternative example, stable data can be represented as:

[0094] y3=b3 formula (3);

[0095] From formula (3), we can see that the data can be moved up and down by adding or subtracting a constant, or it can be transformed into another stable data by multiplying a constant. Although stable data has volatility, the multiplied constant is controlled within the preset range, and the transformed data can be determined as stable data.

[0096] As an alternative example, according to the above formulas (1), (2) and (3), the slope or amplitude can be changed through product transformation, or the data within the category can be enhanced by moving up and down through addition and subtraction transformation.

[0097] In this embodiment, as an alternative example, in S101, performing data enhancement within the category includes:

[0098] Step A1: Obtain the data data and the label name, where the label name is one of the following: periodic, linear, or stable;

[0099] Step A2: Set the probability p of product transformation and the probability q of addition and subtraction transformation, where both p and q are numbers greater than zero and less than 1, and q is greater than p;

[0100] Step A3: Obtain the maximum value max and the minimum value min of the data data;

[0101] Step A4: Generate a first random number r1 between 0 and 1;

[0102] Step A5: If r1 is less than p, perform product transformation within the category;

[0103] Step A6: If r1 is greater than or equal to p and less than or equal to q, perform addition and subtraction transformation within the category;

[0104] Step A7: If r1 is greater than q, perform both addition and subtraction transformation within the category and product transformation within the category; in this step, first perform product transformation within the category, and then perform addition and subtraction transformation within the category. That is, first perform product transformation within the category on the data data, and then perform addition and subtraction transformation within the category on the data after product transformation to obtain new data. It is also possible to first perform addition and subtraction transformation within the category, and then perform product transformation within the category. That is, first perform addition and subtraction transformation within the category on the data data, and then perform product transformation within the category on the data after addition and subtraction transformation within the category to obtain new data.

[0105] Step A8: Return the transformed data.

[0106] In the method for data enhancement within the category of the present invention, the probability p of product transformation and the probability q of addition and subtraction transformation are determined in advance. The magnitudes of p and q are determined according to needs, and can also be randomly generated, but need to satisfy the condition that q is greater than p, and 0 < p < 1, 0 < q < 1. For example, p = 0.33, q = 0.66, or for example, p = 0.1, q = 0.8, or for example, p = 0.5, q = 0.55.

[0107] As an alternative example, in the above step A5, performing product transformation within the category includes:

[0108] A51: If the tag name is stable, generate a second random number a2 between 0 and 1;

[0109] A52: If the tag name is periodic or linear, obtain the variation range amp of the data data, where amp=max-min, set the minimum value amp_min after the data transformation, and generate a second random number a2 between amp_min / amp and 1 / max (also expressed as a second random number a2 between (amp_min / amp, 1 / max)); wherein max is the maximum value of the data to be enhanced data, and min is the minimum value of the data to be enhanced data.

[0110] A53: Multiply each value in the data data by the second random number a2 to obtain new data.

[0111] It should be noted that for any data, only one of the above steps A51 and A52 will be executed, that is, if it is stable data, A51 will be executed, and if it is periodic or linear data, A52 will be executed. Steps A51 and A52 both generate random numbers a2, but the ranges of random numbers a2 generated by A51 and A52 are different. In actual operations, the random numbers generated by A51 and A52 are stored in a2 for subsequent use.

[0112] It should be noted that in the above A52, amp_min / amp means amp_min divided by amp, which means Similarly, 1 / max means 1 divided by max, which means That is, in the present invention, the symbol / represents a division operation.

[0113] As an optional example, the intra-category addition and subtraction transformation in A6 includes:

[0114] A61: Generate a third random number a3 between -min and 1-max; in this step, -min represents negative min, and can also be expressed as 0-min.

[0115] A62: Add a3 to each value in data to get new data.

[0116] To further illustrate the intra-category data enhancement method, the following is an overall description combined with pseudocode:

[0117]

[0118] As an optional example, in S102 of the data enhancement method of the present invention, performing inter-category data enhancement on data of different categories includes one or more of the following transformations:

[0119] Self-transformation, inter-class product transformation and combination transformation.

[0120] Inter-category data enhancement is the mutual transformation of data between categories. In this scheme, inter-category data enhancement is divided into the following three transformations: self-transformation, product transformation, and combination transformation.

[0121] As an optional example, the self-transformation mentioned above refers to a method of transforming a given data sequence into another type of data sequence only through the data sequence. For example, stable data can be transformed into periodic square wave data through sampling and up and down movement, and linear data can also be transformed into periodic sawtooth waves, square waves, triangle waves, etc. only by relying on its own data.

[0122] As an optional example, the above self-transformation includes B1, B2 and B3:

[0123] B1. Get data and label name. The label name is one of the following: periodic, linear or stable;

[0124] B2. If the label name of the data is periodic, directly return the data data and the label name label, otherwise execute the following steps B21 to B25:

[0125] B21, set the data sampling interval days, where days is the duration of the data in days;

[0126] B22. Calculate the total number of sample nums;

[0127] B23, randomly sampling the data at the interval days to obtain a sampling sequence samples;

[0128] B24. If the label name label is a stable type, square wave synthesis is performed on the sampling sequence samples to obtain self-transformed data;

[0129] B25. If the label name label is a linear type, synthesize the sampling sequence samples by a sawtooth wave and a triangle wave to obtain self-transformed data;

[0130] B3. Return the data after self-transformation.

[0131] As an optional example, in the above B24, the sampling sequence samples is subjected to square wave synthesis to obtain self-transformed data including:

[0132] Get the maximum value max and the minimum value min of the sampling sequence samples;

[0133] Generate a fourth random number r4 between 0 and 1, and set the minimum amplitude amp of the rectangular wave;

[0134] If r4 is greater than or equal to 0.5, a fifth random number a5 between 0 and r4-amp is generated;

[0135] If the r4 is less than 0.5, a fifth random number a5 between r4+amp and 1 is generated;

[0136] Calculate the moving distance d = max-r4;

[0137] Subtract d from each value in the sampling sequence samples to obtain a new sequence, denoted as sample_up;

[0138] Calculate the moving distance ud=r4-a5;

[0139] Subtract ud from each value in the sample_up to obtain a new sequence, recorded as sample_down;

[0140] Set the rectangular wave data rectangle to an empty list;

[0141] Traverse all days starting from 0, record the current day as the i-th day, if the remainder of i divided by 2 is equal to 1, then add all the elements in the sample_up list to the rectangle list, if the remainder of i divided by 2 is equal to 0, then add all the elements in the sample_down list to the rectangle list;

[0142] Set the label name label to periodic type, and return the rectangular wave data rectangle;

[0143] Here, i is the number of the day.

[0144] It should be noted that square wave is rectangular wave, and the two have the same meaning.

[0145] It should be noted that the fourth random number r4 is either greater than or equal to 0.5 or less than 0.5. Both conditions cannot be satisfied at the same time. That is to say, it is impossible to simultaneously generate a fifth random number a5 between 0 and r4-amp and a fifth random number a5 between r4+amp and 1. Only one of the two conditions is possible.

[0146] It should be noted that if the remainder of i divided by 2 is equal to 0, it means that i is divisible by 2.

[0147] As an optional example, in the above B25, if the label name label is a linear type, the sampling sequence samples is synthesized by a sawtooth wave and a triangle wave, and the self-transformed data obtained includes:

[0148] B251, generate a sixth random number r6 between 0 and 1;

[0149] B252, record the newly generated periodic data circle as an empty list;

[0150] B253, if the r6 is greater than or equal to 0.5, perform sawtooth wave synthesis;

[0151] B254, if the r6 is less than 0.5, perform triangle wave synthesis;

[0152] B255. Set the label name label to periodic type and return the periodic data circle.

[0153] As an optional example, in B253, performing sawtooth wave synthesis includes:

[0154] Traverse all days starting from 0 and add all data of the sampling sequence samples to the periodic data circle.

[0155] As an optional example, in B254, performing triangle wave synthesis includes:

[0156] Traverse all days starting from 0, and record the current day as the i-th day;

[0157] If the remainder of i divided by 2 is 1, then add all the data of the sampling sequence samples to the periodic data circle;

[0158] If the remainder when i is divided by 2 is 0, the sample sequence samples is arranged in reverse order and added to the periodic data circle.

[0159] As an optional example, in the present invention, the inter-category product transformation refers to changing the category label of the sequence by means of product. For example, according to formula (1), when the value of a is small enough, the value of y is close to b, that is, it becomes formula (3). Therefore, when the periodic data y is multiplied by a sufficiently small constant, the periodic data will become stable data. Similarly, linear data multiplied by a sufficiently small data will also become stable data.

[0160] To explain the self-transformation more clearly, the following is a complete description with Python pseudocode, including the following S1 to S8:

[0161]

[0162]

[0163] The above python pseudo code realizes the self-transformation of the present invention.

[0164] As an optional example, the inter-category product transformation includes:

[0165] C1. Get data data and label name label;

[0166] C2. If the label name label is stable, directly return the data data and the label name label, otherwise execute the following steps:

[0167] C21, set the maximum change range of stable data max_range;

[0168] C22, obtain the maximum value max and the minimum value min of the data data, and obtain the variation range amp=max-min of the data data;

[0169] C23, generate a seventh random number a7 between 0 and max_range / amp; a7 is a random number between (0, max_range / amp), and it is sufficient to set the variation range max_range of the target stable data in step C21. For example, max_range = 0.1. Other random numbers can also be set, and the specific setting can be based on the actual situation.

[0170] C24, multiply each value in data by a7 to obtain new data data_mult;

[0171] C25. Set the label name label to stable type and return new data data_mult and label.

[0172] To better illustrate the inter-category product transformation, the following is the Python pseudocode for the inter-category product transformation:

[0173] S1. Get data data and label name label; if label is "stable", directly return data and label;

[0174] S2. Set the maximum change range of stable data max_range, which can be set according to actual needs. For example, max_range=0.1;

[0175] S3, obtain the maximum value max and the minimum value min of data, then the variation range of data amp = max-min;

[0176] S4, generate a random number a7 of (0, max_range / amp);

[0177] S5, multiply each value in data by a7 to obtain new data data_mult;

[0178] S6, let label = "stable";

[0179] S7. Return new data data_mult and label.

[0180] In the present invention, combination transformation refers to performing combination operations through multiple sequences to obtain new data and its categories. Specifically, according to formula (3), stable data can be regarded as a constant. Therefore, according to formula (1) and formula (2), it can be seen that the result of linear data plus stable data is linear data, and the result of periodic data plus stable data is periodic data.

[0181] As an optional example, the above combined transformation includes:

[0182] Randomly obtain a data data1 and its label name label from the linear data set or periodic data set;

[0183] Randomly obtain a data data2 from the stable data set;

[0184] If the data size len2 of data2 is larger than the data size len1 of data1, then data2 only takes the first len1 data, otherwise the data size in data2 and data1 is made the same;

[0185] Add the corresponding elements of data1 and data2 to get the new data data_new;

[0186] Returns new data data_new and its label label.

[0187] In the above steps, data2 only takes the first len1 data, which means extracting the first len1 data in the list data2. Len1 represents the amount of data in data1. For example, if len1 is 100, the first 100 data in data2 are extracted as data2, and the rest are discarded.

[0188] To make the amount of data in data2 the same as that in data1, the amount of data in the two lists is the same. When the amount of data in data2 is less than that in data1, the amount of data in data2 should be supplemented to make the amount of data in data2 the same as that in data1.

[0189] In order to better illustrate the combined transformation of the present invention, the following is a further explanation in conjunction with the Python pseudo code of the combined transformation:

[0190]

[0191] It should be noted that S3 in the above combined transformation Python pseudocode is used to make the amount of data in the two lists the same. When the amount of data in data2 is less than that in data1, the amount of data2 should be supplemented to make the amount of data in data2 the same as that in data1. Specifically:

[0192] 1. The amount of data to be added to data2 is: Len(data2)-len(data1), which is the amount of data to be extracted. Here, this amount of data is a negative number, and n is used to represent this amount of data. Then data2[n:] means extracting the last |n| data in data2 as a new list m, and |n| represents the absolute value of n; for example, if the list data2 is [1,2,3,4], then data2[-2:] means extracting the last two numbers in the list as a new list, that is, [3,4];

[0193] 2. m[::-1] means reversing the order of the elements in list m; for example, if the original m is [1,2,3], then m[::-1] is [3,2,1];

[0194] 3. Finally, add all the elements of the reversed list to the list data2 in sequence.

[0195] It should be noted that the above-mentioned inter-category product transformation can realize the steps of converting periodic data and linear data into stable data. In addition, it can also be combined with the up and down movement of intra-category data enhancement to achieve more data diversity. Intra-category product transformation, intra-category addition and subtraction transformation, inter-category self-transformation, inter-category product transformation, and inter-category combination transformation can be combined arbitrarily to generate more diverse data. For example, for a periodic data X, you can first perform an inter-category product transformation, and then perform an intra-category product transformation. For another example, for a linear data X, you can first perform an intra-category addition and subtraction transformation, then perform an intra-category product transformation, then perform an inter-category product transformation, and then perform an inter-category self-transformation.

[0196] The following is combined with Figure 2 , the data enhancement method of the present invention is further described, such as Figure 2 As shown, the data enhancement method 20 includes intra-category data enhancement 21 and inter-category data enhancement 22.

[0197] The intra-category data enhancement method 21 includes an intra-category product transformation 211 and an addition and subtraction transformation 212 .

[0198] The inter-class data enhancement method 22 includes a self-transformation 221, an inter-class product transformation 222, and a combined transformation 223. The self-transformation 221 includes a stable type transformed rectangular wave 2211, a linear type transformed sawtooth wave or a triangle wave 2212. The inter-class product transformation 222 includes a linear type transformed stable type 2221, and a periodic type transformed stable type 2222. The combined transformation 223 includes a linear type and stability type 2231, and a periodic type and stability type 2232.

[0199] It should be noted that the intra-category data enhancement method 21 and the following layer transformation methods included therein are the same as S101 in the above method embodiment, and the inter-category data enhancement method 22 and the following layer transformation methods included therein are the same as S102 in the above method embodiment, and will not be repeated here.

[0200] Device Embodiment

[0201] In a second aspect, another specific embodiment of the present invention discloses a data enhancement device, such as Figure 3 Shown include:

[0202] The intra-category enhancement module 301 is configured to perform intra-category data enhancement on data of the same category;

[0203] The inter-category enhancement module 302 is configured to perform inter-category data enhancement on data of different categories.

[0204] As an optional example, the intra-category enhancement module 301 is further configured to:

[0205] Get data data and a label name, where the label name is one of the following: periodic, linear or stable;

[0206] Setting the probability p of product transformation and the probability q of addition and subtraction transformation, wherein p and q are both numbers greater than zero and less than 1, and q is greater than p;

[0207] Get the maximum value max and the minimum value min of data data;

[0208] Generate a first random number r1 between 0 and 1;

[0209] If the r1 is less than p, perform intra-category product transformation;

[0210] If r1 is greater than or equal to p and less than or equal to q, then perform intra-category addition and subtraction transformation;

[0211] If r1 is greater than q, then intra-category addition and subtraction transformation and intra-category multiplication transformation are performed simultaneously;

[0212] Returns the transformed data.

[0213] As an optional example, the intra-category enhancement module 301 further includes an intra-category product module 3011, which is configured to:

[0214] If the tag name is stable, a second random number a2 between 0 and 1 is generated;

[0215] If the tag name is a periodic type or a linear type, then: obtain the variation range amp of the data data, where amp=max-min, set the minimum value amp_min after the data transformation, and generate a second random number a2 between amp_min / amp and 1 / max;

[0216] Multiply each value in the data data by the second random number a2 to obtain new data.

[0217] As an optional example, the intra-category enhancement module 301 further includes an intra-category addition and subtraction module 3012, which is configured to:

[0218] Generate a third random number a3 between -min and 1-max;

[0219] Add a3 to each value in the data to obtain new data.

[0220] As an optional example, the intra-category enhancement module 301 is further configured to:

[0221] First, the data data is subjected to intra-category product transformation, and then the data after product transformation is subjected to intra-category addition and subtraction transformation to obtain new data; or first, the data data is subjected to intra-category addition and subtraction transformation, and then the data after intra-category addition and subtraction transformation is subjected to intra-category product transformation to obtain new data.

[0222] As an optional example, the inter-category enhancement module 302 further includes a self-transformation module 3021 , an inter-category product transformation module 3022 and a combination transformation module 3023 .

[0223] As an optional example, the self-transformation module 3021 is configured to perform square wave synthesis on the sampling sequence samples to obtain self-transformed data if the label name label is a stable type, including:

[0224] Get data data and a label name, where the label name is one of the following: periodic, linear or stable;

[0225] If the label name of the data is periodic, directly return the data data and the label name label, otherwise perform the following steps:

[0226] Set the data sampling interval days, where days is the duration of the data;

[0227] Calculate the total number of sample nums;

[0228] Randomly sampling the data at the interval days to obtain a sampling sequence samples;

[0229] If the label name label is a stable type, square wave synthesis is performed on the sampling sequence samples to obtain self-transformed data;

[0230] If the label name label is a linear type, synthesize the sampling sequence samples by sawtooth wave and triangle wave to obtain self-transformed data;

[0231] Returns the self-transformed data.

[0232] As an optional example, the self-transformation module 3021 is further configured to perform sawtooth wave and triangle wave synthesis on the sampling sequence samples if the label name label is a linear type, to obtain self-transformed data, including:

[0233] Get the maximum value max and the minimum value min of the sampling sequence samples;

[0234] Generate a fourth random number r4 between 0 and 1, and set the minimum amplitude amp of the rectangular wave;

[0235] If r4 is greater than or equal to 0.5, a fifth random number a5 between 0 and r4-amp is generated;

[0236] If the r4 is less than 0.5, a fifth random number a5 between r4+amp and 1 is generated;

[0237] Calculate the moving distance d = max-r4;

[0238] Subtract d from each value in the sampling sequence samples to obtain a new sequence, denoted as sample_up;

[0239] Calculate the moving distance ud=r4-a5;

[0240] Subtract ud from each value in the sample_up to obtain a new sequence, recorded as sample_down;

[0241] Set the rectangular wave data rectangle to an empty list;

[0242] Traverse all days starting from 0, record the current day as the i-th day, if the remainder of i divided by 2 is equal to 1, then add all the elements in the sample_up list to the rectangle list, if the remainder of i divided by 2 is equal to 0, then add all the elements in the sample_down list to the rectangle list;

[0243] Set the label name label to periodic type, and return the rectangular wave data rectangle;

[0244] Here, i is the number of the day.

[0245] As an optional example, the self-transformation module 3021 is further configured to:

[0246] Generate a sixth random number r6 between 0 and 1;

[0247] The newly generated periodic data circle is recorded as an empty list;

[0248] If the r6 is greater than or equal to 0.5, a sawtooth wave synthesis is performed;

[0249] If the r6 is less than 0.5, triangle wave synthesis is performed;

[0250] Set the label name label to periodic type and return the periodic data circle.

[0251] As an optional example, the inter-class product transformation module 3022 is configured to:

[0252] Get data data and label name label;

[0253] If the label name label is stable, directly return the data data and the label name label, otherwise execute the following steps:

[0254] Set the maximum change range of stable data max_range;

[0255] Obtain the maximum value max and the minimum value min of the data data, and obtain the variation range amp=max-min of the data data;

[0256] Generate a seventh random number a7 between 0 and max_range / amp;

[0257] Multiply each value in the data data by a7 to obtain new data data_mult;

[0258] Set the label name label to stable type and return new data data_mult and label.

[0259] As an optional example, the combined transformation module 3023 is configured to:

[0260] Randomly obtain a data data1 and its label name label from the linear data set or periodic data set;

[0261] Randomly obtain a data data2 from the stable data set;

[0262] If the data size len2 of data2 is larger than the data size len1 of data1, then data2 only takes the first len1 data, otherwise the data size in data2 and data1 is made the same;

[0263] Add the corresponding elements of data1 and data2 to get the new data data_new;

[0264] Returns new data data_new and its label label.

[0265] It should be noted that the device provided in the present device embodiment is based on the same inventive concept as the above-mentioned method embodiment, solves the same technical problem, and achieves the same technical effect, and the similarities will not be repeated here.

[0266] In a third aspect, the present invention provides a data enhancement device, such as Figure 4 As shown, it includes: a memory and one or more processors.

[0267] One or more applications are stored in the memory, and the one or more applications are suitable for being executed by the one or more processors to implement the data enhancement method described in the first aspect.

[0268] like Figure 4 As shown, the processor 401 and the memory 402 are connected, such as through a bus.

[0269] The structure of the data enhancement device does not constitute a limitation on the embodiments of the present invention.

[0270] Processor 401 may be a CPU, a general purpose processor, a DSP, an ASIC, an FPGA or other programmable logic device, a transistor logic device, a hardware component or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of the present invention. Processor 401 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.

[0271] The bus may include a path to transmit information between the above components. The bus may be a PCI bus or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0272] The memory 402 may be a ROM or other type of static storage device that can store static information and instructions, a RAM or other type of dynamic storage device that can store information and instructions, or an EEPROM, a CD-ROM or other optical disk storage, an optical disk storage (including a compressed optical disk, a laser disk, an optical disk, a digital versatile disk, a Blu-ray disk, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited to these.

[0273] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program can be loaded and executed by a processor to perform the data enhancement method described in the first aspect.

[0274] The applicant of the present invention has made a detailed explanation and description of the implementation examples of the present invention in conjunction with the drawings in the specification. However, those skilled in the art should understand that the above implementation examples are only preferred implementation schemes of the present invention, and the detailed description is only to help readers better understand the spirit of the present invention, but not to limit the scope of protection of the present invention. On the contrary, any improvements or modifications based on the inventive spirit of the present invention should fall within the scope of protection of the present invention.

[0275] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the embodiments of the present invention, rather than to limit them. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the above embodiments, or replace some of the technical features therein by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention. Any changes or replacements that can be easily thought of by those skilled in the art within the technical scope disclosed in the present invention should be covered within the protection scope of the present invention.

Claims

1. A data enhancement method, characterized in that: include: For data of the same category, perform intra-category data enhancement; For data of different categories, inter-category data enhancement is performed.

2. A data enhancement method according to claim 1, characterized in that: The intra-category data enhancement includes: Get data data and a label name, where the label name is one of the following: periodic, linear or stable; Setting the probability p of product transformation and the probability q of addition and subtraction transformation, wherein p and q are both numbers greater than zero and less than 1, and q is greater than p; Get the maximum value max and the minimum value min of data data; Generate a first random number r1 between 0 and 1; If the r1 is less than p, perform intra-category product transformation; If r1 is greater than or equal to p and less than or equal to q, then perform intra-category addition and subtraction transformation; If r1 is greater than q, then intra-category addition and subtraction transformation and intra-category multiplication transformation are performed simultaneously; Returns the transformed data.

3. A data enhancement method according to claim 2, characterized in that: If r is less than p, performing intra-category product transformation includes: If the tag name is stable, a second random number a2 between 0 and 1 is generated; If the tag name is a periodic type or a linear type, then: obtain the variation range amp of the data data, where amp=max-min, set the minimum value amp_min after the data transformation, and generate a second random number a2 between amp_min / amp and 1 / max; Multiply each value in the data data by the second random number a2 to obtain new data.

4. A data enhancement method according to claim 2, characterized in that: If r is greater than or equal to p and less than or equal to q, performing intra-category addition and subtraction transformations includes: Generate a third random number a3 between -min and 1-max; Add a3 to each value in the data to obtain new data.

5. A data enhancement method according to claim 2, characterized in that: If r is greater than q, then performing intra-category addition and subtraction transformation and intra-category product transformation simultaneously includes: First, perform an intra-category product transformation on the data data, and then perform an intra-category addition and subtraction transformation on the data after the intra-category product transformation to obtain new data; or First, the data data is subjected to intra-category addition and subtraction transformations, and then the data subjected to the intra-category addition and subtraction transformations are subjected to intra-category multiplication transformations to obtain new data.

6. A data enhancement method according to claim 1, characterized in that: The inter-category data enhancement includes one or a combination of the following: Self-transformation, inter-class product transformation and combination transformation; The inter-category product transformation includes: Get data data and label name label; If the label name label is stable, directly return the data data and the label name label, otherwise execute the following steps: Set the maximum change range of stable data max_range; Obtain the maximum value max and the minimum value min of the data data, and obtain the variation range amp=max-min of the data data; Generate a seventh random number a7 between 0 and max_range / amp; Multiply each value in the data data by a7 to obtain new data data_mult; Set the label name label to stable type, and return new data data_mult and label; The combined transformation includes: Randomly obtain a data data1 and its label name label from the linear data set or periodic data set; Randomly obtain a data data2 from the stable data set; If the data size len2 of data2 is larger than the data size len1 of data1, then data2 only takes the first len1 data, otherwise the data size in data2 and data1 is made the same; Add the corresponding elements of data1 and data2 to get the new data data_new; Returns new data data_new and its label label.

7. A data enhancement method according to claim 6, characterized in that: The self-transformation includes: Get data data and a label name, where the label name is one of the following: periodic, linear or stable; If the label name of the data is periodic, directly return the data data and the label name label, otherwise perform the following steps: Set the data sampling interval days, where days is the duration of the data; Calculate the total number of sample nums; Randomly sampling the data at the interval days to obtain a sampling sequence samples; If the label name label is a stable type, square wave synthesis is performed on the sampling sequence samples to obtain self-transformed data; If the label name label is a linear type, synthesize the sampling sequence samples by sawtooth wave and triangle wave to obtain self-transformed data; Returns the self-transformed data.

8. A data enhancement method according to claim 7, characterized in that: If the label name label is a stable type, the sampling sequence samples is subjected to square wave synthesis, and the self-transformed data obtained includes: Get the maximum value max and the minimum value min of the sampling sequence samples; Generate a fourth random number r4 between 0 and 1, and set the minimum amplitude amp of the rectangular wave; If r4 is greater than or equal to 0.5, a fifth random number a5 between 0 and r4-amp is generated; If the r4 is less than 0.5, a fifth random number a5 between r4+amp and 1 is generated; Calculate the moving distance d = max-r4; Subtract d from each value in the sampling sequence samples to obtain a new sequence, denoted as sample_up; Calculate the moving distance ud=r4-a5; Subtract ud from each value in the sample_up to obtain a new sequence, recorded as sample_down; Set the rectangular wave data rectangle to an empty list; Traverse all days starting from 0, record the current day as the i-th day, if the remainder of i divided by 2 is equal to 1, then add all the elements in the sample_up list to the rectangle list, if the remainder of i divided by 2 is equal to 0, then add all the elements in the sample_down list to the rectangle list; Set the label name label to periodic type, and return the rectangular wave data rectangle; Here, i is the number of the day.

9. A data enhancement method according to claim 7, characterized in that: If the label name label is a linear type, the sampling sequence samples is synthesized by sawtooth wave and triangle wave, and the self-transformed data obtained includes: Generate a sixth random number r6 between 0 and 1; The newly generated periodic data circle is recorded as an empty list; If the r6 is greater than or equal to 0.5, a sawtooth wave synthesis is performed; If the r6 is less than 0.5, triangle wave synthesis is performed; Set the label name label to periodic type and return the periodic data circle.

10. A data enhancement device, characterized in that: For implementing the data enhancement method according to any one of claims 1 to 8, the device comprises: The intra-category enhancement module is configured to perform intra-category data enhancement on the data of the same category; The inter-category enhancement module is configured to perform inter-category data enhancement on data of different categories.