Data classification method, apparatus, device, and storage medium
By dynamically selecting a subset of training data and training a single classification model using the particle swarm optimization algorithm, and combining the results with a voting mechanism, the problem of low classification efficiency in imbalanced datasets is solved, achieving high-efficiency classification results.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- TSINGHUA UNIVERSITY
- Filing Date
- 2022-03-04
- Publication Date
- 2026-06-02
AI Technical Summary
Existing technologies suffer from low processing efficiency and poor classification results when classifying imbalanced datasets.
The particle swarm optimization algorithm is used to dynamically select a subset of training data, train multiple single classification models, and integrate the classification results through a voting mechanism. The training process is optimized by combining intermediate evaluation values, recommended evaluation values and stopping criteria.
It improves the processing efficiency and classification effect of imbalanced dataset classification tasks, and achieves high-efficiency dataset classification.
Smart Images

Figure CN114662568B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a data classification method, apparatus, electronic device, and non-transitory computer-readable storage medium. Background Technology
[0002] In recent years, artificial intelligence (AI) technology has been widely applied in various fields. Since the essence of AI technology is to predict unknown situations by extracting patterns from large amounts of real-world data, the characteristics and quality of that real-world data directly affect the effectiveness of AI applications.
[0003] Highly imbalanced natural data is considered difficult to learn from in the field of machine learning. Natural data often exhibits long-tailed distribution characteristics across multiple dimensions, making it difficult for most naturally distributed data to directly produce excellent classification results for general machine learning classifiers.
[0004] In one classification scheme for dealing with complex scenarios such as data balancing, it is necessary to select instances with a balanced number of data from different classes. When using manual methods to balance the training set, the processing efficiency is low and the classification effect is poor when dealing with classification tasks on imbalanced datasets. Summary of the Invention
[0005] This invention provides a data classification method, apparatus, electronic device, and non-transitory computer-readable storage medium to solve the problems of low processing efficiency and poor classification effect when classifying imbalanced datasets in the prior art, thereby improving the processing efficiency and optimizing the classification effect of imbalanced dataset classification tasks.
[0006] This invention provides a data classification method, comprising: inputting multiple subsets of data to be classified from a dataset to be classified into multiple preset single classifiers to obtain multiple single classification results, wherein the multiple single classifiers are trained on multiple initial single classification models using a subset of training data, and the subset of training data is dynamically selected from the sample data in the training dataset using a particle swarm optimization algorithm; and integrating the single classification results using a voting mechanism to obtain a first data classification result for the dataset to be classified.
[0007] According to a data classification method provided by the present invention, the training method of the multiple single classifiers includes: performing multiple iterative training cycles on the pre-selected multiple initial single classification models based on the training data subsets until the stopping criterion is met; the iterative training includes: training the single classification models separately using multiple training data subsets; inputting the trained multiple single classification models with an evaluation dataset, and evaluating the classification results using a voting mechanism to obtain intermediate evaluation values; determining whether to proceed to the next iteration based on the intermediate evaluation values, preset recommended evaluation values, and preset stopping criteria; if not, outputting the multiple single classification models corresponding to the optimal intermediate evaluation values in this iteration as single classifiers.
[0008] According to a data classification method provided by the present invention, after determining whether to proceed to the next iteration based on the intermediate evaluation value, the preset recommended evaluation value, and the preset stopping criterion, the method further includes: if so, obtaining a single evaluation value for a single classification model; determining whether the single evaluation value is better than the local optimal single evaluation value and the global optimal single evaluation value, and obtaining a determination result, wherein the local optimal single evaluation value is the optimal single evaluation value of the current single classification model dynamically adjusted during training; retaining or updating the local optimal single evaluation value and the global optimal single evaluation value according to the determination result, wherein the global optimal single evaluation value is the optimal single evaluation value of all single classification models dynamically adjusted during training.
[0009] According to a data classification method provided by the present invention, after retaining or updating the local best single evaluation value and the global best single evaluation value based on the judgment result, the method further includes: updating the training data subset based on the local best single evaluation value and the global best single evaluation value for the next iteration.
[0010] According to a data classification method provided by the present invention, the stopping criteria include any of the following criteria: the intermediate evaluation value is greater than a set first threshold; multiple intermediate evaluation values for a second threshold number of iterations are all less than or equal to the recommended evaluation value; the number of iterations for training the single classification model is greater than or equal to a set third threshold.
[0011] According to a data classification method provided by the present invention, updating the training data subset based on the local optimal single evaluation value and the global optimal single evaluation value includes: if the single evaluation value of a single classification model is greater than the global optimal single evaluation value, then changing the sample data in the training dataset selected by all items in the training data subset corresponding to the current single classification model with probability η, wherein η is a preset value and the preset interval is [0.03, 0.05]; if the single evaluation value of a single classification model is less than the global optimal single evaluation value but higher than the local optimal single evaluation value corresponding to the current single classification model, then changing the sample data in the training dataset selected by items in the currently selected training data subset whose local optimal single evaluation value is different from the global optimal single evaluation value with probability random(0,1)*C, wherein C is a preset integer value and the preset interval is [2, 4]. If the single evaluation value of a single classification model is less than its corresponding local best single evaluation value, then the following steps are performed: If the selection of the training data subset obtained based on the local best single evaluation value and the global best single evaluation value is the same, and consistent with the selection of the current single classification model, then the original selection remains unchanged; if the selection of the training data subset obtained based on the local best single evaluation value and the global best single evaluation value is the same, but inconsistent with the selection of the current single classification model, then the sample data in the training dataset selected by the training data subset used by the current single classification model is changed with a probability of 2*random(0,1)*C; if the selection of the training data subset obtained based on the local best single evaluation value and the global best single evaluation value is different, then the sample data in the training dataset selected by the training data subset used by the current single classification model is changed with a probability of random(0,1)*C.
[0012] According to a data classification method provided by the present invention, before inputting multiple subsets of data to be classified from the dataset to be classified into multiple preset single classifiers, the method further includes: selecting m vectors of length n, wherein the values of the vectors are random 0 or 1, and n is the number of data instances in the dataset to be classified; selecting m subsets of data to be classified from the dataset to be classified according to the m vectors of length n, wherein a value of 0 in the vector represents not selecting the corresponding data to be classified, and a value of 1 in the vector represents selecting the corresponding data to be classified.
[0013] This invention provides a data classification device, comprising: a classification unit, configured to input multiple subsets of data to be classified from a dataset to be classified into multiple preset single classifiers to obtain a single classification result, wherein the multiple single classifiers are trained on multiple initial single classification models using a subset of training data, and the subset of training data is dynamically selected from sample data in the training dataset using a particle swarm optimization algorithm; and an integration unit, configured to integrate the multiple single classification results using a voting mechanism to obtain a first data classification result for the dataset to be classified.
[0014] According to a data classification apparatus provided by the present invention, the apparatus further includes a training unit for performing multiple iterative training cycles on a plurality of pre-selected initial single classification models based on a subset of training data until the stopping criterion is met; the iterative training includes: training the single classification models separately using multiple subsets of training data; inputting the trained single classification models with an evaluation dataset and evaluating the classification results using a voting mechanism to obtain intermediate evaluation values; determining whether to proceed to the next iteration based on the intermediate evaluation values, a preset recommended evaluation value, and a preset stopping criterion; if not, outputting the plurality of single classification models corresponding to the optimal intermediate evaluation value in this iteration as a single classifier.
[0015] According to a data classification apparatus provided by the present invention, the training unit is further configured to: if so, obtain a single evaluation value of a single classification model; determine whether the single evaluation value is better than the local optimal single evaluation value and the global optimal single evaluation value, and obtain a determination result, wherein the local optimal single evaluation value is the optimal single evaluation value of the current single classification model dynamically adjusted during the training process; retain or update the local optimal single evaluation value and the global optimal single evaluation value according to the determination result, wherein the global optimal single evaluation value is the optimal single evaluation value of all single classification models dynamically adjusted during the training process.
[0016] According to a data classification apparatus provided by the present invention, the training unit is further configured to: update the training data subset based on the local best single evaluation value and the global best single evaluation value for the next iteration.
[0017] According to a data classification device provided by the present invention, the stopping criteria include any of the following criteria: the intermediate evaluation value is greater than a set first threshold; multiple intermediate evaluation values for a second threshold number of iterations are all less than or equal to the recommended evaluation value; the number of iterations for training the single classification model is greater than or equal to a set third threshold.
[0018] According to a data classification apparatus provided by the present invention, the training unit is further configured to: if the single evaluation value of a single classification model is greater than the globally optimal single evaluation value, then change the sample data in the training dataset selected by all items in the training data subset corresponding to the current single classification model with probability η, wherein η is a preset value and the preset interval is [0.03, 0.05]; if the single evaluation value of a single classification model is less than the globally optimal single evaluation value but higher than the locally optimal single evaluation value corresponding to the current single classification model, then change the sample data in the training dataset selected by items in the currently selected training data subset whose locally optimal single evaluation value is different from the globally optimal single evaluation value with probability random(0,1)*C, wherein C is a preset integer value and the preset interval is [2, 4 ... globally optimal single evaluation value, then change the sample data in the training dataset selected by items in the currently selected training data subset whose locally optimal single evaluation value is different from the globally optimal single evaluation value with probability random(0,1)*C, wherein C is a preset integer value and the preset interval is [2, 4]; if the single evaluation value of a single classification model is less than the globally optimal single evaluation value, then change the sample data in the training dataset selected by items in the training data subset whose locally optimal single evaluation value is different from the globally optimal single evaluation value. If the value is less than the corresponding local best single evaluation value, then the following steps are performed: If the selection of the training data subset obtained from the local best single evaluation value and the global best single evaluation value is the same, and consistent with the selection of the current single classification model, then the original selection remains unchanged; if the selection of the training data subset obtained from the local best single evaluation value and the global best single evaluation value is the same, but inconsistent with the selection of the current single classification model, then the sample data in the training dataset selected by the current single classification model's training data subset is changed with a probability of 2*random(0,1)*C; if the selection of the training data subset obtained from the local best single evaluation value and the global best single evaluation value is different, then the sample data in the training dataset selected by the current single classification model's training data subset is changed with a probability of random(0,1)*C.
[0019] According to a data classification device provided by the present invention, the device further includes a selection unit, configured to: select m vectors of length n, wherein the values of the vectors are random 0 or 1, where n is the number of data instances in the dataset to be classified; and select m subsets of data to be classified from the dataset according to the m vectors of length n, wherein a value of 0 in the vector represents not selecting the corresponding data to be classified, and a value of 1 in the vector represents selecting the corresponding data to be classified.
[0020] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of any of the data classification methods described above.
[0021] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the data classification methods described above.
[0022] The data classification method, apparatus, electronic device, and non-transitory computer-readable storage medium provided by this invention can efficiently obtain the classification results of the dataset to be classified by inputting a subset of the data to be classified into a single classifier and integrating the classification results of the single classifier, and the classification effect is good. Attached Figure Description
[0023] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0024] Figure 1 This is a flowchart illustrating the data classification method provided by the present invention;
[0025] Figure 2 This is a flowchart illustrating a single loop for training a single classifier provided by the present invention.
[0026] Figure 3 This is a schematic diagram of the process for training a single classifier provided by the present invention;
[0027] Figure 4 This is a schematic diagram of the structure of the data classification device provided by the present invention;
[0028] Figure 5 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0029] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0030] The terminology used in one or more embodiments of the present invention is for the purpose of describing particular embodiments only and is not intended to limit the scope of the invention. The singular forms “a,” “the,” and “the” used in one or more embodiments of the invention and in the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” used in one or more embodiments of the invention refers to and includes any or all possible combinations of one or more associated listed items.
[0031] It should be understood that although the terms first, second, etc., may be used to describe various information in one or more embodiments of the present invention, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first may also be referred to as second without departing from the scope of one or more embodiments of the present invention, and similarly, second may also be referred to as first. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to a determination."
[0032] In related technologies, schemes that actively balance the training set through manual or machine screening are called data-driven processing schemes. Classification schemes that directly use the raw data as input, retain its inherent imbalanced distribution, and employ other methods to obtain more accurate classification prediction results are called algorithm-driven processing schemes.
[0033] To address the issues of low classification efficiency and poor classification results when classifying imbalanced datasets in related technologies, this invention provides an algorithmic solution that can efficiently process imbalanced datasets and achieve better classification results.
[0034] The exemplary embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
[0035] like Figure 1 The diagram shows a flowchart of a data classification method according to an embodiment of the present invention. The method provided by this embodiment can be executed by any electronic device with computer processing capabilities, such as a terminal or server. Figure 1 As shown, the data classification method includes:
[0036] Step 102: Input multiple subsets of data to be classified from the dataset to be classified into multiple preset single classifiers to obtain a single classification result. The multiple single classifiers are obtained by training multiple initial single classification models using a subset of training data. The subsets of training data are dynamically selected from the sample data in the training dataset using the particle swarm optimization algorithm.
[0037] Specifically, multiple single classifiers are obtained by training an initial single classification model using multiple subsets of the training dataset. Particle Swarm Optimization (PSO) is a random search algorithm based on group cooperation, developed by simulating the foraging behavior of bird flocks.
[0038] Step 104: Use a voting mechanism to integrate multiple single classification results to obtain the first data classification result of the dataset to be classified.
[0039] Specifically, voting is a combination strategy in ensemble learning for classification problems. Its basic idea is to select the class that outputs the most among all machine learning algorithms.
[0040] The technical solution of this invention proposes a general and complete processing framework for typical imbalanced datasets, which enables the generation of a single classifier with superior classification performance. This technical solution can handle classification problems on imbalanced datasets and can be applied to various fields such as medical triage and stock market prediction. Specifically, by training a single classifier and using an ensemble voting mechanism, the technical solution of this invention can employ a consistent method for processing different datasets, thereby improving the processing efficiency and classification performance of imbalanced dataset classification tasks.
[0041] Before step 102, a single classifier needs to be trained, which is implemented by a recurrent training system. This recurrent training system performs multiple iterations of training on pre-selected initial single-classification models based on subsets of training data until a stopping criterion is met. For example... Figure 2 As shown, a single loop of the loop training process includes:
[0042] Step 201: Train a single classification model using multiple subsets of training data.
[0043] Step 202: Input the evaluation dataset into the trained single classification models, and evaluate the classification results using a voting mechanism to obtain intermediate evaluation values.
[0044] Step 203: Determine whether to proceed to the next cycle based on the intermediate evaluation value, the preset recommended evaluation value, and the preset stopping criteria.
[0045] Step 204: If not, output the multiple single-classification models corresponding to the best intermediate evaluation values in this iteration as a single classifier.
[0046] Before step 201, multiple training data subsets need to be obtained from the training dataset, that is, subsets of training data that are convenient for training a single classifier are selected from the training dataset. The method for obtaining training data subsets can be as follows: select m vectors of length n, where the vector values are random 0 or 1, and n is the number of data instances in the training dataset; based on the m vectors of length n, select m corresponding training data subsets from the training dataset, where a vector value of 0 represents not selecting the corresponding training data, and a vector value of 1 represents selecting the corresponding training data.
[0047] Specifically, during system initialization, the particle swarm size and value selection method need to be set. For example, the particle swarm size can be set to m, generating m vectors of length n, with all values randomly set to 0 or 1. For ease of explanation, let the training dataset be a dataset containing n data instances. A vector of length n containing only 0 and 1 values represents the subset of training data selected by each particle in the current state. If the value at the corresponding position in the vector is 1, it means that the data is selected and placed into the generated data subset; if the value is 0, it means that the data is not selected.
[0048] In step 201, the training data subsets represented by the acquired vectors are each placed into a pre-selected machine learning classifier, i.e., an initial classification model. This machine learning classifier then performs autonomous learning to generate multiple distinct single classification models. Each of these m different single classification models will have the independent ability to classify the training data subset.
[0049] In step 203, after determining whether to proceed to the next iteration based on the intermediate evaluation value, the preset recommended evaluation value, and the preset stopping criterion, if the next iteration is required, the local optimal single evaluation value and the global optimal single evaluation value need to be updated. The local optimal single evaluation value is the optimal single evaluation value of the current single classification model dynamically adjusted during training, and the global optimal single evaluation value is the optimal single evaluation value of all single classification models dynamically adjusted during training.
[0050] Specifically, if the current loop is the first loop in the training process, the single evaluation value of the single classification model obtained in the current loop is used as the local optimal single evaluation value, and the best single evaluation value of all single classification models obtained in the current loop is used as the global optimal single evaluation value. If the current loop is not the first loop in the training process, it is determined whether the single evaluation value is better than the local optimal single evaluation value and the global optimal single evaluation value, and the local optimal single evaluation value and the global optimal single evaluation value are retained or updated according to the determination result. Specifically, if the current single evaluation value of the single classification model is better than the local optimal single evaluation value or the global optimal single evaluation value, the current single evaluation value is used to update the local optimal single evaluation value or the global optimal single evaluation value; if the current single evaluation value of the single classification model is not better than the local optimal single evaluation value and the global optimal single evaluation value, the original local optimal single evaluation value and the global optimal single evaluation value are retained.
[0051] When determining whether to proceed to the next iteration based on the target classification model and the stopping criterion, if the training process of a single classifier meets the stopping criterion, then the next iteration will not proceed, and the multiple single classification models corresponding to the best intermediate evaluation values in the current iteration will be used as the output of a single classifier; if the training process of a single classifier does not meet the stopping criterion, then the training data subset will be updated based on the local best single evaluation value and the global best single evaluation value in order to proceed to the next iteration.
[0052] In this embodiment of the invention, the stopping criteria include any of the following criteria: the intermediate evaluation value is greater than a set first threshold; multiple intermediate evaluation values for a second threshold number of iterations are all less than or equal to the recommended evaluation value; the number of iterations for training a single classification model is greater than or equal to a set third threshold Smax.
[0053] Specifically, the stopping criterion can be understood as the termination condition of training. When the stopping criterion is met, i.e., when the termination condition is satisfied, the next cycle will not be performed, thus ending the training process. If the termination condition is not met, the next cycle of training will begin.
[0054] In this embodiment of the invention, the optimal single evaluation value (i.e., the local optimal single evaluation value pbesti) and its corresponding training data subset for each of the i single classification models during training can be recorded, where i is a natural number and 1 ≤ i ≤ m. The maximum value among pbest1 to pbestm is taken as the global optimal single evaluation value gbest. Before updating the sample data in the training dataset selected for all items in the training data subset, both the local optimal single evaluation value and the global optimal single evaluation value need to be updated.
[0055] When updating the training data subset based on the local best single evaluation value and the global best single evaluation value, the following cases apply:
[0056] If the single evaluation value of the current single classification model is greater than the global best single evaluation value, then the sample data in the training dataset selected by all items of the training data subset corresponding to the current single classification model is changed with probability η, where η is a preset value and the preset range is [0.03, 0.05].
[0057] If the single evaluation value of the current single classification model is less than the global best single evaluation value but higher than the local best single evaluation value corresponding to the current single classification model, then the sample data in the training dataset selected by the item whose local best single evaluation value is different from the global best single evaluation value in the currently selected training data subset is changed with probability random(0,1)*C, where C is a preset integer value and the preset interval is [2, 4].
[0058] If the single evaluation value of a single classification model is less than its corresponding local best single evaluation value, then perform the following steps:
[0059] If the selection of the training data subset obtained from the local best single evaluation value and the global best single evaluation value is the same, and consistent with the selection of the current single classification model, then the original selection remains unchanged; if the selection of the training data subset obtained from the local best single evaluation value and the global best single evaluation value is the same, but inconsistent with the selection of the current single classification model, then the sample data in the training dataset selected by the current single classification model's training data subset is changed with a probability of 2*random(0,1)*C; if the selection of the training data subset obtained from the local best single evaluation value and the global best single evaluation value is different, then the sample data in the training dataset selected by the current single classification model's training data subset is changed with a probability of random(0,1)*C.
[0060] like Figure 3 As shown, the imbalanced dataset 301 is the training dataset. Based on the imbalanced dataset 301, a training data subset 302 can be obtained, namely instance 1, instance 2, ..., instance n. Using these instances to train the machine learning classifier, a single classification model 303 can be obtained, namely classifier 1, classifier 2, ..., classifier n.
[0061] In step 304, a pre-selected subset of training data is used to evaluate the single classification model 303 to obtain the evaluation result. In step 305, the evaluation result obtained in step 304 is compared with the recommended evaluation value to obtain the comparison result.
[0062] In step 306, based on the comparison result from step 305, it is determined whether the current classification result of the single classification model is the optimal classification result. If yes, proceed to step 307; otherwise, proceed to step 308.
[0063] Specifically, if the evaluation result is less than the recommended evaluation value, the current classification result of the single classification model is determined to be not the optimal classification result; if the evaluation result is greater than or equal to the recommended evaluation value, the current classification result of the single classification model is determined to be the optimal classification result.
[0064] Step 307: Use the single classification model 303 as the optimal classifier, replace the original optimal classifier, and save it to the system's memory.
[0065] Step 308: Determine if the stopping criterion is met. If yes, proceed to step 311; otherwise, proceed to step 309.
[0066] Step 309: Update the local and global optimal solutions. Specifically, the local optimal solution is the local optimal single evaluation value, and the global optimal solution is the global optimal single evaluation value.
[0067] Step 310: Update the instance based on the local and global optimal solutions.
[0068] Step 311: End the loop process and output the optimal classifier in the system memory as a single classifier.
[0069] Before step 102, multiple subsets of data to be classified need to be obtained from the dataset to be classified. Multiple subsets of data that are easy for the classifier to use are selected from the dataset to be classified. The method for obtaining the subsets of data to be classified can be as follows: select m vectors of length n, where the values of the vectors are random 0 or 1, and n is the number of data instances in the dataset to be classified; based on the m vectors of length n, select m subsets of data to be classified from the dataset to be classified, where a value of 0 in the vector represents not selecting the corresponding data to be classified, and a value of 1 in the vector represents selecting the data to be classified.
[0070] The data classification method provided by this invention can efficiently obtain the classification results of the dataset to be classified by inputting a subset of the data to be classified into a single classifier and integrating the classification results of the single classifier, and the classification effect is good.
[0071] The data classification device provided by the present invention is described below. The data classification device described below and the data classification method described above can be referred to in correspondence.
[0072] like Figure 4 As shown, an embodiment of the present invention provides a data classification device, which includes:
[0073] The classification unit 402 is used to input multiple subsets of data to be classified from the dataset to be classified into multiple preset single classifiers to obtain a single classification result. The multiple single classifiers are obtained by training multiple initial single classification models using a subset of training data. The subset of training data is dynamically selected from the sample data in the training dataset using a particle swarm optimization algorithm.
[0074] Integration unit 404 is used to integrate multiple single classification results using a voting mechanism to obtain the first data classification result of the dataset to be classified.
[0075] In this embodiment of the invention, the apparatus further includes a training unit, comprising: performing multiple iterative training cycles on a pre-selected plurality of initial single classification models based on a subset of training data until a stopping criterion is met; the iterative training includes: training the single classification models separately using multiple subsets of training data; inputting the trained plurality of single classification models with an evaluation dataset, and evaluating the classification results using a voting mechanism to obtain intermediate evaluation values; determining whether to proceed to the next iteration based on the intermediate evaluation values, a preset recommended evaluation value, and a preset stopping criterion; if not, outputting the plurality of single classification models corresponding to the optimal intermediate evaluation value in this iteration as a single classifier.
[0076] In this embodiment of the invention, the training unit may further be used to: if so, obtain a single evaluation value of a single classification model; determine whether the single evaluation value is better than the local optimal single evaluation value and the global optimal single evaluation value, and obtain a determination result, wherein the local optimal single evaluation value is the optimal single evaluation value of the current single classification model dynamically adjusted during the training process; retain or update the local optimal single evaluation value and the global optimal single evaluation value according to the determination result, wherein the global optimal single evaluation value is the optimal single evaluation value of all single classification models dynamically adjusted during the training process.
[0077] In this embodiment of the invention, the training unit can also be used to update a subset of training data based on the local best single evaluation value and the global best single evaluation value for the next iteration.
[0078] In this embodiment of the invention, the stopping criteria include any of the following criteria: the intermediate evaluation value is greater than a set first threshold; multiple intermediate evaluation values for a second threshold number of iterations are all less than or equal to the recommended evaluation value; the number of iterations for training a single classification model is greater than or equal to a set third threshold.
[0079] In this embodiment of the invention, the training unit can also be used to: if the single evaluation value of a single classification model is greater than the globally optimal single evaluation value, then change the sample data in the training dataset selected by all items in the training data subset corresponding to the current single classification model with probability η, where η is a preset value and the preset interval is [0.03, 0.05]; if the single evaluation value of a single classification model is less than the globally optimal single evaluation value but higher than the locally optimal single evaluation value corresponding to the current single classification model, then change the sample data in the training dataset selected by items in the currently selected training data subset whose locally optimal single evaluation value is different from the globally optimal single evaluation value with probability random(0,1)*C, where C is a preset integer value and the preset interval is [2, 4]; if the single evaluation value of a single classification model is less than its corresponding locally optimal single evaluation value... If a single evaluation value is used, the following steps are performed: If the selection of the training data subset obtained from the local best single evaluation value and the global best single evaluation value is the same, and consistent with the selection of the current single classification model, then the original selection remains unchanged; if the selection of the training data subset obtained from the local best single evaluation value and the global best single evaluation value is the same, but inconsistent with the selection of the current single classification model, then the sample data in the training dataset selected by the current single classification model's training data subset is changed with a probability of 2*random(0,1)*C; if the selection of the training data subset obtained from the local best single evaluation value and the global best single evaluation value is different, then the sample data in the training dataset selected by the current single classification model's training data subset is changed with a probability of random(0,1)*C.
[0080] In this embodiment of the invention, the device may further include a selection unit, configured to: select m vectors of length n, wherein the values of the vectors are random 0 or 1, where n is the number of data instances in the dataset to be classified; and select m subsets of data to be classified from the dataset to be classified based on the m vectors of length n, wherein a value of 0 in the vectors represents not selecting the corresponding data to be classified, and a value of 1 in the vectors represents selecting the corresponding data to be classified.
[0081] Since the functional modules of the data classification device in the example embodiment of the present invention correspond to the steps of the data classification method in the example embodiment described above, for details not disclosed in the device embodiment of the present invention, please refer to the embodiments of the data classification method described above.
[0082] The data classification device provided by this invention can efficiently obtain the classification results of the dataset to be classified by inputting a subset of the data to be classified into a single classifier and integrating the classification results of the single classifier, and the classification effect is good.
[0083] Figure 5An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 5 As shown, the electronic device may include a processor 510, a communication interface 520, a memory 530, and a communication bus 540, wherein the processor 510, the communication interface 520, and the memory 530 communicate with each other via the communication bus 540. The processor 510 can call logical instructions in the memory 530 to execute a data classification method. This method includes: inputting multiple subsets of data to be classified from the dataset to be classified into multiple preset single classifiers to obtain multiple single classification results, wherein the multiple single classifiers are trained on multiple initial single classification models using a subset of training data, and the subset of training data is dynamically selected from the sample data in the training dataset using a particle swarm optimization algorithm; and integrating the multiple single classification results using a voting mechanism to obtain a first data classification result for the dataset to be classified.
[0084] Furthermore, the logical instructions in the aforementioned memory 530 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0085] On the other hand, the present invention also provides a computer program product, the computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions, wherein when the program instructions are executed by a computer, the computer is able to execute the data classification method provided by the above methods, the method comprising: inputting multiple subsets of data to be classified from the dataset to be classified into multiple preset single classifiers to obtain multiple single classification results, wherein the multiple single classifiers are obtained by training multiple initial single classification models using a subset of training data, the subset of training data being dynamically selected from the sample data in the training dataset using a particle swarm optimization algorithm; and integrating the multiple single classification results using a voting mechanism to obtain a first data classification result for the dataset to be classified.
[0086] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, is implemented to perform the data classification methods provided above. The method includes: inputting multiple subsets of data to be classified from a dataset to be classified into multiple preset single classifiers to obtain multiple single classification results, wherein the multiple single classifiers are obtained by training multiple initial single classification models using a subset of training data, and the subset of training data is dynamically selected from sample data in the training dataset using a particle swarm optimization algorithm; and integrating the multiple single classification results using a voting mechanism to obtain a first data classification result for the dataset to be classified.
[0087] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0088] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0089] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A data classification method, characterized in that, include: Multiple subsets of data to be classified in the dataset to be classified are respectively input into multiple preset single classifiers to obtain multiple single classification results. The multiple single classifiers are obtained by training multiple initial single classification models using training data subsets. The training data subsets are dynamically selected from the sample data in the imbalanced training dataset using the particle swarm optimization algorithm to optimize the classification performance of the single classifiers on imbalanced data. A voting mechanism is used to integrate the multiple single classification results to obtain the first data classification result of the dataset to be classified.
2. The method according to claim 1, characterized in that, The training method for the multiple single classifiers includes: performing multiple iterative training cycles on the pre-selected multiple initial single classification models based on the training data subset until the stopping criterion is met; The cyclic training includes: A single classification model is trained using multiple subsets of training data. Multiple single classification models trained with an evaluation dataset are input, and the classification results are evaluated using a voting mechanism to obtain intermediate evaluation values; Determine whether to proceed to the next iteration based on the intermediate evaluation value, the preset recommended evaluation value, and the preset stopping criteria; If not, output the multiple single-classification models corresponding to the best intermediate evaluation value in this iteration as a single classifier.
3. The method according to claim 2, characterized in that, After determining whether to proceed to the next iteration based on the intermediate evaluation value, the preset recommended evaluation value, and the preset stopping criteria, the method further includes: If so, obtain a single evaluation value for the single classification model; Determine whether the single evaluation value is better than the local best single evaluation value and the global best single evaluation value, and obtain the determination result, wherein the local best single evaluation value is the optimal single evaluation value of the current single classification model that is dynamically adjusted during the training process; Based on the judgment result, the local optimal single evaluation value and the global optimal single evaluation value are retained or updated, wherein the global optimal single evaluation value is the optimal single evaluation value of all single classification models dynamically adjusted during the training process.
4. The method according to claim 3, characterized in that, After retaining or updating the local best single evaluation value and the global best single evaluation value based on the judgment result, the method further includes: The training data subset is updated based on the local best single evaluation value and the global best single evaluation value for the next iteration.
5. The method according to claim 2, characterized in that, The stopping criteria include any of the following criteria: The intermediate evaluation value is greater than the set first threshold; The number of intermediate evaluation values for the second threshold number are all less than or equal to the recommended evaluation value; The number of iterations for training the single classification model is greater than or equal to a set third threshold.
6. The method according to claim 3, characterized in that, The step of updating the training data subset based on the local best single evaluation value and the global best single evaluation value includes: If the single evaluation value of a single classification model is greater than the global optimal single evaluation value, then the sample data in the training dataset selected by all items of the training data subset corresponding to the current single classification model is changed with probability η, where η is a preset value and the preset range is [0.03, 0.05]. If the single evaluation value of a single classification model is less than the global optimal single evaluation value but higher than the local optimal single evaluation value corresponding to the current single classification model, then the sample data in the training dataset selected by the item whose local optimal single evaluation value is different from the global optimal single evaluation value in the currently selected training data subset is changed with probability random(0,1)*C, where C is a preset integer value and the preset interval is [2,4]. If the single evaluation value of a single classification model is less than its corresponding local best single evaluation value, then perform the following steps: If the selection of the training data subset obtained from the local best single evaluation value and the global best single evaluation value is the same, and consistent with the selection of the current single classification model, then the original selection remains unchanged; if the selection of the training data subset obtained from the local best single evaluation value and the global best single evaluation value is the same, but inconsistent with the selection of the current single classification model, then the sample data in the training dataset selected by the current single classification model's training data subset is changed with a probability of 2*random(0,1)*C; if the selection of the training data subset obtained from the local best single evaluation value and the global best single evaluation value is different, then the sample data in the training dataset selected by the current single classification model's training data subset is changed with a probability of random(0,1)*C.
7. The method according to claim 6, characterized in that, Before inputting the multiple subsets of data to be classified from the dataset to be classified into the multiple preset single classifiers, the method further includes: Select m vectors of length n, where the values of the vectors are random 0 or 1, and n is the number of data instances in the dataset to be classified. Based on the m vectors of length n, m subsets of data to be classified are selected from the dataset to be classified. A value of 0 for a vector indicates that no data to be classified is selected, and a value of 1 for a vector indicates that the data to be classified is selected.
8. A data classification device, characterized in that, include: A classification unit is used to input multiple subsets of data to be classified from the dataset to be classified into multiple preset single classifiers to obtain multiple single classification results. The multiple single classifiers are trained on multiple initial single classification models using a subset of training data. The subset of training data is dynamically selected from the sample data in the imbalanced training dataset using a particle swarm optimization algorithm to optimize the classification performance of the single classifier on imbalanced data. The integration unit is used to integrate the multiple single classification results using a voting mechanism to obtain the first data classification result of the dataset to be classified.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the method as described in any one of claims 1 to 7.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1 to 7.