Data processing method, device, equipment and computer storage medium
The clustering algorithm is used to classify data items and determine the target data group. Only the changed items within the data group are stored, which solves the problem of large data volume and historical data management, and achieves the effect of saving storage space and retaining the value of data.
Patent Information
- Application Number
- CN202110708164.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-24
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2041-06-24
AI Technical Summary
As the amount of data increases, the existing technology takes up a lot of space when storing the entire amount, and deleting historical data will lose data integrity and cannot effectively manage slightly changed data, resulting in storage pressure and waste of data value.
A clustering algorithm is used to classify data items into data groups, and the target data group is determined through the current and historical center values, and only the changed items within the data group are stored to reduce storage space usage.
While retaining historical data and data continuity, it reduces storage pressure, saves storage space, and can adjust the granularity of data changes as needed.
Smart Images

Figure CN113434471B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer data processing technology, and in particular to a data processing method, device, equipment and computer-readable storage medium. Background Art
[0002] With the explosion of data and the acceleration of data transmission rate, the amount of data is increasing, and the storage capacity required is also increasing. Many data occupy a lot of storage space when stored in full at certain intervals, and deleting historical data loses the integrity of the data, or cannot be found when users want to find historical data. For data that changes at certain intervals, most of the data are slightly changed, such as the label value calculated in the user portrait, the data values in different time periods are different, but most of the data are still not much different. When storing in full, it faces the problem of occupying a lot of space, and the historical data has data value and cannot be deleted. Summary of the invention
[0003] The main purpose of the present application is to provide a data processing method, device, equipment and computer-readable storage medium, aiming to save the storage space required for data storage.
[0004] In a first aspect, the present application provides a data processing method, the data processing method comprising the following steps:
[0005] Acquire target data to be processed, wherein the target data includes a plurality of data items;
[0006] Based on a clustering algorithm model, classifying the plurality of data items into at least one data group;
[0007] Determine the current center value of each of the data groups according to the data items currently included in each of the data groups;
[0008] Obtaining a historical center value of each of the data groups, and determining a target data group according to the current center value and the historical center value of each of the data groups;
[0009] The data items in the target data group are stored at the target storage address.
[0010] In a second aspect, the present application further provides a data processing device, the data processing device comprising:
[0011] A data acquisition module, used to acquire target data to be processed, wherein the target data includes a plurality of data items;
[0012] A data item classification module, used for classifying the plurality of data items into at least one data group based on a clustering algorithm model;
[0013] A central value determination module, used to determine the current central value of each of the data groups according to the data items currently included in each of the data groups;
[0014] A target data group determination module, used for obtaining a historical center value of each of the data groups, and determining a target data group according to the current center value and the historical center value of each of the data groups;
[0015] The data item storage module is used to store the data items in the target data group to a target storage address.
[0016] In a third aspect, the present application also provides a computer device, comprising a processor, a memory, and a computer program stored in the memory and executable by the processor, wherein when the computer program is executed by the processor, the steps of the data processing method as described above are implemented.
[0017] In a fourth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, wherein when the computer program is executed by a processor, the steps of the data processing method as described above are implemented.
[0018] The present application provides a data processing method, device, equipment and computer-readable storage medium. The present application obtains target data to be processed, wherein the target data includes several data items; based on a clustering algorithm model, the several data items are classified into at least one data group; according to the data items currently contained in each data group, the current center value of each data group is determined; the historical center value of each data group is obtained, and the target data group is determined according to the current center value and the historical center value of each data group; the data items in the target data group are stored to the target storage address. Since only part of the data items in the target data are stored, the storage pressure of the server is reduced while retaining the historical data and data continuity, and more storage space is released. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0020] Figure 1 A flowchart of a data processing method provided in one embodiment of the present application;
[0021] Figure 2 A usage scenario diagram of a data processing method provided in one embodiment of the present application;
[0022] Figure 3 A schematic block diagram of a data processing device provided in one embodiment of the present application;
[0023] Figure 4 The present invention is a block diagram showing the structure of a computer device according to an embodiment of the present application. DETAILED DESCRIPTION
[0024] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0025] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.
[0026] The embodiments of the present application provide a data processing method, apparatus, computer equipment and computer-readable storage medium. The data processing method can be applied to a terminal device, which can be a mobile phone, tablet computer, laptop computer, desktop computer, personal digital assistant and wearable device.
[0027] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0028] Please refer to Figure 1 , Figure 1 A flowchart of a data processing method provided in an embodiment of the present application.
[0029] like Figure 1 As shown, the data processing method includes steps S101 to S105.
[0030] Step S101: Acquire target data to be processed, where the target data includes several data items.
[0031] Exemplarily, the target data to be processed may be data generated by calculation in a certain hard disk of the computer within a preset time period, or may be original data in a certain hard disk of the computer or data in a certain subfolder.
[0032] Exemplarily, the target data to be processed can be obtained in the Hadoop Distributed File System (HDFS). It can be understood that the data in the entire Hadoop Distributed File System can be obtained as the target data to be processed, and the data of a certain sub-file of the Hadoop Distributed File System can also be obtained as the target data to be processed.
[0033] Exemplarily, the target data to be processed can be obtained from the storage address storing the target data through a target data acquisition request, wherein the target data acquisition request may include the storage address storing the target data, and may also include an address identifier for identifying the storage address storing the target data so as to obtain the storage address storing the target data according to the mapping relationship between the address identifier and the storage address storing the target data. The storage address storing the target data is used to indicate the storage location of the target data in the computer, such as a subfolder in a folder on the D disk of the computer; it may also indicate the storage location in the Hadoop distributed file system; the computer knows the storage location of the target data currently required to be obtained in the computer according to the storage address storing the target data, so as to extract the required target data.
[0034] like Figure 2 As shown, Figure 2 This is a usage scenario diagram provided by an embodiment of the present application. The target data to be processed can also be obtained from the terminal device used by the user. For example, the user's terminal device records that the user has modified the data. The user's terminal device can respond to the server's target data acquisition instruction and send the target data to be processed to the server.
[0035] Exemplarily, the target data to be processed may include several data items, and the data items may be, for example, hobbies, habits, identity information, etc. in the user portrait.
[0036] Exemplarily, the target data to be processed is data that needs to be stored in a target storage address, and the target data is processed to reduce the storage space occupied by the target data in the target storage address.
[0037] Step S102: classify the data items into at least one data group based on a clustering algorithm model.
[0038] Exemplarily, the clustering algorithm model can be a k-means clustering algorithm model, which classifies multiple data items into at least one data group. It can be understood that a data group can include multiple data items, wherein the number of data groups is not greater than the number of data items, so that at least one data item can be classified into each data group.
[0039] Exemplarily, the data group into which each data item is classified can be determined by the relationship between each data item and each data group, wherein the relationship between the data item and the data group can be characterized by the Euclidean distance, and by calculating the Euclidean distance between the data item and each data group, it is determined into which data group the data item should be classified.
[0040] In some embodiments, the method further includes: determining the number of data groups according to the target data to be processed; and classifying the plurality of data items into the determined number of data groups based on the clustering algorithm model.
[0041] Exemplarily, the number of data groups is determined based on the acquired target data to be processed. It can be understood that the data groups are used to classify several data items in the target data to be processed, and to classify related or similar data items into the same data group to uniformly change the storage address or perform data compression, etc.
[0042] In some embodiments, determining the number of data groups based on the target data to be processed includes: calculating the size of the target data to obtain storage space occupancy information of the target data; determining the compression degree information of the target data based on preset occupancy information and the storage space occupancy information of the target data; and determining the number of data groups based on the compression degree information.
[0043] Exemplarily, the preset occupancy information is used to indicate the space information occupied by the target data to be processed that the user expects to be processed, and the preset occupancy information can be obtained through the user's input operation.
[0044] Exemplarily, the size of the target data to be processed is calculated to obtain the storage space occupancy information of the target data, and the compression degree information of the target data is determined by the storage space occupancy information of the target data and the preset occupancy information. For example, the calculated target data size obtains the storage space occupancy information of the target data as 50G, and the preset occupancy information is 30G. The target data needs to be reduced to reduce the storage space occupied by the target data. It is understandable that the reduction degree information of the target data can be determined based on the storage space occupancy information of the target data and the preset occupancy information. For example, the reduction degree information obtained by the above-mentioned storage space occupancy information of the target data and the preset occupancy information can be, for example, a reduction of 20G. The above occupied storage space size and reduction information are exemplary examples, and there may be other situations, which are not limited here.
[0045] Exemplarily, the number of data groups is determined according to the reduction degree information. It can be understood that the reduction degree indicated by the reduction degree information is linearly negatively correlated with the number of data groups, that is, the greater the reduction degree of the target data, the fewer the number of data groups determined. The smaller the reduction degree of the target data, the more the number of data groups determined.
[0046] Exemplarily, data items in the target data are grouped and stored by data groups, that is, continuous data is discretized, and the storage space occupied by the target data can be adjusted by adjusting the degree of discretization, that is, adjusting the number of data groups.
[0047] In some embodiments, classifying the several data items into the determined number of data groups includes: calculating the Euclidean distance from each data item to each data group; taking each of the data items as a target data item in turn, and classifying the target data item into the data group having the smallest Euclidean distance to the target data item.
[0048] Exemplarily, each data item is taken as the target data item in turn, the Euclidean distance from the target data item to each data group is calculated, the Euclidean distances between the target data item and each data group are compared, the data group with the smallest Euclidean distance value is determined among the data groups, and the target data item is classified into the data group corresponding to the smallest Euclidean distance value.
[0049] For example, the Euclidean distance of a data item to data group A is 4, the Euclidean distance to data group B is 6, and the Euclidean distance to data group C is 5. The data group corresponding to the smallest Euclidean distance value of 4 is data group A, and the data item is classified into data group A.
[0050] Exemplarily, each data item in the target data is subjected to the classification process as described above, so as to classify each data item into a determined number of data groups.
[0051] In some embodiments, the calculating of the Euclidean distance between each of the data items and each of the data groups includes: randomly assigning a different random center value to each of the data groups; and calculating the Euclidean distance between each of the data items and each of the data groups according to a preset calculation formula based on the random center value of each of the data groups.
[0052] Exemplarily, a different random center value is assigned to each of a certain number of data groups, for example, data group A is assigned a random center value of 3, data group B is assigned a random center value of 6, and data group C is assigned a random center value of 9. It can be understood that the assignment of random center values can be a randomly generated center value or can be based on a preset center value. The random center values of each data group are different to distinguish the data items within each data group.
[0053] Exemplarily, assigning a random center value to each data group can classify multiple data items into different data groups, wherein the fewer the number of data groups, the greater the difference in the random center values corresponding to each data group, the data items can be discretized to a greater extent, and more storage space can be released after processing each data group, but the granularity of data changes that can be viewed by users is coarser. If the number of data groups is larger and the difference in the random center values corresponding to each data group is smaller, the degree of discretization of the data items is smaller, the granularity of data changes that can be viewed by users is finer, and subtle changes in data items can be monitored.
[0054] Exemplarily, based on the random center value of each of the data groups, the Euclidean distance between each of the data items and each of the data groups is calculated according to a preset calculation formula to determine the data group to which each of the data items is classified.
[0055] Exemplarily, the preset calculation formula may be as follows:
[0056]
[0057] Among them, dis represents the distance, X i represents the i-th data item, C j represents the jth data group, m represents the attribute dimension of the data item, X it represents the tth attribute value of the ith data item, C jC Represents the random center value corresponding to the j-th array, and 1≤t≤m.
[0058] Exemplarily, after the Euclidean distance between the data item and each data group is calculated by the above formula, the data item is classified into the corresponding data group with the smallest Euclidean distance to the data item.
[0059] Exemplarily, by calculating the Euclidean distance between a data item and each data group to classify multiple data items, different data items can be effectively classified, and the processing rate of retaining required data items can be increased.
[0060] Step S103: Determine the current center value of each data group according to the data items currently included in each data group.
[0061] Exemplarily, after classifying each data item into each data group, each data group may calculate a current central value of the data group according to all data items currently included in the group.
[0062] Exemplarily, the current center value of the data group is used to represent the mean of all data items currently contained in the data group in each dimension. The current center value of the data group can be calculated using the following formula:
[0063]
[0064] Among them, C I represents the current center value of the lth data group, S I represents the number of data items in the lth data group, X i Represents the mean of the i-th data item in the l-th data group in each dimension.
[0065] Exemplarily, by calculating the mean values of all data items currently included in the data group in each dimension, the current central value of the data group in which the data item is located can be obtained.
[0066] In some embodiments, the method further comprises: updating the random center value of each of the data groups according to a current center value of each of the data groups.
[0067] Exemplarily, when the Euclidean distance between each data item and each data group is calculated, a random center value is randomly assigned to each data group. After the data items are classified, the current center value of the corresponding data group can be calculated based on all the data items currently included in each data group to update the random center value of the data group.
[0068] For example, after all data items are classified, each data group includes at least one data item, and the random center value randomly assigned to the data group is updated to the current center value calculated by the attribute values of the data items currently included in the data group.
[0069] For example, the above formula and method for calculating the center value can be used to update the random center value of the data group according to the attribute value of the data item currently included in the data group to obtain the current center value of the data group. For example, the center value randomly assigned to the A data group is 3, and the current center value calculated by the attribute value of the data item currently included in the group is 3.6, and the random center value of the A data group is updated to 3.6.
[0070] Exemplarily, the accuracy of determining the target data group can be improved by updating the random center value of the data group by the data items currently included in the data group.
[0071] Step S104: Obtain the historical center value of each of the data groups, and determine the target data group according to the current center value and the historical center value of each of the data groups.
[0072] Exemplarily, the historical center value can be the historical center value corresponding to each data group. For example, the center value of the data group is recorded once every preset time period, and the historical center value is used to indicate the center value recorded in the last preset time period. By comparing the current center value and the historical center value of the data group, it can be determined whether the data items in the data group have changed.
[0073] Exemplarily, when comparing the current central value with the historical central value, the comparison can be performed using the current central value and the historical central value corresponding to the data group, or the current central value and the historical central value can be sorted and then compared.
[0074] For example, the current center value of data group A is 3.6, the historical center value of data group A is 3.5, the current center value of data group B is 8, and the historical center value of data group B is 8. By comparing the current center value of data group A with the historical center value of data group A, it can be determined that there are changes in data items, and there are no changes in data items in data group B. It can be understood that the historical center values corresponding to data group A and data group B can be sorted first, and then compared with the sorted current center values corresponding to data group A and data group B.
[0075] Exemplarily, if the current center value of a data group is the same as the historical center value of the data group, then the data items in the data group have not changed, and the data group is not processed.
[0076] In some embodiments, the method further includes: sorting the current center value of at least one of the data groups according to the size of the current center value of at least one of the data groups to obtain a current center value sequence; obtaining a historical center value sequence, the historical center value sequence being formed by sorting the corresponding historical center values.
[0077] Exemplarily, the current center value of each data group can be sorted to obtain the current center value sequence of the data group. For example, the current center value of data group A is 3.6, the current center value of data group B is 8, and the current center value of data group C is 6. The current center values of each data group are sorted in order of size to obtain a current center value sequence of (3.6, 6, 8). The current center value sequence is compared with the historical center value sequence. It can be understood that the historical center value sequence should also be sorted according to the size of the historical center value corresponding to the data group. By comparing the current center value sequence with the historical center value sequence, it is possible to avoid the situation where the data item enters different data groups under two classifications, resulting in the historical center value of the data group being different from the current center value, but the data item itself has not undergone data changes. False judgments.
[0078] Determining the target data group based on the current center value and the historical center value of each data group includes: judging whether the current center value sequence is the same as the historical center value sequence; if the current center value in the current center value sequence is different from the historical center value at the corresponding position in the historical center value sequence, determining the data group corresponding to the different current center values as the target data group.
[0079] Exemplarily, it is determined whether the current center value sequence is the same as the historical center value sequence. If they are not the same, then at least one data item in the data group has changed. Specifically, if the current center value in the current center value sequence is different from the historical center value at the corresponding position in the historical center value sequence, then the data item in the data group corresponding to the different current center values has changed, and the data group can be determined as the target data group.
[0080] For example, the current center value located second forward of the current center value sequence is different from the historical center value located second forward of the historical center value sequence. The data group corresponding to the current center value located second forward of the current center value sequence is determined as the target data group. It can be understood that data changes have occurred in the data items in the target data group, and the data changes include but are not limited to data addition, data deletion, and data update.
[0081] Exemplarily, determining the target data group through the current central value sequence and the historical central value sequence can more accurately determine the target data group and reduce the probability of misjudgment so as to process the data items in the target data group.
[0082] Exemplarily, the target data set can also be stored in the blockchain, and when it is needed to be stored, it is broadcasted to the blockchain to obtain the target data set, wherein the blockchain referred to is a new application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods, each of which contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the blockchain underlying platform, platform product service layer, and application service layer.
[0083] Step S105: Store the data items in the target data group to the target storage address.
[0084] Exemplarily, the data items in the target data group are stored at the target storage address, that is, the changed data items are stored at the target storage address, and the unchanged data items are not stored or otherwise processed.
[0085] The target storage address can be a computer hard disk or a subfolder in a computer hard disk.
[0086] Specifically, some data items may be updated or increased or decreased every once in a while. If all data items are saved according to time nodes, the same unchanged data items will be saved again, thereby repeatedly occupying storage space, causing the data to occupy more storage space. If only the data items in the target data group are stored to the target storage address, that is, the same and unchanged data items are not stored again, and only the changed data items are stored, it can effectively save storage space, and can retain historical data while ensuring data integrity.
[0087] In some embodiments, the method further includes: obtaining storage space information after the target storage address stores the data items of the target data group; judging whether the storage space occupied by the data items of the target data group conforms to preset occupied space information based on the storage space information; if it is determined that it does not conform, deleting the data items of the target data group in the target storage address and adjusting the number of data groups; classifying a number of the data items into the data groups with the adjusted number to update the target data group based on the data groups with the adjusted number; and storing the data items in the updated target data group to the target storage address.
[0088] Exemplarily, after the data items in the target data group are stored in the target storage address, the storage space information of the target storage address is obtained and compared with the preset occupied space information to determine whether it complies with the preset occupied space information, that is, whether it exceeds the preset occupied space. For example, if the preset occupied space is 1G, if the obtained storage space information is not greater than 1G, it complies with the preset occupied space information; if the obtained storage space information is greater than 1G, it does not comply with the preset occupied space information.
[0089] Exemplarily, if the storage space information does not conform to the preset occupied space information, the data items of the target data group in the target storage address are deleted, and the number of data groups is adjusted.
[0090] Exemplarily, the number of data groups can be determined according to the target data, the acquired storage space information, and the preset occupied space information. After the number of data groups is re-determined, the operations of step S103 to step S105 are performed, which will not be described in detail here, and each data item is reclassified into the data group after the number is adjusted and the target data group is updated. It can be understood that after the number of data groups is adjusted, the target data group will also be different, and the data items in the updated target data group will be stored in the target storage address.
[0091] Exemplarily, in other embodiments, after classifying a number of data items into data groups, it is determined whether the data granularity of each of the data groups meets the target data granularity, and the data granularity is used to indicate the amount of information of the data items in the data group; if it does not meet the target data granularity, the number of data groups is adjusted, and the data items are classified into the data groups with the adjusted number.
[0092] Exemplarily, after completing the classification of data items, the data granularity of each data group is calculated, wherein the data granularity is used to indicate the amount of information of the data items in the data group. The more information the data items in the data group have and the smaller the data granularity, the more detailed the data changes that the user can obtain, but the storage space occupied is larger; if the data granularity of the data group does not meet the target data granularity, the number of data groups is adjusted according to the target data, the data granularity of the data group and the target data granularity, and several data items are classified into the data groups with the adjusted number to adjust the data granularity of each data group.
[0093] Exemplarily, if the data granularity of the data group meets the target data granularity, the operations of step S103 to step S105 are continued, which will not be described here. It can be understood that the target data granularity can be a preset data granularity or a target data granularity automatically generated according to the size of the storage space.
[0094] By adjusting the number of data groups by comparing the data granularity of the data group with the target data granularity, the operability of the method can be increased, and the granularity of data changes can be adjusted through simple operations, thereby adjusting the degree of monitoring data changes and the space occupied when storing the target data.
[0095] The data processing method provided in the above embodiment obtains the target data to be processed, the target data includes several data items; based on the clustering algorithm model, the several data items are classified into at least one data group; according to the data items currently contained in each data group, the current center value of each data group is determined; the historical center value of each data group is obtained, and the target data group is determined according to the current center value and the historical center value of each data group; the data items in the target data group are stored in the target storage address. While retaining the historical data, the storage pressure of the server is effectively reduced, more storage space is released, and the granularity of the target data change during the save can be conveniently adjusted.
[0096] See also Figure 3 , Figure 3 It is a schematic diagram of a data processing device provided in one embodiment of the present application. The data processing device can be configured in a server or a terminal to execute the aforementioned data processing method.
[0097] like Figure 3As shown, the data processing device includes: a data acquisition module 110, a data item classification module 120, a center value determination module 130, a target data group determination module 140, and a data item storage module 150.
[0098] A data acquisition module 110 is used to acquire target data to be processed, wherein the target data includes a plurality of data items;
[0099] A data item classification module 120, configured to classify the plurality of data items into at least one data group based on a clustering algorithm model;
[0100] A center value determination module 130, configured to determine a current center value of each of the data groups according to the data items currently included in each of the data groups;
[0101] A target data group determination module 140 is used to obtain a historical center value of each of the data groups, and determine a target data group according to the current center value and the historical center value of each of the data groups;
[0102] The data item storage module 150 is used to store the data items in the target data group to a target storage address.
[0103] Exemplarily, the data processing device also includes a current central value sequence determination module and a historical central value sequence acquisition module.
[0104] The current center value sequence determination module is used to sort the current center value of at least one of the data groups according to the size of the current center value of at least one of the data groups to obtain a current center value sequence.
[0105] The historical center value sequence acquisition module is used to acquire a historical center value sequence, wherein the historical center value sequence is formed by sorting the historical center values corresponding to at least one of the data groups.
[0106] The target data group determination module 140 is also used to determine whether the current center value sequence is the same as the historical center value sequence; if the current center value in the current center value sequence is different from the historical center value at the corresponding position in the historical center value sequence, the data group corresponding to the different current center values is determined as the target data group.
[0107] Exemplarily, the data processing device further includes a data group quantity determination module.
[0108] The data group quantity determination module is used to determine the quantity of data groups according to the target data to be processed.
[0109] The data item classification module 120 is further configured to classify the plurality of data items into the determined number of data groups based on the clustering algorithm model.
[0110] Exemplarily, the data group quantity determination module also includes a space occupancy information determination submodule, a compression degree information determination submodule, and a quantity determination submodule.
[0111] The space occupancy information determination submodule is used to calculate the size of the target data and obtain the storage space occupancy information of the target data.
[0112] The compression degree information determining submodule is used to determine the compression degree information of the target data according to preset occupancy information and storage space occupancy information of the target data.
[0113] The quantity determination submodule is used to determine the quantity of data groups according to the compression degree information.
[0114] Exemplarily, the target data group determination module 140 further includes a Euclidean distance calculation submodule and a data item classification submodule.
[0115] The Euclidean distance calculation submodule is used to calculate the Euclidean distance between each of the data items and each data group.
[0116] The data item classification submodule is used to take each of the data items as a target data item in turn, and classify the target data item into a data group having the smallest Euclidean distance to the target data item.
[0117] Exemplarily, the Euclidean distance calculation submodule also includes a random center value determination submodule and a distance calculation submodule.
[0118] The random center value determination submodule is used to randomly assign a different random center value to each of the data groups.
[0119] The distance calculation submodule is used to calculate the Euclidean distance between each of the data items and each of the data groups according to the random center value of each of the data groups and a preset calculation formula.
[0120] Exemplarily, the data processing device further includes a storage space information acquisition submodule, a storage space determination submodule, a data group quantity adjustment submodule, and a target data group update submodule.
[0121] The storage space information acquisition submodule is used to acquire the storage space information after the target storage address stores the data items of the target data group.
[0122] The storage space determination submodule is used to determine whether the storage space occupied by the data items of the target data group conforms to the preset occupied space information according to the storage space information.
[0123] The data group quantity adjustment submodule is used to delete the data items of the target data group in the target storage address and adjust the quantity of the data groups if it is determined that there is no compliance.
[0124] The target data set updating submodule is used to classify the data items into data sets with an adjusted number, so as to update the target data set according to the data sets with an adjusted number.
[0125] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and modules and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0126] The method and apparatus of the present application can be used in many general or special computing system environments or configurations, such as personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices.
[0127] Exemplarily, the above method and apparatus may be implemented in the form of a computer program. The computer program may be implemented in Figure 4 Runs on the computer device shown.
[0128] See also Figure 4 , Figure 4 A schematic block diagram of the structure of a computer device provided in an embodiment of the present application. The computer device may be a server or a terminal.
[0129] like Figure 4 As shown, the computer device includes a processor, a memory, and a network interface connected via a system bus, wherein the memory may include a storage medium and an internal memory.
[0130] The storage medium can store an operating system and a computer program. The computer program includes program instructions, and when the program instructions are executed, the processor can execute any data processing method.
[0131] The processor is used to provide computing and control capabilities and support the operation of the entire computer equipment.
[0132] The internal memory provides an environment for the operation of the computer program in the storage medium. When the computer program is executed by the processor, the processor can execute any data processing method.
[0133] The network interface is used for network communication, such as sending assigned tasks, etc. Those skilled in the art will understand that Figure 3The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0134] It should be understood that the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0135] In one embodiment, the processor is used to run a computer program stored in the memory to implement the following steps:
[0136] Acquire target data to be processed, wherein the target data includes a plurality of data items;
[0137] Based on a clustering algorithm model, classifying the plurality of data items into at least one data group;
[0138] Determine the current center value of each of the data groups according to the data items currently included in each of the data groups;
[0139] Obtaining a historical center value of each of the data groups, and determining a target data group according to the current center value and the historical center value of each of the data groups;
[0140] The data items in the target data group are stored at the target storage address.
[0141] In one embodiment, when implementing the data processing method, the processor is used to implement:
[0142] sorting the current center value of at least one of the data groups according to the size of the current center value of at least one of the data groups to obtain a current center value sequence;
[0143] Acquire a historical central value sequence, wherein the historical central value sequence is formed by sorting the historical central values corresponding to at least one of the data groups;
[0144] When determining the target data group according to the current central value and the historical central value of each data group, it is used to implement:
[0145] Determine whether the current central value sequence is the same as the historical central value sequence;
[0146] If there is a current central value in the current central value sequence that is different from the historical central value at the corresponding position in the historical central value sequence, the data group corresponding to the different current central values is determined as the target data group.
[0147] In one embodiment, when implementing the data processing method, the processor is used to implement:
[0148] Determining the number of data groups according to the target data to be processed;
[0149] When implementing the classification of the plurality of data items into at least one data group based on the clustering algorithm model, it is used to implement:
[0150] Based on the clustering algorithm model, the plurality of data items are classified into the determined number of data groups.
[0151] In one embodiment, when determining the number of data groups according to the target data to be processed, the processor is used to implement:
[0152] Calculating the size of the target data to obtain storage space occupation information of the target data;
[0153] Determining compression degree information of the target data according to preset occupancy information and storage space occupancy information of the target data;
[0154] The number of data groups is determined according to the compression degree information.
[0155] In one embodiment, when implementing the classification of the plurality of data items into the determined number of data groups, the processor is configured to implement:
[0156] Calculating the Euclidean distance between each of the data items and each data group;
[0157] Each of the data items is taken as a target data item in turn, and the target data item is classified into a data group having the smallest Euclidean distance to the target data item.
[0158] In one embodiment, when calculating the Euclidean distance between each of the data items and each data group, the processor is used to implement:
[0159] Randomly assigning a different random center value to each of the data groups;
[0160] According to the random center value of each of the data groups, the Euclidean distance between each of the data items and each of the data groups is calculated according to a preset calculation formula.
[0161] In one embodiment, when implementing the data processing method, the processor is used to implement:
[0162] Acquire storage space information after the target storage address stores the data items of the target data group;
[0163] Determining, according to the storage space information, whether the storage space occupied by the data items of the target data group conforms to the preset occupied space information;
[0164] If it is determined that it does not comply, deleting the data item of the target data group in the target storage address, and adjusting the number of data groups;
[0165] classifying the plurality of data items into data groups with an adjusted number to update the target data group according to the data groups with the adjusted number;
[0166] The data items in the updated target data group are stored in the target storage address.
[0167] It should be noted that technicians in the relevant field can clearly understand that for the convenience and brevity of description, the specific working process of data processing described above can refer to the corresponding process in the aforementioned data processing control method embodiment, and will not be repeated here.
[0168] An embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. The computer program includes program instructions. The method implemented when the program instructions are executed can refer to the various embodiments of the data processing method of the present application.
[0169] The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiment, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc., equipped on the computer device.
[0170] It should be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0171] It should also be understood that the term "and / or" used in the specification of this application and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, including these combinations. It should be noted that, in this article, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "including a..." does not exclude the presence of other identical elements in the process, method, article or system including the element.
[0172] The serial numbers of the embodiments of the present application are for description only and do not represent the advantages and disadvantages of the embodiments. The above description is only a specific implementation mode of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A data processing method, characterized in that: include: Acquire target data to be processed, wherein the target data includes a plurality of data items; Calculating the size of the target data to obtain storage space occupation information of the target data; Determining compression degree information of the target data according to preset occupancy information and storage space occupancy information of the target data; Determining the number of data groups according to the compression degree information; Based on the clustering algorithm model, classifying the plurality of data items into the determined number of data groups; Determine the current center value of each of the data groups according to the data items currently included in each of the data groups; Obtaining a historical center value of each of the data groups, and determining a target data group according to the current center value and the historical center value of each of the data groups; Storing the data items in the target data group to a target storage address; The step of obtaining the historical center value of each of the data groups and determining the target data group according to the current center value and the historical center value of each of the data groups includes: sorting the current center value of at least one of the data groups according to the size of the current center value of at least one of the data groups to obtain a current center value sequence; Acquire a historical central value sequence, wherein the historical central value sequence is formed by sorting the historical central values corresponding to at least one of the data groups; Determine whether the current central value sequence is the same as the historical central value sequence; If there is a current central value in the current central value sequence that is different from the historical central value at the corresponding position in the historical central value sequence, the data group corresponding to the different current central values is determined as the target data group.
2. The data processing method according to claim 1, characterized in that: The classifying the plurality of data items into the determined number of data groups comprises: Calculating the Euclidean distance between each of the data items and each data group; Each of the data items is taken as a target data item in turn, and the target data item is classified into a data group having the smallest Euclidean distance to the target data item.
3. The data processing method according to claim 2, characterized in that: The calculating of the Euclidean distance between each of the data items and each data group comprises: Randomly assigning a different random center value to each of the data groups; According to the random center value of each of the data groups, the Euclidean distance between each of the data items and each of the data groups is calculated according to a preset calculation formula.
4. The data processing method according to claim 1, characterized in that: The method further comprises: Acquire storage space information after the target storage address stores the data items of the target data group; Determining, according to the storage space information, whether the storage space occupied by the data items of the target data group conforms to the preset occupied space information; If it is determined that it does not comply, deleting the data item of the target data group in the target storage address, and adjusting the number of data groups; classifying the plurality of data items into data groups with an adjusted number to update the target data group according to the data groups with the adjusted number; The data items in the updated target data group are stored in the target storage address.
5. A data processing device, characterized in that: The data processing device comprises: A data acquisition module, used to acquire target data to be processed, wherein the target data includes a plurality of data items; A space occupancy information determination submodule is used to calculate the size of the target data and obtain storage space occupancy information of the target data; A compression degree information determination submodule, used to determine the compression degree information of the target data according to preset occupancy information and storage space occupancy information of the target data; A quantity determination submodule, used to determine the quantity of data groups according to the compression degree information; A data item classification module, used for classifying the plurality of data items into the determined number of data groups based on a clustering algorithm model; A central value determination module, used to determine the current central value of each of the data groups according to the data items currently included in each of the data groups; A target data group determination module, used for obtaining a historical center value of each of the data groups, and determining a target data group according to the current center value and the historical center value of each of the data groups; A data item storage module, used for storing the data items in the target data group to a target storage address; Wherein, the data processing device further comprises: a current central value sequence determination module and a historical central value sequence acquisition module; The current center value sequence determination module is used to sort the current center value of at least one of the data groups according to the size of the current center value of at least one of the data groups to obtain a current center value sequence; The historical center value sequence acquisition module is used to acquire a historical center value sequence, wherein the historical center value sequence is formed by sorting the historical center values corresponding to at least one of the data groups; The target data group determination module is also used to determine whether the current center value sequence is the same as the historical center value sequence; if the current center value in the current center value sequence is different from the historical center value at the corresponding position in the historical center value sequence, the data group corresponding to the different current center value is determined as the target data group.
6. A computer device, characterized in that: The computer device comprises a processor, a memory, and a computer program stored in the memory and executable by the processor, wherein when the computer program is executed by the processor, the steps of the data processing method according to any one of claims 1 to 4 are implemented.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the steps of the data processing method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Data storage method, device and equipment and storage medium
CN109710190A
Block chain-based distributed system hierarchical processing method and electronic equipment
CN112182111A
Sequence generation method and apparatus, computer device, and storage medium
WO2020224091A1
