CN113822362A - Classification model training method, classification device, classification equipment and medium - Google Patents

Classification model training method, classification device, classification equipment and medium Download PDF

Info

Publication number
CN113822362A
CN113822362A CN202111127320.XA CN202111127320A CN113822362A CN 113822362 A CN113822362 A CN 113822362A CN 202111127320 A CN202111127320 A CN 202111127320A CN 113822362 A CN113822362 A CN 113822362A
Authority
CN
China
Prior art keywords
sample data
classification
data
classification model
iteration
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111127320.XA
Other languages
Chinese (zh)
Inventor
杨志科
曹文龙
蒋秋明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Shangshi Longchuang Intelligent Technology Co Ltd
Original Assignee
Shanghai Shangshi Longchuang Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Shangshi Longchuang Intelligent Technology Co Ltd filed Critical Shanghai Shangshi Longchuang Intelligent Technology Co Ltd
Priority to CN202111127320.XA priority Critical patent/CN113822362A/en
Publication of CN113822362A publication Critical patent/CN113822362A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/241Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/23Clustering techniques

Landscapes

  • Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Artificial Intelligence (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention discloses a classification model training method, a classification device, classification equipment and a classification medium. The method comprises the following steps: determining first sample data and second sample data of current iteration in initial sample data, wherein the first sample data is random sample data with a preset number in first iteration or a collection of the first sample data and the second sample data in last iteration, and a classification result of the second sample data in each iteration is determined based on a corresponding classification result of the first sample data; and training the current classification model based on the first sample data, the second sample data and the classification result of each sample data, obtaining the classification model updated by the current iteration, and obtaining the trained target classification model. By the technical scheme disclosed by the embodiment of the invention, the efficiency and the accuracy of the classification model training are improved.

Description

Classification model training method, classification device, classification equipment and medium
Technical Field
The embodiment of the invention relates to the technical field of data processing, in particular to a classification model training method, a classification device, classification equipment and a medium.
Background
At present, in the field of deep learning, two general ways can be used for classifying data, namely full-supervision segmentation and weak-supervision classification. The fully supervised classification has a good effect, but requires a large amount of accurately labeled data for training, and the data requires a large amount of professional personnel to spend a large amount of time for labeling.
Most of the existing data marking modes are marked by means of manual work, work tasks are heavy, errors of marking results are more, and time and labor are wasted.
Disclosure of Invention
The invention provides a classification model training method, a classification device and a classification medium, which are used for realizing the training of a network model based on a small amount of labeled data, reducing the workload of data labeling and improving the training efficiency of the model, and setting loss functions corresponding to different weights based on different sample data to improve the accuracy of model training.
In a first aspect, an embodiment of the present invention provides a classification model training method, where the method includes:
determining first sample data and second sample data of the current iteration in the initial sample data; the sample data size of the first sample data is the same as that of the second sample data, and the sample data is not overlapped, the first sample data is random sample data with a preset number in the first iteration or a collection of the first sample data and the second sample data in the last iteration, and the classification result of the second sample data in each iteration is determined based on the classification result of the corresponding first sample data;
and training the current classification model based on the first sample data, the second sample data and the classification result of each sample data, and obtaining the classification model updated by the current iteration until the iteration stop condition is met, thereby obtaining the trained target classification model.
Optionally, if the current iteration is the first iteration, determining first sample data and second sample data of the current iteration in the initial sample data includes:
extracting sample data with a preset quantity from the initial sample data to be used as first sample data;
and extracting a preset number of sample data from the sample data except the first sample data in the initial sample data to be used as second sample data.
Optionally, after determining the first sample data and the second sample data of the current iteration in the initial sample data, the method further includes:
taking the artificial marking data of the first sample data as the classification result of the first sample data;
determining a classification result of the initial sample data based on a classification result of the first sample data, and determining a classification result of the second sample data based on a classification result of the initial sample data.
Optionally, the training a current classification model based on the first sample data, the second sample data, and the classification result of each sample data, and obtaining a classification model updated by current iteration until an iteration stop condition is met, to obtain a trained target classification model, includes:
acquiring first sample data and second sample data of current iteration, and inputting the first sample data and the second sample data to the current classification model to obtain an output result of the current classification model;
taking the classification result of each sample data of the current iteration as a data label of each sample data, generating a loss function based on the data label of the current iteration and the output result of the current classification model, and performing parameter adjustment on the current classification model based on the loss function;
and when the training process of the current classification model meets the training stopping condition, obtaining the trained target classification model.
Optionally, the loss function in the training process of the classification model includes a first loss function corresponding to first sample data and a second loss function corresponding to second sample data; the first loss function is determined based on a first weight corresponding to the first sample data, and the second loss function is determined based on a second weight corresponding to the second sample data.
In a second aspect, an embodiment of the present invention provides a data classification method, where the method includes:
acquiring data to be classified;
inputting the data to be classified into a pre-trained target classification model to obtain a classification result output by the target classification model; the target classification model is obtained by pre-training based on the classification model training method in any one of the above embodiments.
In a third aspect, an embodiment of the present invention further provides a classification model training apparatus, where the apparatus includes:
the sample data acquisition module is used for determining first sample data and second sample data of the current iteration in the initial sample data; the sample data size of the first sample data is the same as that of the second sample data, and the sample data is not overlapped, the first sample data is random sample data with a preset number in the first iteration or a collection of the first sample data and the second sample data in the last iteration, and the classification result of the second sample data in each iteration is determined based on the classification result of the corresponding first sample data;
and the classification model training module is used for training the current classification model based on the first sample data, the second sample data and the classification result of each sample data, obtaining the classification model updated by the current iteration until the iteration stopping condition is met, and obtaining the trained target classification model.
In a fourth aspect, an embodiment of the present invention further provides a data classification apparatus, where the apparatus includes:
the classification data acquisition module is used for acquiring data to be classified;
the classification module is used for inputting the data to be classified into a pre-trained classification model to obtain a classification result output by the model; the classification model is obtained by pre-training based on the classification model training method in any one of the above embodiments.
In a fifth aspect, an embodiment of the present invention further provides an electronic device, where the electronic device includes:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement a classification model training method as provided by any of the embodiments of the invention.
In a sixth aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the classification model training method provided in any embodiment of the present invention.
The technical scheme of the embodiment includes that a clustering model is trained on the basis of artificial marking results and preliminary clustering results of a preset number of first sampling samples randomly sampled in a sample set to obtain a trained clustering model, and classification results of the sample set are obtained on the basis of the clustering model; the method and the device realize the acquisition of the labeled data of a large number of sample sets based on a small amount of labeled data, and reduce the workload of labeling; further, randomly sampling again from the sample set after the first sampling to obtain a second sampling sample which is the same as the first sampling sample; and determining a classification result of the second sample based on the classification result of the sample set; training a current classification model by using a first sample data and a second sample data of the first sample and a classification result of each sample data, obtaining a classification model updated by current iteration, using the first sample data and the second sample data of the current iteration as a first sample data of next iteration, determining a second sample of the next iteration in the sample set based on the first sample data of the next iteration, and performing the next iteration training until an iteration stop condition is met to obtain a trained target classification model; different sample data are adopted for training on the basis of each iteration, the iteration times are reduced, and the training accuracy is improved by a loss function determined on the basis of different weights of the preset first sample data and the second sample data; therefore, based on the technical scheme, the efficiency and the accuracy of model training are improved.
Drawings
In order to more clearly illustrate the technical solutions of the exemplary embodiments of the present invention, a brief description is given below of the drawings used in describing the embodiments. It should be clear that the described figures are only views of some of the embodiments of the invention to be described, not all, and that for a person skilled in the art, other figures can be derived from these figures without inventive effort.
FIG. 1 is a schematic flow chart of a classification model training method according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a data classification method according to a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of a classification model training apparatus according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of a data classification apparatus according to a fourth embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device according to a fifth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Example one
Fig. 1 is a flowchart of a classification model training method according to an embodiment of the present invention, which is applicable to a case of training a classification model, and in particular, is more applicable to a case of training a classification model based on a small number of labeled protectors. The method may be performed by a classification model training apparatus, which may be implemented by software and/or hardware.
Before describing the technical solution of the present embodiment, an application scenario of the technical solution of the present embodiment is described in an exemplary manner. Specifically, the application scenarios include: at present, in the field of deep learning, two general ways can be used for classifying data, namely full-supervision segmentation and weak-supervision classification. The fully supervised classification has a good effect, but requires a large amount of accurately labeled data for training, and the data requires a large amount of professional personnel to spend a large amount of time for labeling. Most of the existing data marking modes are marked by means of manual work, work tasks are heavy, errors of marking results are more, and time and labor are wasted.
Based on the technical problems, the technical scheme of the embodiment is that a clustering model is trained based on artificial labeling results and preliminary clustering results of randomly sampling a preset number of first sampling samples in a sample set to obtain a trained clustering model, and a classification result of the sample set is obtained based on the clustering model; the method and the device realize the acquisition of the labeled data of a large number of sample sets based on a small amount of labeled data, and reduce the workload of labeling; further, randomly sampling again from the sample set after the first sampling to obtain a second sampling sample which is the same as the first sampling sample; and determining a classification result of the second sample based on the classification result of the sample set; training a current classification model by using a first sample data and a second sample data of the first sample and a classification result of each sample data, obtaining a classification model updated by current iteration, using the first sample data and the second sample data of the current iteration as a first sample data of next iteration, determining a second sample of the next iteration in the sample set based on the first sample data of the next iteration, and performing the next iteration training until an iteration stop condition is met to obtain a trained target classification model; different sample data are adopted for training on the basis of each iteration, the iteration times are reduced, and the training accuracy is improved by a loss function determined on the basis of different weights of the preset first sample data and the second sample data; therefore, based on the technical scheme, the efficiency and the accuracy of model training are improved.
Of course, the above description of the application scenario is only used as an optional application scenario, and the embodiment may also be applied to other application scenarios, for example, classifying images based on image features.
As shown in fig. 1, the technical solution of the embodiment of the present invention specifically includes the following steps:
and S110, determining first sample data and second sample data of the current iteration in the initial sample data.
In this embodiment, the initial sample data may be sample data for training the classification model, and the initial sample data is sample data that is not labeled. Specifically, the data content of the initial sample data may be various, and the exemplary sample data may be user information sample data, for example, sample data including different ages and different sexes may be included, and further, a gender classification model or an age classification model may be trained based on the sample data to be classified; of course, sample data of other contents can be also used, and then classification models of other categories are trained based on the sample data of other contents; in this embodiment, the data content of the initial sample data is not limited. The first sample data and the second sample data may both be part of the randomly sampled sample in the initial sample data. Specifically, the first sample data may be a preset number of random sample data in a first iteration or a set of first sample data and second sample data in a last iteration. The second sample may be sample data obtained by randomly sampling a predetermined number of initial sample data other than the first sample. Therefore, in this embodiment, the sample data size of the first sample data is the same as that of the second sample data, and the sample data does not overlap.
Optionally, in the process of performing classification model training, if the current iteration training is the first iteration, the method for determining the first sample data and the second sample data of the current iteration in the initial sample data may include: and extracting a preset number of sample data from the initial sample data to be used as first sample data. Specifically, random sampling is performed in the initial sample data, and the obtained sample data of a preset number is used as the first sample data of the current iteration. Furthermore, a preset number of sample data are extracted from the sample data except the first sample data in the initial sample data to be used as second sample data. Specifically, residual sample data except the first sample data in the initial sample data is obtained, random sampling is performed on the residual sample data, and sample data with a preset data size is obtained and serves as second sample data. The number of the second sample data is the same as that of the first sample data, and the sample data is not overlapped completely; and the first sampling sample data and the second sampling sample data are jointly used as training samples of the current iteration, so that the diversity of the samples is ensured, and the accuracy of model training is improved.
Further, after determining the first sample data and the second sample data of the current iteration in the initial sample data, the method further includes: and taking the artificial marking data of the first sample data as the classification result of the first sample data. A classification result of the initial sample data is determined based on a classification result of the first sample data, and a classification result of the second sample data is determined based on the classification result of the initial sample data.
Specifically, the method for determining the classification result of the second sample data includes: and obtaining an initial classification result of the first sample data based on the initial clustering model, obtaining artificial marking data of the first sample data, and adjusting the initial clustering model based on the artificial marking data of the first sample data and the initial classification result of the first sample data to obtain an adjusted target clustering model. Inputting the initial sample data into the target clustering model to obtain a classification result of the initial sample data, and determining a classification result corresponding to second sample data based on the second sample data extracted from the initial sample.
On the basis of the foregoing embodiments, some embodiments may further perform correlation analysis on the first sample data before the first sample data is input to the initial clustering model, perform principal component analysis on each feature if the obtained analysis result needs to be subjected to feature dimension reduction processing, obtain a principal feature corresponding to the first sample data, input the principal feature into the initial clustering model, obtain an initial classification result output by the model, and adjust the initial clustering model based on the initial classification result and the artificial labeling data of the first sample data, so as to obtain an adjusted target clustering model. And then obtaining a classification result of the initial sample data based on the target clustering model.
Optionally, if the current iteration training is not the first iteration training, the method for determining the first sample data and the second sample data of the current iteration in the initial sample data may include: and taking a data set of the first sample data and the second sample data of the last iteration as the first sample data of the current iteration, and extracting a preset number of second sample data from the residual sample data after the first sample data of the current iteration is removed, wherein the number of the second sample data of the current iteration is the same as that of the first sample data of the current iteration, and the sample contents are completely not overlapped.
Optionally, if the current iteration training is not the first iteration training, the classification result of the first sample data of the last iteration and the classification result of the second sample data are determined as the classification result of the first sample data of the current iteration together, and the classification result corresponding to the second sample data is determined based on the second sample data extracted from the initial sample.
And S120, training the current classification model based on the first sample data, the second sample data and the classification result of each sample data, and obtaining the classification model updated by the current iteration until the iteration stop condition is met, so as to obtain the trained target classification model.
In this embodiment, after the first sample data and the second sample data of the current iteration and the classification result of each sample data are obtained, the current classification model is iteratively trained based on the data and the classification result. Optionally, the training process may include: acquiring first sample data and second sample data of current iteration, and inputting the first sample data and the second sample data to a current classification model to obtain an output result of the current classification model; and taking the classification result of each sample data of the current iteration as the data label of each sample data, generating a loss function based on the data label of the current iteration and the output result of the current classification model, and carrying out parameter adjustment on the current classification model based on the loss function.
Optionally, the loss function in this embodiment includes a first loss function corresponding to the first sample data and a second loss function corresponding to the second sample data; the first loss function is determined based on a first weight corresponding to the first sample data, and the second loss function is determined based on a second weight corresponding to the second sample data. Specifically, the weight value of the first weight corresponding to the manually marked first sample data can be set to be larger, so that the accuracy of model training is improved.
Further, when the training process of the current classification model meets the training stopping condition, a trained target classification model is obtained.
Specifically, the classification model in training is repeatedly trained based on the loss function of the above embodiment until the model converges in the training sample, that is, the loss value of the model tends to zero or tends to be stable for a long time and does not change with the increase of the training times, or when the number of samples in the initial sample data reaches zero, it is determined that the classification model at this time meets the training stop condition, that is, the model training is completed, and the trained target classification model is obtained.
The technical scheme of the embodiment includes that a clustering model is trained on the basis of artificial marking results and preliminary clustering results of a preset number of first sampling samples randomly sampled in a sample set to obtain a trained clustering model, and classification results of the sample set are obtained on the basis of the clustering model; the method and the device realize the acquisition of the labeled data of a large number of sample sets based on a small amount of labeled data, and reduce the workload of labeling; further, randomly sampling again from the sample set after the first sampling to obtain a second sampling sample which is the same as the first sampling sample; and determining a classification result of the second sample based on the classification result of the sample set; training a current classification model by using a first sample data and a second sample data of the first sample and a classification result of each sample data, obtaining a classification model updated by current iteration, using the first sample data and the second sample data of the current iteration as a first sample data of next iteration, determining a second sample of the next iteration in the sample set based on the first sample data of the next iteration, and performing the next iteration training until an iteration stop condition is met to obtain a trained target classification model; different sample data are adopted for training on the basis of each iteration, the iteration times are reduced, and the training accuracy is improved by a loss function determined on the basis of different weights of the preset first sample data and the second sample data; therefore, based on the technical scheme, the efficiency and the accuracy of model training are improved.
Example two
Fig. 2 is a flowchart of a data classification method according to a second embodiment of the present invention, which is applicable to a case of classifying data, and is more applicable to a case of training data based on a pre-trained target classification model. The method may be performed by a data sorting apparatus, which may be implemented by means of software and/or hardware. As shown in fig. 2, the method specifically includes the following steps:
s210, obtaining data to be classified.
In the present embodiment, the data content of the data to be classified may be various, and may be, for example, user information data, for example, data to be classified including different ages and different genders; classifying the age or gender of the data to be classified by adopting a classification model; of course, sample data of other contents is also possible; in this embodiment, the data content of the data to be classified is not limited.
S220, inputting data to be classified into a pre-trained target classification model to obtain a classification result output by the target classification model; the target classification model is obtained by pre-training based on any one of the classification model training methods in the embodiments.
In this embodiment, the data to be classified is input into the target classification model according to any one of the above embodiments, so as to obtain the classification result output by the target classification model.
According to the technical scheme, the data to be classified are input into the pre-trained target classification model based on the embodiments, the classification result output by the target classification model is obtained, and the efficiency and the accuracy of data classification are improved.
The following is an embodiment of a classification model training apparatus and a data classification apparatus provided in an embodiment of the present invention, and the following apparatus and the classification model training method and the data classification method of the above embodiments belong to the same inventive concept, and details not described in detail in the embodiments of the classification model training apparatus and the data classification apparatus may refer to the embodiments of the above classification model training method and the data classification method.
EXAMPLE III
Fig. 3 is a schematic structural diagram of a classification model training apparatus according to a third embodiment of the present invention, which is applicable to training a classification model, and in particular, is more applicable to training a classification model based on a small number of labeled protectors. Referring to fig. 3, the specific structure of the classification model training apparatus includes: a sample data acquisition module 310 and a classification model training module 320; wherein the content of the first and second substances,
a sample data obtaining module 310, configured to determine, in the initial sample data, first sample data and second sample data of the current iteration;
and the classification model training module 320 is configured to train the current classification model based on the first sample data, the second sample data, and the classification result of each sample data, and obtain a classification model updated in the current iteration until an iteration stop condition is met, so as to obtain a trained target classification model.
The technical scheme of the embodiment includes that a clustering model is trained on the basis of artificial marking results and preliminary clustering results of a preset number of first sampling samples randomly sampled in a sample set to obtain a trained clustering model, and classification results of the sample set are obtained on the basis of the clustering model; the method and the device realize the acquisition of the labeled data of a large number of sample sets based on a small amount of labeled data, and reduce the workload of labeling; further, randomly sampling again from the sample set after the first sampling to obtain a second sampling sample which is the same as the first sampling sample; and determining a classification result of the second sample based on the classification result of the sample set; training a current classification model by using a first sample data and a second sample data of the first sample and a classification result of each sample data, obtaining a classification model updated by current iteration, using the first sample data and the second sample data of the current iteration as a first sample data of next iteration, determining a second sample of the next iteration in the sample set based on the first sample data of the next iteration, and performing the next iteration training until an iteration stop condition is met to obtain a trained target classification model; different sample data are adopted for training on the basis of each iteration, the iteration times are reduced, and the training accuracy is improved by a loss function determined on the basis of different weights of the preset first sample data and the second sample data; therefore, based on the technical scheme, the efficiency and the accuracy of model training are improved.
On the basis of the above embodiments, if the current iteration is the first iteration;
accordingly, the sample data acquiring module 310 includes:
the first sample data acquisition unit is used for extracting a preset number of sample data from the initial sample data to be used as first sample data;
and the second sample data acquisition unit is used for extracting a preset number of sample data from the sample data except the first sample data in the initial sample data to be used as second sample data.
On the basis of the above embodiments, the apparatus further includes:
the first classification result determining unit is used for determining first sample data and second sample data of the current iteration in initial sample data, and then taking the artificial marking data of the first sample data as the classification result of the first sample data;
a second classification result determining unit, configured to determine a classification result of the initial sample data based on the classification result of the first sample data, and determine a classification result of the second sample data based on the classification result of the initial sample data.
On the basis of the above embodiments, the classification model training module 320 includes:
a classification model output result obtaining unit, configured to obtain the first sample data and the second sample data of the current iteration, and input the first sample data and the second sample data to the current classification model to obtain an output result of the current classification model;
a classification model parameter adjusting unit, configured to use a classification result of each sample data of the current iteration as a data tag of each sample data, generate a loss function based on the data tag of the current iteration and an output result of the current classification model, and perform parameter adjustment on the current classification model based on the loss function;
and the target classification model obtaining unit is used for obtaining a trained target classification model when the training process of the current classification model meets the training stopping condition.
On the basis of the above embodiments, the loss function in the training process of the classification model includes a first loss function corresponding to first sample data and a second loss function corresponding to second sample data; the first loss function is determined based on a first weight corresponding to the first sample data, and the second loss function is determined based on a second weight corresponding to the second sample data.
The classification model training device provided by the embodiment of the invention can execute the classification model training method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
Example four
Fig. 4 is a schematic structural diagram of a data classification apparatus according to a fourth embodiment of the present invention, which is applicable to a case of classifying data, and is more applicable to a case of training data based on a pre-trained target classification model. Referring to fig. 4, the specific structure of the data classification apparatus includes: a classification data acquisition module 410 and a classification module 420; wherein the content of the first and second substances,
a classification data obtaining module 410, configured to obtain data to be classified;
the classification module 420 is configured to input the data to be classified into a pre-trained classification model, so as to obtain a classification result output by the model; wherein the classification model is obtained by pre-training based on the classification model training method of any one of claims 1 to 5.
According to the technical scheme, the data to be classified are input into the pre-trained target classification model based on the embodiments, the classification result output by the target classification model is obtained, and the efficiency and the accuracy of data classification are improved.
The data classification device provided by the embodiment of the invention can execute the data classification method provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method.
It should be noted that, in the embodiments of the classification model training apparatus and the data classification apparatus, the included units and modules are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be realized; in addition, specific names of the functional units are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present invention.
EXAMPLE five
Fig. 5 is a schematic structural diagram of an electronic device according to a fourth embodiment of the present invention. FIG. 5 illustrates a block diagram of an exemplary electronic device 12 suitable for use in implementing embodiments of the present invention. The electronic device 12 shown in fig. 5 is only an example and should not bring any limitation to the function and the scope of use of the embodiment of the present invention.
As shown in FIG. 5, electronic device 12 is embodied in the form of a general purpose computing electronic device. The components of electronic device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that couples various system components including the system memory 28 and the processing unit 16.
Bus 18 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, such architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, micro-channel architecture (MAC) bus, enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Electronic device 12 typically includes a variety of computer system readable media. Such media may be any available media that is accessible by electronic device 12 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 28 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM)30 and/or cache memory 32. The electronic device 12 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 5, and commonly referred to as a "hard drive"). Although not shown in FIG. 5, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 by one or more data media interfaces. System memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the invention.
A program/utility 40 having a set (at least one) of program modules 42 may be stored, for example, in system memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which examples or some combination thereof may comprise an implementation of a network environment. Program modules 42 generally carry out the functions and/or methodologies of the described embodiments of the invention.
Electronic device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), with one or more devices that enable a user to interact with electronic device 12, and/or with any devices (e.g., network card, modem, etc.) that enable electronic device 12 to communicate with one or more other computing devices. Such communication may be through an input/output (I/O) interface 22. Also, the electronic device 12 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the Internet) via the network adapter 20. As shown in FIG. 5, the network adapter 20 communicates with the other modules of the electronic device 12 via the bus 18. It should be appreciated that although not shown in FIG. 5, other hardware and/or software modules may be used in conjunction with electronic device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
The processing unit 16 executes a program stored in the system memory 28 to execute various functional applications and sample data acquisition, and optionally, implements the steps of a classification model training method provided in the embodiment of the present invention, where the classification model training method includes:
determining first sample data and second sample data of the current iteration in the initial sample data; the sample data size of the first sample data is the same as that of the second sample data, and the sample data is not overlapped, the first sample data is random sample data with a preset number in the first iteration or a collection of the first sample data and the second sample data in the last iteration, and the classification result of the second sample data in each iteration is determined based on the classification result of the corresponding first sample data;
and training the current classification model based on the first sample data, the second sample data and the classification result of each sample data, and obtaining the classification model updated by the current iteration until the iteration stop condition is met, thereby obtaining the trained target classification model.
Optionally, in order to implement the steps of the data classification method provided in the embodiment of the present invention, the data classification method includes:
acquiring data to be classified;
inputting the data to be classified into a pre-trained target classification model to obtain a classification result output by the target classification model; wherein the target classification model is obtained by pre-training based on the classification model training method of any one of claims 1 to 5.
Of course, those skilled in the art can understand that the processor may also implement the technical solution of the sample data obtaining method provided in any embodiment of the present invention.
EXAMPLE six
The sixth embodiment provides a computer-readable storage medium on which a computer program is stored, the program being implemented when executed by a processor. Optionally, in order to implement the steps of the classification model training method provided in the embodiment of the present invention, the classification model training method includes:
determining first sample data and second sample data of the current iteration in the initial sample data; the sample data size of the first sample data is the same as that of the second sample data, and the sample data is not overlapped, the first sample data is random sample data with a preset number in the first iteration or a collection of the first sample data and the second sample data in the last iteration, and the classification result of the second sample data in each iteration is determined based on the classification result of the corresponding first sample data;
and training the current classification model based on the first sample data, the second sample data and the classification result of each sample data, and obtaining the classification model updated by the current iteration until the iteration stop condition is met, thereby obtaining the trained target classification model.
Optionally, in order to implement the steps of the data classification method provided in the embodiment of the present invention, the data classification method includes:
acquiring data to be classified;
inputting the data to be classified into a pre-trained target classification model to obtain a classification result output by the target classification model; wherein the target classification model is obtained by pre-training based on the classification model training method of any one of claims 1 to 5.
Computer storage media for embodiments of the invention may employ any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. The computer-readable storage medium may be, for example but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It will be understood by those skilled in the art that the modules or steps of the invention described above may be implemented by a general purpose computing device, they may be centralized on a single computing device or distributed across a network of computing devices, and optionally they may be implemented by program code executable by a computing device, such that it may be stored in a memory device and executed by a computing device, or it may be separately fabricated into various integrated circuit modules, or it may be fabricated by fabricating a plurality of modules or steps thereof into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (10)

1. A classification model training method is characterized by comprising the following steps:
determining first sample data and second sample data of the current iteration in the initial sample data; the sample data size of the first sample data is the same as that of the second sample data, and the sample data is not overlapped, the first sample data is random sample data with a preset number in the first iteration or a collection of the first sample data and the second sample data in the last iteration, and the classification result of the second sample data in each iteration is determined based on the classification result of the corresponding first sample data;
and training the current classification model based on the first sample data, the second sample data and the classification result of each sample data, and obtaining the classification model updated by the current iteration until the iteration stop condition is met, thereby obtaining the trained target classification model.
2. The method of claim 1, wherein if the current iteration is the first iteration;
correspondingly, the determining the first sample data and the second sample data of the current iteration in the initial sample data includes:
extracting sample data with a preset quantity from the initial sample data to be used as first sample data;
and extracting a preset number of sample data from the sample data except the first sample data in the initial sample data to be used as second sample data.
3. The method according to claim 2, further comprising, after determining the first sample data and the second sample data of the current iteration in the initial sample data:
taking the artificial marking data of the first sample data as the classification result of the first sample data;
determining a classification result of the initial sample data based on a classification result of the first sample data, and determining a classification result of the second sample data based on a classification result of the initial sample data.
4. The method according to claim 1, wherein the training a current classification model based on the first sample data, the second sample data, and the classification result of each sample data, and obtaining the updated classification model of the current iteration until an iteration stop condition is satisfied, to obtain a trained target classification model, comprises:
acquiring first sample data and second sample data of current iteration, and inputting the first sample data and the second sample data to the current classification model to obtain an output result of the current classification model;
taking the classification result of each sample data of the current iteration as a data label of each sample data, generating a loss function based on the data label of the current iteration and the output result of the current classification model, and performing parameter adjustment on the current classification model based on the loss function;
and when the training process of the current classification model meets the training stopping condition, obtaining the trained target classification model.
5. The method according to claim 1, wherein the loss function in the training process of the classification model includes a first loss function corresponding to a first sample data and a second loss function corresponding to a second sample data; the first loss function is determined based on a first weight corresponding to the first sample data, and the second loss function is determined based on a second weight corresponding to the second sample data.
6. A method of data classification, comprising:
acquiring data to be classified;
inputting the data to be classified into a pre-trained target classification model to obtain a classification result output by the target classification model; wherein the target classification model is obtained by pre-training based on the classification model training method of any one of claims 1 to 5.
7. A classification model training apparatus, comprising:
the sample data acquisition module is used for determining first sample data and second sample data of the current iteration in the initial sample data; the sample data size of the first sample data is the same as that of the second sample data, and the sample data is not overlapped, the first sample data is random sample data with a preset number in the first iteration or a collection of the first sample data and the second sample data in the last iteration, and the classification result of the second sample data in each iteration is determined based on the classification result of the corresponding first sample data;
and the classification model training module is used for training the current classification model based on the first sample data, the second sample data and the classification result of each sample data, obtaining the classification model updated by the current iteration until the iteration stopping condition is met, and obtaining the trained target classification model.
8. A data sorting apparatus, comprising:
the classification data acquisition module is used for acquiring data to be classified;
the classification module is used for inputting the data to be classified into a pre-trained classification model to obtain a classification result output by the model; wherein the classification model is obtained by pre-training based on the classification model training method of any one of claims 1 to 5.
9. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the classification model training method of any one of claims 1-5 or the data classification method of claim 6.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the classification model training method as claimed in any one of claims 1 to 5 or the data classification method as claimed in claim 6.
CN202111127320.XA 2021-09-26 2021-09-26 Classification model training method, classification device, classification equipment and medium Pending CN113822362A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111127320.XA CN113822362A (en) 2021-09-26 2021-09-26 Classification model training method, classification device, classification equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111127320.XA CN113822362A (en) 2021-09-26 2021-09-26 Classification model training method, classification device, classification equipment and medium

Publications (1)

Publication Number Publication Date
CN113822362A true CN113822362A (en) 2021-12-21

Family

ID=78921144

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111127320.XA Pending CN113822362A (en) 2021-09-26 2021-09-26 Classification model training method, classification device, classification equipment and medium

Country Status (1)

Country Link
CN (1) CN113822362A (en)

Similar Documents

Publication Publication Date Title
US10565442B2 (en) Picture recognition method and apparatus, computer device and computer- readable medium
CN107908635B (en) Method and device for establishing text classification model and text classification
US10902300B2 (en) Method and apparatus for training fine-grained image recognition model, fine-grained image recognition method and apparatus, and storage mediums
US11640551B2 (en) Method and apparatus for recommending sample data
CN109599095B (en) Method, device and equipment for marking voice data and computer storage medium
US9619209B1 (en) Dynamic source code generation
CN107909088B (en) Method, apparatus, device and computer storage medium for obtaining training samples
CN107301248B (en) Word vector construction method and device of text, computer equipment and storage medium
US11822568B2 (en) Data processing method, electronic equipment and storage medium
US20170220327A1 (en) Dynamic source code generation
CN109815147B (en) Test case generation method, device, server and medium
CN109947924B (en) Dialogue system training data construction method and device, electronic equipment and storage medium
CN113064964A (en) Text classification method, model training method, device, equipment and storage medium
CN112308077A (en) Sample data acquisition method, image segmentation method, device, equipment and medium
CN111126487A (en) Equipment performance testing method and device and electronic equipment
CN110490304B (en) Data processing method and device
CN110647523B (en) Data quality analysis method and device, storage medium and electronic equipment
CN115563271A (en) Artificial intelligence accounting data entry method, system, equipment and storage medium
CN112989050B (en) Form classification method, device, equipment and storage medium
CN110781849A (en) Image processing method, device, equipment and storage medium
CN111124863A (en) Intelligent equipment performance testing method and device and intelligent equipment
CN111460224B (en) Comment data quality labeling method, comment data quality labeling device, comment data quality labeling equipment and storage medium
CN110363245B (en) Online classroom highlight screening method, device and system
CN110362688B (en) Test question labeling method, device and equipment and computer readable storage medium
CN110929499A (en) Text similarity obtaining method, device, medium and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination