Data generation method and apparatus, model training method and apparatus, and device and medium
By introducing the initial generation model and the initial discriminant model into the data generation model, the model parameters are adjusted based on the discriminant results and data differences during the training process, the problem of low generated data quality in the existing technology is solved, and higher quality data generation is achieved.
Patent Information
- Application Number
- PCT/CN2024/109222
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-08-28
- Filing Date
- 2024-08-01
- Publication Date
- 2025-03-06
AI Technical Summary
When generating data, it is difficult for existing data generation models to accurately reflect the differences between the generated data and the real data, resulting in low quality of the generated data.
By introducing the initial generation model and the initial discriminant model into the data generation model, the training process includes inputting the sample data into the initial generation model to obtain the generated data; inputting the generated data and the real data into the initial discriminant model to obtain the discriminant result; determining the generation model loss based on the discriminant result and the difference between the generated data and the real data, and adjusting the model parameters of the initial generation model.
It realizes a more accurate and comprehensive reflection of the degree of the generated data and the real data, improves the quality of the generated data, and makes the target generation model more accurate.
Smart Images

Figure CN2024109222_06032025_PF_FP_ABST
Abstract
Description
Data generation method, model training method, device, equipment and medium
[0001] This application claims priority to Chinese patent application No. 202311086311.X filed on August 28, 2023. The contents of the above-mentioned Chinese patent application disclosure are hereby incorporated by reference in their entirety as a part of this application. Technical Field
[0002] Embodiments of the present disclosure relate to a data generation method, a model training method, an apparatus, an electronic device, and a computer-readable storage medium. Background Art
[0003] Generative data models are a type of model based on probability theory and statistical learning, with widespread applications in predicting and simulating real-world problems. Generative models can generate data that matches the actual situation by modeling the data distribution, or analyze and process data through methods such as classification, clustering, and dimensionality reduction. For example, generative data models can be used for data generation and simulation, automatically generating new data that matches the characteristics of given data. They can be used for data augmentation, enrichment, and testing.
[0004] Summary of the Invention
[0005] At least one embodiment of the present disclosure provides a data generation method, comprising: inputting initial data into a target generation model to obtain target generation data; outputting the target generation data; wherein the target generation model is obtained by training an initial network model, the initial network model comprising an initial generation model and an initial discriminant model, and the training process comprises: inputting sample data into the initial generation model to obtain generation data; inputting the generation data and real data into the initial discriminant model to obtain a discrimination result; determining a generation model loss, wherein the generation model loss comprises a first generation loss and a second generation loss, the first generation loss being determined based on the discrimination result, the second generation loss being determined based on the generated data and the real data, the second generation loss representing the numerical difference between the generated data and the real data; and adjusting the model parameters of the initial generation model using the generation model loss.
[0006] For example, in the data generation method provided by at least one example of the above embodiments of the present disclosure, the initial data includes label data and a k-dimensional vector, the k data in the k-dimensional vector are k random values that conform to the normal distribution; the label data is used to characterize whether the target gene has mutated; the target generation data includes an r-dimensional vector, the r data in the r-dimensional vector respectively correspond to the r amino acids included in the target gene, and each data in the r-dimensional vector is used to characterize whether the corresponding amino acid has mutated; wherein k and r are positive integers.
[0007] For example, in the data generation method provided in at least one example of the above-mentioned embodiments of the present disclosure, outputting the target generation data includes: outputting the target generation data in the form of a document to a storage device; wherein the target generation data is used as sample data of other models for the training process of other models.
[0008] For example, in the data generation method provided in at least one example of the above-mentioned embodiments of the present disclosure, inputting sample data into an initial generation model to obtain generated data includes: obtaining N groups of sample data and N groups of real data corresponding to the N groups of sample data; inputting the N groups of sample data into the initial generation model to obtain N groups of generated data corresponding to the N groups of sample data. Inputting the generated data and real data into an initial discriminant model to obtain discrimination results includes: inputting the N groups of generated data and the N groups of real data into the initial discriminant model to obtain N first discrimination results corresponding to the N groups of generated data and N second discrimination results corresponding to the N groups of real data; wherein N is a positive integer.
[0009] For example, in the data generation method provided by at least one example of the above-mentioned embodiments of the present disclosure, determining the generation model loss includes: determining a first generation loss based on the N first discrimination results; determining a second generation loss based on the N groups of generated data and the N groups of real data, wherein the second generation loss characterizes the difference between the N groups of generated data and the N groups of real data; and determining the generation model loss based on the first generation loss and the second generation loss.
[0010] For example, in the data generation method provided by at least one example of the above-mentioned embodiments of the present disclosure, the training process also includes: determining the discriminant model loss based on the N first discriminant results and the N second discriminant results; and adjusting the model parameters of the initial discriminant model based on the discriminant loss.
[0011] For example, in the data generation method provided by at least one example of the above-mentioned embodiments of the present disclosure, determining the second generation loss based on the N groups of generated data and the N groups of real data includes: determining a first sub-loss based on the N groups of generated data and the N groups of real data, wherein the first sub-loss characterizes the numerical distance between the N groups of generated data and the N groups of real data; and / or determining a second sub-loss based on the features of the N groups of generated data and the features of the N groups of real data, wherein the second sub-loss characterizes the degree of similarity between the features of the N groups of generated data and the features of the real data; wherein the second generation loss includes the first sub-loss and / or the second sub-loss.
[0012] For example, in the data generation method provided by at least one example of the above-mentioned embodiments of the present disclosure, each group of sample data includes first label data and a k-dimensional vector; each group of real data includes second label data and an r-dimensional vector; each group of generated data includes the r-dimensional vector output by the initial generation model and the first label data in the corresponding sample data; the first label data in each group of sample data is the same as the second label data in the corresponding group of real data; wherein k and r are both positive integers.
[0013] For example, in the data generation method provided by at least one example of the above embodiments of the present disclosure, the k data in the k-dimensional vector are k random values that conform to the normal distribution; the r data in the r-dimensional vector respectively correspond to the r amino acids included in the target gene, and each data in the r-dimensional vector is used to characterize whether the corresponding amino acid has mutated; the first label data and the second label data are used to characterize whether the target gene has mutated.
[0014] For example, in the data generation method provided by at least one example of the above embodiments of the present disclosure, the first sub-loss represents the distance between the r-dimensional vectors of the N groups of generated data and the r-dimensional vectors of the N groups of real data; based on the N groups of generated data and the N groups of real data, the first sub-loss is determined, including: calculating the vector difference between the r-dimensional vector of each group of the generated data and the r-dimensional vector of the corresponding real data; and determining the first sub-loss based on the N vector differences corresponding to the N groups of generated data.
[0015] For example, in the data generation method provided by at least one example of the above-mentioned embodiments of the present disclosure, the characteristics of the generated data include the numerical characteristics of r data in the r-dimensional vector of the generated data, and the characteristics of the real data include the numerical characteristics of r data in the r-dimensional vector of the real data; the r data in the r-dimensional vector of the real data are composed of p kinds of numerical values; the second sub-loss characterizes the degree of closeness of the numerical value of each data in the r-dimensional vector of the N groups of generated data to the p kinds of numerical values.
[0016] For example, in the data generation method provided by at least one example of the above-mentioned embodiments of the present disclosure, the second sub-loss is determined based on the characteristics of the N groups of generated data and the characteristics of the N groups of real data, including: for each group of the generated data, determining the degree of numerical proximity between the numerical value of each data in the r-dimensional vector of the generated data and the p kinds of numerical values, wherein the degree of proximity between the numerical value of the data and the p kinds of numerical values is represented by the minimum value of the absolute values of the differences between the numerical value of the data and the p kinds of numerical values; based on the degree of numerical proximity between the numerical value of each data in the r-dimensional vector of each group of the generated data and the p kinds of numerical values, determining the degree of proximity between the numerical value of each group of the generated data and the p kinds of numerical values; based on the degree of numerical proximity between the numerical value of the N groups of generated data and the p kinds of numerical values, determining the second sub-loss.
[0017] For example, in the data generation method provided by at least one example of the above-mentioned embodiments of the present disclosure, the discrimination result output by the initial discriminant model is the probability that a set of data input into the initial discriminant model belongs to real data; the discrimination result output by the initial discriminant model is a numerical value greater than or equal to 0 and less than or equal to 1, and the closer the discrimination result is to 1, the closer the set of data input into the initial discriminant model is to real data.
[0018] For example, in the data generation method provided by at least one example of the above-mentioned embodiments of the present disclosure, determining the first generation loss based on the N first discrimination results includes: determining the first generation loss according to the degree of closeness of each first discrimination result in the N first discrimination results to the numerical value 1, wherein the closer the N first discrimination results are to the numerical value 1, the closer the first generation loss is to the numerical value 0.
[0019] For example, in the data generation method provided in at least one example of the above-mentioned embodiments of the present disclosure, the discriminant model loss is determined based on the N first discrimination results and the N second discrimination results, including: determining the discriminant model loss according to the degree of closeness of each first discrimination result in the N first discrimination results to the numerical value 1 and the degree of closeness of each second discrimination result in the N second discrimination results to the numerical value 1, wherein the closer the N second discrimination results are to the numerical value 1 and the closer the N first discrimination results are to the numerical value 0, the smaller the discriminant model loss.
[0020] For example, in the data generation method provided by at least one example of the above embodiments of the present disclosure, determining the generation model loss also includes: calculating the weighted sum of the first generation loss, the first sub-loss and the second sub-loss as the generation model loss.
[0021] For example, in the data generation method provided by at least one example of the above-mentioned embodiments of the present disclosure, the initial generation model includes a plurality of blocks connected in sequence, each of the blocks including a linear mapping layer, a normalization layer, and an activation layer; the plurality of blocks are used to adjust the dimension of the sample data to obtain generated data with a target dimension.
[0022] At least one embodiment of the present disclosure provides a model training method, comprising: inputting sample data into an initial generative model to obtain generated data; inputting the generated data and real data into an initial discriminant model to obtain a discrimination result; determining a generative model loss, wherein the generative model loss includes a first generative loss and a second generative loss, the first generative loss being determined based on the discrimination result, the second generative loss being determined based on the generated data and the real data, the second generative loss representing the gap between the generated data and the real data; and adjusting model parameters of the initial generative model using the generative model loss.
[0023] At least one embodiment of the present disclosure provides a data generation device, including a target generation module and an output module, the target generation module is configured to input initial data into a target generation model to obtain target generation data; the output module is configured to output the target generation data; wherein the target generation model is obtained by training an initial network model, the initial network model includes an initial generation model and an initial discriminant model, and the training process includes: inputting sample data into the initial generation model to obtain generated data; inputting the generated data and real data into the initial discriminant model to obtain a discrimination result; determining a generation model loss, wherein the generation model loss includes a first generation loss and a second generation loss, the first generation loss is determined based on the discrimination result, the second generation loss is determined based on the generated data and the real data, and the second generation loss represents the numerical difference between the generated data and the real data; and using the generation model loss to adjust the model parameters of the initial generation model.
[0024] At least one embodiment of the present disclosure provides an electronic device, comprising a processor; a memory storing one or more computer program modules; wherein the one or more computer program modules are configured to be executed by the processor to implement the data generation method or model training method provided in any embodiment of the present disclosure.
[0025] At least one embodiment of the present disclosure provides a computer-readable storage medium storing non-transitory computer-readable instructions. When the non-transitory computer-readable instructions are executed by a computer, the data generation method or model training method provided by any embodiment of the present disclosure can be implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings of the embodiments will be briefly introduced below. Obviously, the drawings in the following description only relate to some embodiments of the present disclosure, rather than limiting the present disclosure.
[0027] FIG1 shows a flow chart of a model training method provided by at least one embodiment of the present disclosure;
[0028] FIG2 shows a training flow chart of an initial network model provided by at least one embodiment of the present disclosure;
[0029] FIG3 shows a schematic diagram of an initial generation model provided by at least one embodiment of the present disclosure;
[0030] FIG4 shows a schematic diagram of an initial discriminant model provided by at least one embodiment of the present disclosure;
[0031] FIG5 shows a flowchart of determining a second generation loss according to at least one embodiment of the present disclosure;
[0032] FIG6 shows a flow chart of a data generation method provided by at least one embodiment of the present disclosure;
[0033] FIG7A shows a schematic block diagram of a data generating device provided by at least one embodiment of the present disclosure;
[0034] FIG7B shows a schematic block diagram of a model training device provided by at least one embodiment of the present disclosure.
[0035] FIG8A shows a schematic block diagram of an electronic device provided by at least one embodiment of the present disclosure;
[0036] FIG8B shows a schematic block diagram of another electronic device provided by at least one embodiment of the present disclosure; and
[0037] FIG9 shows a schematic diagram of a computer-readable storage medium provided by at least one embodiment of the present disclosure. DETAILED DESCRIPTION
[0038] To make the purpose, technical solutions, and advantages of the embodiments of the present disclosure more clear, the technical solutions of the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings of the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the described embodiments of the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.
[0039] Unless otherwise defined, the technical or scientific terms used in this disclosure should have the usual meanings understood by people with ordinary skills in the field to which this disclosure belongs. The words "first", "second" and similar words used in this disclosure do not indicate any order, quantity or importance, but are only used to distinguish different components. Similarly, words such as "one", "an" or "the" do not indicate a quantity limitation, but rather indicate the existence of at least one. Words such as "include" or "comprise" mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects. Words such as "connect" or "connected" are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the object being described changes, the relative positional relationship may also change accordingly.
[0040] Data generation models include Generative Adversarial Network (GAN), which is a generative machine learning model that is widely used in various industries and can be used to create fictional data, images, text, etc.
[0041] Generative adversarial networks can be used to generate medical data. For example, the gene encoding TP53, located on human chromosome 17P13, is a key tumor suppressor gene that controls excessive cell growth and proliferation in the human body, thereby maintaining normal life. If certain stimuli or carcinogenic factors cause the tumor suppressor gene to lose its control, it can no longer prevent cells from becoming malignant, often leading to the development of tumors. Therefore, TP53 mutation patterns can be used to estimate the probability of tumor development. However, due to privacy concerns and other factors, insufficient mutation data is often available for research, making automated mutation data generation crucial. Using generative models such as generative adversarial networks to generate mutation data can address the problem of insufficient mutation data required for research.
[0042] Generative adversarial networks (GANs) consist of a generator (called a generator) that creates synthetic virtual data (hereafter referred to as generated data), while the discriminator (called a discriminator) determines whether its input data is real data or virtual data created by the generator. By training the generator and discriminator, the generator can be made to mimic real data, i.e., the virtual data created by the generator is close to real data, reaching a level where the discriminator has difficulty classifying the input data as virtual data or real data.
[0043] During the training process of a generative adversarial network, a loss function is used to calculate the model loss, and the parameters of the generator and discriminator are then adjusted based on the model loss. The loss function can be a function related to the discriminator's output, that is, the discriminator's output is used to calculate the model loss. However, the model loss calculated in this way cannot accurately reflect the gap between the virtual data produced by the generator and the real data, resulting in low quality of the data generated by the trained generator.
[0044] At least one embodiment of the present disclosure provides a data generation method and device, a model training method and device, an electronic device, and a computer-readable storage medium. The data generation method includes: inputting initial data into a target generation model to obtain target generation data; and outputting the target generation data. The target generation model is obtained by training an initial network model, and the initial network model includes an initial generation model and an initial discriminant model. The training process includes: inputting sample data into the initial generation model to obtain generated data; inputting the generated data and the real data into the initial discriminant model to obtain a discrimination result; determining the generation model loss, wherein the generation model loss includes a first generation loss and a second generation loss, the first generation loss is determined based on the discrimination result, the second generation loss is determined based on the generated data and the real data, and the second generation loss represents the numerical difference between the generated data and the real data; and adjusting the model parameters of the initial generation model using the generation model loss.
[0045] According to at least one embodiment of the present disclosure, a first generation loss is calculated based on the discrimination result of the initial discriminant model, a second generation loss is calculated based on the real data and the generated data, and a generation model loss is calculated based on the first generation loss and the second generation loss. This generation model loss can not only reflect the probability that the generated data is judged to be real data, but also reflect the numerical difference between the generated data and the real data, so that the generation model loss more accurately and comprehensively reflects the closeness between the generated data and the real data. Using this generation model loss to adjust the generation model parameters can make the final target generation model more accurate, the data generated by the target generation model closer to the real data, and improve data quality.
[0046] For ease of understanding, the following first describes the model training method, and then describes the data generation method performed using the trained generative model.
[0047] FIG1 shows a flowchart of a model training method provided by at least one embodiment of the present disclosure.
[0048] As shown in FIG. 1 , the method may include steps S110 to S140 .
[0049] Step S110: inputting sample data into the initial generation model to obtain generated data;
[0050] Step S120: inputting the generated data and the real data into the initial discriminant model to obtain the discrimination result;
[0051] Step S130: Determine a generation model loss, wherein the generation model loss includes a first generation loss and a second generation loss, the first generation loss is determined based on the discrimination result, the second generation loss is determined based on the generated data and the real data, and the second generation loss represents the gap between the generated data and the real data;
[0052] Step S140: using the generative model loss to adjust the model parameters of the initial generative model.
[0053] For example, before executing step S110, multiple sets of sample data and multiple sets of real data corresponding to the multiple sets of sample data can be obtained. The specific values of the sample data and the real data can be determined according to actual conditions.
[0054] For example, in step S110, the initial network model is trained multiple times using the multiple sets of sample data and the multiple sets of real data to obtain a trained target network model. For example, the initial network model is trained multiple times until the model converges or the number of training times reaches a predetermined number, and the initial network model obtained from the last training is used as the target network model. Each training process may include the above steps S110 to S140.
[0055] For example, the initial network model includes an initial generative model (a generative model may also be called a generator) and an initial discriminative model (a discriminative model may also be called a discriminator), and the target network model includes a target generative model and a target discriminative model, wherein the target generative model is obtained by training the initial generative model, and the target discriminative model is obtained by training the initial discriminative model. For example, the initial network model and the target network model may be generative adversarial models.
[0056] For example, step S110 may include: inputting N groups of sample data into the initial generation model respectively, and obtaining N groups of generated data corresponding to the N groups of sample data respectively.
[0057] For example, step S120 may include: inputting the N groups of generated data and the N groups of real data corresponding to the N groups of sample data into the initial discriminant model respectively, obtaining N first discriminant results corresponding to the N groups of generated data and N second discriminant results corresponding to the N groups of real data respectively; wherein N is a positive integer.
[0058] For example, each training process may further include: determining a discriminant model loss, and adjusting model parameters of the initial discriminant model using the discriminant model loss, where the discriminant model loss is determined based on the discrimination results of the initial discriminant model. For example, during each training process, the discriminant model loss is determined based on N first discrimination results and N second discrimination results; and the model parameters of the initial discriminant model are adjusted based on the discriminant loss.
[0059] For example, the training of the initial generative model and the training of the initial discriminative model can be interspersed. For example, the initial generative model can be fixed first, and the initial discriminative model can be trained using the stochastic gradient descent algorithm using the discriminative model loss until the number of training times reaches 5. Then, the initial discriminative model can be fixed, and the initial generative model can be trained using the stochastic gradient descent algorithm using the generative model loss once. This cycle can be repeated until the number of training times reaches a predetermined number (e.g., 500 times) or the model converges.
[0060] For example, sample data is the input data for a generative model. The amount and data type of the sample data can be determined based on the actual application scenario. For example, if you want to use a generative model to generate image data, the sample data can be image data, which can include pixel coordinate attributes and color attributes. If you want to use a generative model to generate gene mutation data, since gene mutation data can be multidimensional vectors, the sample data can also be multidimensional vectors.
[0061] FIG2 shows a flowchart of training an initial network model provided by at least one embodiment of the present disclosure.
[0062] As shown in FIG2 , each set of sample data may include, for example, first label data (denoted by y i denoted) and k-dimensional vector (denoted by z i represents), i is a positive integer less than or equal to N.
[0063] For example, a k-dimensional vector may include k sequentially arranged data. In some embodiments, the k-dimensional vector may be high-dimensional noise generated by a standard normal distribution. For example, the k data in the k-dimensional vector may be k random values that conform to a normal distribution, such as [0.1, 0.06, …, 0.2]. k is a positive integer and may be a value greater than 1, such as 100.
[0064] For example, each set of real data includes the second label data (denoted by y i denoted) and r-dimensional vectors (denoted by x i For example, the real data is the data collected in real time. In the application scenario of generating gene mutation data, the r-dimensional vector in each set of real data can be the target gene amino acid sequence extracted from individuals with mutations in the target gene. For example, the r-dimensional vector (x i) can correspond to the r amino acids included in the target gene, and the r-dimensional vector (x i ) is used to indicate whether the corresponding amino acid has mutated. For example, the TP53 gene contains 393 amino acids. Correspondingly, each set of real data can include a 393-dimensional vector (i.e., r = 393). Each dimension in the 393-dimensional vector corresponds to a corresponding amino acid. If the amino acid corresponding to a data in the 393-dimensional vector has mutated, the value of the data can be equal to 1, indicating that the corresponding amino acid has mutated. Otherwise, the value of the data can be equal to 0, indicating that the corresponding amino acid has not mutated.
[0065] For example, the second label data is used to reflect the overall situation or overall state of the real data. For example, in the application scenario of generating gene mutation data, the second label data is used to characterize whether the target gene has mutated, that is, to reflect whether the target gene as a whole has mutated. If each amino acid in the target gene has not mutated, it means that the target gene as a whole has not mutated, and the corresponding second label data can be represented by a value of 0 (or a value of 00, etc.). If one or more amino acids in the target gene have mutated, it means that the target gene as a whole has mutated, and the corresponding first label data and second label data can be represented by a value of 1 (or a value of 01, etc.). Therefore, the r-dimensional vector in the real data can reflect the mutation of each amino acid in the target gene, and the second label data can reflect the mutation of the target gene as a whole. The second label data in each set of real data corresponds to the r-dimensional vector. When the r-dimensional vector represents that one or some amino acids of the target gene have mutated, the value of the second label data also represents that the target gene has mutated.
[0066] For example, the first label data serves the same purpose as the second label data, also used to indicate whether the target gene has mutated. The first label data represents the gene mutation property of the generated data that the generative model is intended to generate. If the generative model is intended to generate generated data with gene mutations, the first label data can be set to 01. If the generative model is intended to generate generated data without gene mutations, the first label data can be set to 00.
[0067] For example, in some embodiments, N groups of sample data can correspond to N groups of real data respectively, and the first label data in each group of sample data can be determined based on the second label data in the corresponding group of real samples. The first label data in each group of sample data can be the same as the second label data in the corresponding group of real data, that is, the label data in the corresponding group of sample data and the group of real data are the same. If the value of the second label data in a group of real data is 00, then the value of the first label data in the corresponding group of sample data is also 00, both indicating that the target gene has not mutated. If the value of the second label data in a group of real data is 01, then the value of the first label data in the corresponding group of sample data is also 01, both indicating that the target gene has mutated.
[0068] For example, by setting label data (first label data and second label data), the situation or state of the real data can be reflected as a whole, which is conducive to enabling the generation model to generate data with corresponding characteristics based on different label data, thereby improving the accuracy of the model.
[0069] As shown in Figure 2, for example, a set of sample data is input into the initial generation model, and the initial generation model can output an r-dimensional vector (denoted by x i ` indicates), the r-dimensional vector (x i `) and the first label data (y i ) forms a set of generated data, that is, each set of generated data includes the r-dimensional vector (xi`) output by the initial generation model and the first label data (y i ). N groups of sample data {(z1,y1),(z2,y2),(z3,y3),…,(z N ,y N )} are input into the initial generation model in sequence, and the initial generation model outputs N r-dimensional vectors {x1`,x2`,x3`,…,x N `}, the N r-dimensional vectors (x i `) are spliced with the first label data respectively, and N groups of generated data {(x1`,y1),(x2`,y2),(x3`,y3),…,(x N `,y N )}.
[0070] For example, the initial generative model may include a plurality of blocks connected in sequence, each block including a linear mapping layer, a normalization layer, and an activation layer. The plurality of blocks are used to adjust the dimension of the sample data to obtain generated data with a target dimension.
[0071] FIG3 shows a schematic diagram of an initial generation model provided by at least one embodiment of the present disclosure.
[0072] As shown in Figure 3, the initial generative model includes multiple blocks (e.g., block1 to block5), each of which can be represented as block(input dimension, output dimension), where the input dimension is the dimension of the input data of the block, and the output dimension is the dimension of the output data of the block. For example, the initial generative model can include block(102,128)->block(128,256)->block(256,512)->block(512,1024)->block(1024,393)->sigmoid(), where -> indicates the direction of data flow, i.e., the output of the previous block is used as the input of the next block, and sigmoid() indicates the sigmoid function. The 102 in the first block (102,128) is the sample data z i and the first label data y i The dimension after splicing, sample data z i The dimension is 100, the first label data y i Using one-hot encoding, the dimension is, for example, 2, so the dimension of the concatenated vector is 102.
[0073] For example, each block in the initial generation model can include a linear mapping layer (input dimension, output dimension), a normalization layer, and an activation layer (for example, LeakyRelu). The input dimension and output dimension of the block are determined by the input dimension and output dimension of the linear mapping layer. The linear mapping layer maps the input data from the input dimension to the output dimension, and the normalization layer normalizes the data so that all features have the same mean and variance. For example, batch normalization can be used.
[0074] For example, the initial discriminant model can be used to determine whether the input is real data or generated data generated by the initial generation model. A set of generated data is input into the initial discriminant model, and the initial discriminant model can output a first discrimination result (with symbol o i ` indicates), a set of real data is input into the initial discriminant model, and the initial discriminant model can output a second discriminant result (with the symbol o i The discrimination results (the first discrimination results and the second discrimination results) may represent the probability that a set of data input into the initial discrimination model is true data. The discrimination results (the first discrimination results and the second discrimination results) may be values greater than or equal to 0 and less than or equal to 1. The closer the discrimination results are to 1, the closer the set of data input into the initial discrimination model is to true data.
[0075] For example, the generative model can be represented by symbol G, and the discriminative model can be represented by symbol D. In the following embodiments, x i `Also expressed as G(z i ,y i), o i Also expressed as D((x i ,y i ))、D((x i `,y i )) or D((G(z i ,y i ),y i )).
[0076] For example, N groups of generated data generated by the initial generation model can be sequentially input into the initial discrimination model to obtain N first discrimination results {o1`, o2`, o3`, ..., o N `}, and N groups of real data can be sequentially input into the initial discriminant model to obtain N second discriminant results {o1, o2, o3, ..., o N}.
[0077] FIG4 shows a schematic diagram of an initial discriminant model provided by at least one embodiment of the present disclosure.
[0078] As shown in Figure 4, the initial discriminant model may include a linear mapping layer (395, 512) -> LeakyRelu activation layer -> a linear mapping layer (512, 256) -> LeakyRelu activation layer -> a linear mapping layer (256, 1) -> sigmoid(), where the input dimension 395 is the generated data (x i `,y i ) and the real data (x i ,y i ) dimension (393+2=395).
[0079] For example, during each training process, after obtaining N first discrimination results, a first generation loss (denoted by the symbol G_loss1) can be determined based on the N first discrimination results. Furthermore, based on the N sets of generated data and the N sets of real data, a second generation loss is determined, where the second generation loss represents the numerical difference between the N sets of generated data and the N sets of real data. Based on the first generation loss and the second generation loss, a generation model loss G_loss is determined.
[0080] For example, the first generation loss can reflect the probability that the generated data belongs to the real data. The second generation loss is calculated based on the generated data and the real data and can reflect the numerical difference between the generated data and the real data. This numerical difference can be the distance between the values or the similarity between the features of the values.
[0081] For example, determining the second generation loss based on the generated data and the real data may be based on the r-dimensional vector in the generated data and the r-dimensional vector in the real data to calculate the second generation loss, and the second generation loss is used to reflect the numerical difference between the r-dimensional vector in the generated data and the r-dimensional vector in the real data. For example, in some embodiments, the second generation loss may reflect the N r-dimensional vectors x in the N sets of generated data. i `, x2`, x3`, ..., x N ` and N r-dimensional vectors x in N sets of real data i , x2, x3, …, x N In some other embodiments, the second generation loss may reflect the N r-dimensional vectors x in the N sets of generated data. i `, x2`, x3`, ..., x N The similarity between the data features of ` and the data features of the r-dimensional vector in the real data.
[0082] According to an embodiment of the present disclosure, a first generation loss is calculated based on the discrimination result of the initial discriminant model, a second generation loss is calculated based on the real data and the generated data, and a generation model loss is calculated based on the first generation loss and the second generation loss. The generation model loss can not only reflect the probability that the generated data is judged to be real data, but also reflect the numerical difference between the generated data and the real data, so that the generation model loss more accurately and comprehensively reflects the degree of closeness between the generated data and the real data. Using this generation model loss to adjust the generation model parameters can make the final target generation model more accurate, the data generated by the target generation model closer to the real data, and improve data quality.
[0083] FIG5 shows a flowchart of determining a second generation loss according to at least one embodiment of the present disclosure.
[0084] As shown in FIG. 5 , for example, the process of determining the second generation loss may include step S131 and / or step S132 .
[0085] Step S131: Based on N sets of generated data and N sets of real data, determine a first sub-loss (represented by reconstruction_loss), where the first sub-loss represents the numerical distance between the N sets of generated data and the N sets of real data.
[0086] Step S132: Based on the features of N sets of generated data and N sets of real data, determine the second sub-loss (using structure_loss or structure loss ), wherein the second sub-loss characterizes the similarity between the features of the N groups of generated data and the features of the real data.
[0087] For example, the second generation loss may include a first sub-loss (restruction_loss) and / or a second sub-loss (structure_loss).
[0088] For example, in step S131, the first sub-loss (restruction_loss) can represent the distance between the r-dimensional vectors of N sets of generated data and the r-dimensional vectors of N sets of real data, which can be determined using Manhattan distance (also known as L1 distance), for example.
[0089] For example, the vector difference G(z) between the r-dimensional vector of each set of generated data and the r-dimensional vector of the corresponding real data can be calculated. i ,y i )-x i Based on the N vector differences corresponding to the N sets of generated data, the first sub-loss (restruction_loss) is determined. By calculating the vector difference between the multidimensional data of the generated data and the multidimensional data of the real data, and using this vector difference to calculate the distance between the two types of data, the distance calculation between the multidimensional vectors of the generated data and the multidimensional vectors of the real data is achieved.
[0090] For example, the calculation formula of the first sub-loss (restruction_loss) can be as follows (1):
[0091] Among them, z i ~p z (z) represents z i Sampling is from Gaussian distribution, |.| is L1 norm, Indicates the N |G(z i ,y i )-x i |The expected value of |G(z i ,y i )-x i The smaller | is, the smaller the first sub-loss (restruction_loss) is and the closer it is to 0.
[0092] For example, in other embodiments of the present disclosure, other types of data distances may also be used for calculation, such as Euclidean distance, Minn distance, etc.
[0093] For example, the first sub-loss is determined by the distance between the generated data and the real data. The first sub-loss is part of the generative model loss, so that the generative model loss can also reflect the distance between the generated data and the real data. The generative model trained using the generative model loss can make the distance between the data generated by the generative model and the real data smaller (for example, consisting of values 0 and 1), making the generated data closer to the real data.
[0094] For example, in step S132 , the features of the generated data include the numerical features of r data in the r-dimensional vector of the generated data, and the features of the real data include the numerical features of r data in the r-dimensional vector of the real data.
[0095] For example, numerical features can be numerical composition features (e.g., what types of numerical values it is composed of), numerical change trend features (e.g., gradually increasing or gradually decreasing), etc. In the application scenario of generating gene mutation data, numerical composition features are used to reflect the characteristics of the data.
[0096] For example, the r data in the r-dimensional vector of the real data are composed of p values (value 0 and value 1). The second sub-loss (structure_loss) represents the degree of closeness of the value of each data in the r-dimensional vector of the N sets of generated data to the p values.
[0097] For example, the r data in the r-dimensional vector of real data consists of two values: 0 and 1. A value of 0 indicates that the corresponding amino acid has not mutated, and a value of 1 indicates that the corresponding amino acid has mutated. The second sub-loss (structure_loss) represents the degree to which each value in the r-dimensional vector of the N sets of generated data is close to 0 and 1.
[0098] For example, the more similar the generated data's features are to the real data, the more likely it is that the generated data comes from the real data distribution. In the scenario of generating mutation data, since the real data is a representation vector of the TP53 gene, and each dimension of the vector corresponds to the amino acid at the corresponding position in the TP53 gene, the r-dimensional vector of the real data is composed of values 0 and 1. Therefore, each dimension of the r-dimensional vector of the generated data is also expected to contain values 0 and 1, rather than other numbers such as 0.5 and 0.2.
[0099] For example, step S132 may include: for each group of generated data, determining the degree of numerical proximity between the numerical value of each data in the r-dimensional vector of the generated data and p kinds of numerical values (for example, 0 and 1), wherein the degree of proximity between the numerical value of the data and the p kinds of numerical values (for example, 0 and 1) is represented by the minimum value of the absolute values of the differences between the numerical value of the data and the p kinds of numerical values; based on the degree of numerical proximity between the numerical value of each data in the r-dimensional vector of each group of generated data and the p kinds of numerical values, determining the degree of proximity between the numerical value of each group of generated data and the p kinds of numerical values; based on the degree of proximity between the numerical values of the N groups of generated data and the p kinds of numerical values, determining the second sub-loss (structure_loss).
[0100] For example, the calculation formula of the second sub-loss (structure_loss) may include the following formulas (2) and (3):
[0101] Among them, |.| 2 is the L2 norm, x n ` represents the r-dimensional vector x i The nth digit value in |1-x n `| represents x n `The absolute value of the difference from the value 1, |x n `| 2 for|x n `-0| 2 , indicating x n `The absolute value of the difference from the value 0. min(|x′ n | 2 ,|1-x′ n | 2 ) means |x n `| 2 and |1-x n `| 2 The smaller value of min(|x′ n | 2 ,|1-x′ n | 2 ) can also be expressed as (min(|x n `|,|x n `-0|)) 2 ,min(|x′ n | 2 ,|1-x′ n | 2 ) can be used to represent the r-dimensional vector x iThe degree of closeness between the value of each data and the p values (such as 0 and 1). 393 represents the amount of data contained in the r-dimensional vector (for example, r = 393), and f(x`) can be used to represent the degree of closeness between the value of each set of generated data and the p values. loss represents the second child loss, It means that N f(G(z i ,y i )). For example, x n `The closer to 0 or 1, the min(|x′ n | 2 ,|1-x′ n | 2 ) approaches 0, f(x`) approaches 0, and the second sub-loss (structure_loss) also approaches 0.
[0102] For example, the second sub-loss is determined by the difference in numerical features between the generated data and the real data. The second sub-loss is part of the generative model loss. Therefore, the generative model loss can reflect the degree of similarity between the numerical features of the generated data and the numerical features of the real data. The generative model trained using the generative model loss can enable the data generated by the generative model to have numerical features similar to the real data (for example, consisting of numerical values 0 and 1), making the generated data closer to the real data.
[0103] For example, for the first generation loss (G_loss1), the first generation loss (G_loss1) can be determined based on the degree of closeness of each first discrimination result in the N first discrimination results to the value 1, wherein the closer the N first discrimination results are to the value 1, the closer the first generation loss is to the value 0.
[0104] For example, the expectation for a generative model is that the data it generates resembles real data as closely as possible. In other words, the initial generative model is trained to increase the probability that the discriminant model will identify the generated data as real data. A value of 1 represents a 100% probability. The closer the first discriminant result is to 1, the closer the first generation loss is to 0, indicating that the generated data is closer to real data. Therefore, it is desirable for the first generation loss to be as close to 0 as possible.
[0105] For example, the calculation formula of the first generation loss (G_loss1) can be as follows (4):
[0106] in, represents the N logD((G(z i ,y i ),y i)). For example, D((G(z i ,y i ), y i )) is closer to 1, logD((G(z i ,y i ), y i The closer )) is to 0, the smaller the first generation loss (G_loss1) is and the closer it is to 0.
[0107] For example, after calculating the first generation loss (G_loss1), the first sub-loss (restruction_loss) and the second sub-loss (structure_loss), the weighted sum of the first generation loss (G_loss1), the first sub-loss (restruction_loss) and the second sub-loss (structure_loss) can be calculated as the generation model loss (G_loss).
[0108] For example, the calculation formula of the generative model loss (G_loss) can be as follows (5): G_loss = G_loss1 + a × reconstruction_loss + b × structure_loss (5)
[0109] Among them, a and b are weight coefficients.
[0110] For example, during training, the generative model loss G_loss is used to adjust the model parameters of the initial generative model so that the generated generative model loss G_loss continuously decreases and approaches 0. This continuously decreases and approaches 0, indicating that the first generative loss (G_loss1), the first sub-loss (restruction_loss), and the second sub-loss (structure_loss) each continuously decrease and approach 0. The closer the first generative loss approaches 0, the higher the probability that the generated data is true data. The closer the first sub-loss approaches 0, the smaller the distance between the generated data and the true data. The closer the second sub-loss approaches 0, the higher the similarity between the data features of the generated data and the true data. For example, the values of the r-dimensional vector of the generated data are closer to 0 and 1. Therefore, the generative model loss G_loss can train the initial generative model from the above three aspects, so that the data generated by the trained target generative model can be close to the true data in all three aspects.
[0111] For example, for the discriminative model loss (using D_loss or D lossdenoted), the discrimination model loss (D_loss) can be determined according to the degree of proximity of each first discrimination result in the N first discrimination results to the value 1 and the degree of proximity of each second discrimination result in the N second discrimination results to the value 1, wherein the closer the N second discrimination results are to the value 1 and the closer the N first discrimination results are to the value 0, the smaller the discrimination model loss.
[0112] For example, since the discriminant model's function is to distinguish generated data from real data, the goal of training the discriminant model is to make it increasingly accurate in distinguishing generated data from real data. A value of 1 represents a 100% probability. The closer the first discriminant result is to 0, the smaller the discriminant model loss (e.g., closer to negative infinity), indicating that generated data is less likely to be discriminated as real data. The closer the second discriminant result is to 1, the smaller the discriminant model loss (e.g., closer to 0), indicating that real data is more likely to be discriminated as real data. Therefore, it is desirable to minimize the discriminant model loss.
[0113] For example, the calculation formula of the discriminant model loss can be as follows (5):
[0114] Among them, D((x i ,y i )) is closer to 1, the more i ,y i )) is closer to 0, D((G(z i ,y i ), y i )) is closer to 0, the i ,y i ), y i The closer )) is to negative infinity, the closer the loss of the discriminant model is to negative infinity.
[0115] For example, the above-mentioned discriminant model loss is used to train the initial discriminant model. The direction of training is to make the discriminant model loss increasingly approach negative infinity, so that the target discriminant model obtained by training can accurately distinguish between real data and virtual data generated by the model.
[0116] At least one embodiment of the present disclosure provides a data generation method.
[0117] FIG6 shows a flowchart of a data generation method provided by at least one embodiment of the present disclosure.
[0118] As shown in FIG6 , the data generating method includes steps S610 to S620 .
[0119] Step S610: Input the initial data into the target generation model to obtain target generation data.
[0120] Step S620: Output target generation data.
[0121] The target generation model is obtained by training the initial network model, which includes an initial generation model and an initial discriminant model. The training process includes: inputting sample data into the initial generation model to obtain generated data; inputting the generated data and real data into the initial discriminant model to obtain the discrimination result; determining the generation model loss, wherein the generation model loss includes a first generation loss and a second generation loss, the first generation loss is determined based on the discrimination result, the second generation loss is determined based on the generated data and the real data, and the second generation loss represents the numerical difference between the generated data and the real data; and using the generation model loss to adjust the model parameters of the initial generation model.
[0122] For example, the target generation model can be obtained through the model training method of at least one embodiment of the present disclosure. For details, please refer to the above-mentioned model training method, which will not be repeated here.
[0123] According to at least one embodiment of the present disclosure, a first generation loss is calculated based on the discrimination result of the initial discriminant model, a second generation loss is calculated based on the real data and the generated data, and a generation model loss is calculated based on the first generation loss and the second generation loss. This generation model loss can not only reflect the probability that the generated data is judged to be real data, but also reflect the numerical difference between the generated data and the real data, so that the generation model loss more accurately and comprehensively reflects the closeness between the generated data and the real data. Using this generation model loss to adjust the generation model parameters can make the final target generation model more accurate, the data generated by the target generation model closer to the real data, and improve data quality.
[0124] For example, the initial data includes label data and a k-dimensional vector, the k data in the k-dimensional vector are k random values that conform to the normal distribution, the label data is used to characterize whether the target gene has mutated, the target generation data includes an r-dimensional vector, the r data in the r-dimensional vector respectively correspond to the r amino acids included in the target gene, and each data in the r-dimensional vector is used to characterize whether the corresponding amino acid has mutated, where k and r are positive integers.
[0125] For example, one can get the value from the Gaussian distribution p z (z) is sampled to obtain the k-dimensional vector (for example, k = 100) in the initial data, and then the label y is given i =1 or y i=0, the k-dimensional vector and the label data form the initial data input into the target generation model, and the model can output an r-dimensional vector (for example, r = 393), which is the target generation data. The dimension and form of the label data can be the same as the dimension and form of the first label data and the second label data. For example, the r-dimensional vector can be gene mutation data. When you want to generate target gene data with mutations, you can put the label y i If set to 1, the r-dimensional vector output by the target generation model is the target gene data that represents the gene mutation. The value of each data in the r-dimensional vector indicates whether the corresponding amino acid has mutated. When you want to generate target gene data without mutation, you can use the label y i If it is set to 0, the target generation model outputs target gene data that indicates whether there is a gene mutation, and the value of each data in the r-dimensional vector indicates whether the corresponding amino acid has mutated.
[0126] For example, outputting the target generation data may include: outputting the target generation data in a document form to a storage device; wherein the target generation data is used as sample data of other models and used in the training process of other models.
[0127] For example, in reality, due to privacy reasons, there is usually not enough gene mutation data to conduct corresponding research. Using the data generation method of at least one embodiment of the present disclosure, gene mutation data can be generated to better carry out corresponding research on gene mutations.
[0128] At least one embodiment of the present disclosure provides a data generating device.
[0129] FIG7A shows a schematic block diagram of a data generating device provided by at least one embodiment of the present disclosure.
[0130] For example, as shown in Figure 7A, the data generating device 710 includes a target generation module 711 and an output module 712. These components are interconnected by a bus system and / or other forms of connecting mechanisms (not shown). For example, these modules can be implemented by hardware (such as circuit) modules, software modules or any combination thereof, and the following embodiments are the same and will not be repeated here. For example, these units can be implemented by a central processing unit (CPU), a graphics processing unit (GPU), a tensor processing unit (TPU), a field programmable gate array (FPGA) or other forms of processing units with data processing power and / or instruction execution capability and corresponding computer instructions. It should be noted that the components and structures of the data generating device 710 shown in Figure 7 are exemplary only, and are not restrictive. As needed, the data generating device 710 may also have other components and structures.
[0131] The target generation module 711 is configured to input the initial data into the target generation model to obtain target generation data. The target generation module 711 may, for example, execute step S610 described in FIG6 .
[0132] The output module 712 is configured to output the target generation data. The output module 712 may, for example, execute step S620 described in FIG6 .
[0133] At least one embodiment of the present disclosure provides a model training device.
[0134] FIG7B shows a schematic block diagram of a model training device provided by at least one embodiment of the present disclosure.
[0135] For example, as shown in FIG7B , the model training device 720 includes an initial generation module 721, an initial discrimination module 722, a loss determination module 723, and a parameter adjustment module 724. It should be noted that the components and structure of the model training device 720 shown in FIG7B are merely exemplary and non-limiting, and the model training device 720 may also have other components and structures as needed.
[0136] The initial generation module 721 is configured to input the sample data into the initial generation model to obtain generated data. The initial generation module 721 may, for example, execute step S110 described in FIG1 .
[0137] The initial discrimination module 722 is configured to input the generated data and the real data into the initial discrimination model to obtain a discrimination result. The initial discrimination module 722 may, for example, execute step S120 described in FIG1 .
[0138] The loss determination module 723 is configured to determine a generative model loss, wherein the generative model loss includes a first generative loss and a second generative loss, the first generative loss being determined based on the discrimination result, the second generative loss being determined based on the generated data and the real data, and the second generative loss representing the gap between the generated data and the real data. The loss determination module 723 may, for example, execute step S130 described in FIG. 1 .
[0139] The parameter adjustment module 724 is configured to adjust the model parameters of the initial generative model using the generative model loss. The parameter adjustment module 724 may, for example, execute step S140 described in FIG1 .
[0140] For example, the target generation module 711, the output module 712, the initial generation module 721, the initial discrimination module 722, the loss determination module 723, and the parameter adjustment module 724 can be hardware, software, firmware, or any feasible combination thereof. For example, the target generation module 711, the output module 712, the initial generation module 721, the initial discrimination module 722, the loss determination module 723, and the parameter adjustment module 724 can be dedicated or general-purpose circuits, chips, or devices, or can be a combination of a processor and a memory. The embodiments of the present disclosure do not limit the specific implementation of each of the above-mentioned units.
[0141] For example, the target generation module 711, the output module 712, the initial generation module 721, the initial discrimination module 722, the loss determination module 723, and the parameter adjustment module 724 may include codes and programs stored in a memory; the processor may execute the codes and programs to implement some or all of the functions of the target generation module 711, the output module 712, the initial generation module 721, the initial discrimination module 722, the loss determination module 723, and the parameter adjustment module 724 described above. For example, the target generation module 711, the output module 712, the initial generation module 721, the initial discrimination module 722, the loss determination module 723, and the parameter adjustment module 724 may be dedicated hardware devices for implementing some or all of the functions of the target generation module 711, the output module 712, the initial generation module 721, the initial discrimination module 722, the loss determination module 723, and the parameter adjustment module 724 described above. For example, the target generation module 711, the output module 712, the initial generation module 721, the initial discrimination module 722, the loss determination module 723, and the parameter adjustment module 724 may be a circuit board or a combination of multiple circuit boards for implementing the functions described above. In the embodiment of the present disclosure, the circuit board or the combination of multiple circuit boards may include: (1) one or more processors; (2) one or more non-transitory memories connected to the processors; and (3) firmware stored in the memories and executable by the processors.
[0142] It should be noted that in the embodiments of the present disclosure, the various units of the data generating device 710 and the model training device 720 correspond to the various steps of the aforementioned data generating method and model training method, respectively. For the specific functions of the data generating device 710 and the model training device 720, reference can be made to the relevant descriptions of the data generating method and the model training method, respectively, and no further details will be given here. The components and structures of the data generating device 710 shown in Figure 7A and the model training device 720 shown in Figure 7B are only exemplary and not restrictive. As needed, the data generating device 710 and the model training device 720 may include more or fewer modules, circuits or units, and the connection relationship between each module, circuit or unit is not limited and can be determined according to actual needs. The specific configuration of each module, circuit or unit is not limited and can be composed of analog devices according to circuit principles, or can be composed of digital chips, or can be composed in other applicable ways.
[0143] At least one embodiment of the present disclosure further provides an electronic device including a processor and a memory, wherein the memory stores one or more computer program modules. The one or more computer program modules are configured to be executed by the processor to implement the above-mentioned data generation method or model training method.
[0144] Figure 8A is a schematic block diagram of an electronic device provided by some embodiments of the present disclosure. As shown in Figure 8A, the electronic device 800 includes a processor 810 and a memory 820. The memory 820 stores non-transitory computer-readable instructions (e.g., one or more computer program modules). The processor 810 is used to run non-transitory computer-readable instructions, which are executed by the processor 810 when running one or more steps in the data generation method or model training method described above. The memory 820 and the processor 810 can be interconnected via a bus system and / or other forms of connection mechanisms (not shown). For the specific implementation of each step of the data generation method and the related explanation content, please refer to the embodiments of the above-mentioned data generation method or model training method, and the repetitions will not be repeated here.
[0145] It should be noted that the components of the electronic device 800 shown in FIG8A are merely exemplary and non-limiting. The electronic device 800 may also have other components according to actual application requirements.
[0146] For example, the processor 810 and the memory 820 may communicate with each other directly or indirectly.
[0147] For example, the processor 810 and the memory 820 may communicate via a network. The network may include a wireless network, a wired network, and / or any combination of a wireless network and a wired network. The processor 810 and the memory 820 may also communicate with each other via a system bus, which is not limited in this disclosure.
[0148] For example, the processor 810 and the memory 820 may be provided on a server side (or a cloud side).
[0149] For example, the processor 810 can control other components in the electronic device 800 to perform desired functions. For example, the processor 810 can be a central processing unit (CPU), a graphics processing unit (GPU), or other processing units with data processing capabilities and / or program execution capabilities. For example, the central processing unit (CPU) can be an X86 or ARM architecture. The processor 810 can be a general-purpose processor or a dedicated processor, and can control other components in the electronic device 800 to perform desired functions.
[0150] For example, the memory 820 may include any combination of one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory. Non-volatile memory may include, for example, read-only memory (ROM), a hard disk, an erasable programmable read-only memory (EPROM), a portable compact disk read-only memory (CD-ROM), a USB memory, a flash memory, etc. One or more computer program modules may be stored on the computer-readable storage medium, and the processor 810 may execute one or more computer program modules to implement various functions of the electronic device 800. Various applications and various data, as well as various data used and / or generated by the applications, may also be stored in the computer-readable storage medium.
[0151] It should be noted that, in the embodiment of the present disclosure, the specific functions and technical effects of the electronic device 800 can be referred to the above description of the data generation method or model training method, which will not be repeated here.
[0152] Figure 8B is a schematic block diagram of another electronic device provided in some embodiments of the present disclosure. The electronic device 900 is suitable for implementing the data generation method or model training method provided in the embodiments of the present disclosure. The electronic device 900 can be a terminal device, etc. It should be noted that the electronic device 900 shown in Figure 8B is only an example and does not impose any limitations on the functions and scope of use of the embodiments of the present disclosure.
[0153] As shown in FIG8B , the electronic device 900 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 910, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 920 or a program loaded from a storage device 980 into a random access memory (RAM) 930. Various programs and data required for the operation of the electronic device 900 are also stored in the RAM 930. The processing device 910, the ROM 920, and the RAM 930 are connected to each other via a bus 940. An input / output (I / O) interface 950 is also connected to the bus 940.
[0154] Typically, the following devices may be connected to the I / O interface 950: an input device 960 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 970 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 980 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 990. The communication device 990 may allow the electronic device 900 to communicate with other electronic devices wirelessly or by wire to exchange data. Although FIG8B shows the electronic device 900 with various devices, it should be understood that it is not required to implement or have all of the devices shown, and the electronic device 900 may alternatively implement or have more or fewer devices.
[0155] For example, according to an embodiment of the present disclosure, the above-mentioned data generation method or model training method can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes a program code for executing the above-mentioned data generation method or model training method. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 990, or installed from the storage device 980, or installed from the ROM 920. When the computer program is executed by the processing device 910, the functions defined in the data generation method or model training method provided in the embodiment of the present disclosure can be implemented.
[0156] At least one embodiment of the present disclosure also provides a computer-readable storage medium, which stores non-transitory computer-readable instructions. When the non-transitory computer-readable instructions are executed by a computer, the above-mentioned data generation method or model training method can be implemented.
[0157] Figure 9 is a schematic diagram of a storage medium provided by some embodiments of the present disclosure. As shown in Figure 9, storage medium 1000 stores non-transitory computer-readable instructions 1010. For example, when non-transitory computer-readable instructions 1010 are executed by a computer, one or more steps in the data generation method or model training method described above are performed.
[0158] For example, the storage medium 1000 can be applied to the electronic device 800 described above. For example, the storage medium 1000 can be the memory 820 in the electronic device 800 shown in FIG8A . For example, the relevant description of the storage medium 1000 can refer to the corresponding description of the memory 820 in the electronic device 800 shown in FIG8A , and will not be repeated here.
[0159] The above description is merely a preferred embodiment of the present disclosure and an illustration of the technical principles employed. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by the specific combination of the above-mentioned technical features, but also includes other technical solutions formed by any combination of the above-mentioned technical features or their equivalents without departing from the above-mentioned disclosed concepts. For example, a technical solution formed by replacing the above-mentioned features with (but not limited to) technical features with similar functions disclosed in this disclosure.
[0160] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details have been included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0161] Although the subject matter has been described in language specific to structural features and / or methodological logical acts, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are merely example forms of implementing the claims.
[0162] Regarding this disclosure, the following points need to be explained:
[0163] (1) The drawings of the embodiments of the present disclosure only relate to the structures involved in the embodiments of the present disclosure. Other structures may refer to conventional designs.
[0164] (2) In the absence of conflict, the embodiments of the present disclosure and the features therein may be combined with each other to form new embodiments.
[0165] The above description is only a specific embodiment of the present disclosure, but the protection scope of the present disclosure is not limited thereto. The protection scope of the present disclosure shall be based on the protection scope of the claims.
Claims
1. A data generation method, comprising: Inputting the initial data into the target generation model to obtain target generation data; Outputting the target generation data; The target generation model is obtained by training an initial network model, wherein the initial network model includes an initial generation model and an initial discrimination model, and the training process includes: Input the sample data into the initial generation model to obtain the generated data; Inputting the generated data and the real data into an initial discriminant model to obtain a discriminant result; Determine a generation model loss, wherein the generation model loss includes a first generation loss and a second generation loss, the first generation loss is determined based on the discrimination result, the second generation loss is determined based on the generated data and the real data, and the second generation loss represents a numerical difference between the generated data and the real data; The generative model loss is used to adjust model parameters of the initial generative model.
2. The data generation method according to claim 1, wherein: The initial data includes label data and a k-dimensional vector, wherein the k data in the k-dimensional vector are k random values conforming to a normal distribution; The label data is used to characterize whether a target gene has mutated; The target generation data includes an r-dimensional vector, the r data in the r-dimensional vector respectively correspond to the r amino acids included in the target gene, and each data in the r-dimensional vector is used to indicate whether the corresponding amino acid is mutated; Wherein, k and r are positive integers.
3. The data generation method according to claim 1 or 2, wherein: Outputting the target generation data includes: Outputting the target generation data to a storage device in the form of a document; The target generated data is used as sample data of other models and is used in the training process of other models.
4. The data generation method according to any one of claims 1 to 3, wherein: Input the sample data into the initial generation model to obtain the generated data, including: Obtaining N groups of sample data and N groups of real data corresponding to the N groups of sample data respectively; Inputting the N groups of sample data into the initial generation model respectively to obtain N groups of generated data corresponding to the N groups of sample data respectively; The generated data and the real data are input into the initial discriminant model to obtain a discriminant result, including: Inputting the N groups of generated data and the N groups of real data into the initial discriminant model respectively, obtaining N first discriminant results corresponding to the N groups of generated data respectively and N second discriminant results corresponding to the N groups of real data respectively; Wherein, N is a positive integer.
5. The data generation method according to claim 4, wherein: Determine the generative model loss, including: Determine a first generation loss based on the N first discrimination results; Determine a second generation loss based on the N sets of generated data and the N sets of real data, wherein the second generation loss represents a difference between the N sets of generated data and the N sets of real data; A generation model loss is determined based on the first generation loss and the second generation loss.
6. The data generation method according to claim 5, wherein: The training process also includes: Determine a discrimination model loss based on the N first discrimination results and the N second discrimination results; Model parameters of the initial discriminant model are adjusted based on the discriminant loss.
7. The data generation method according to claim 5 or 6, wherein: Determining a second generation loss based on the N groups of generated data and the N groups of real data includes: Determine a first sub-loss based on the N sets of generated data and the N sets of real data, wherein the first sub-loss represents a numerical distance between the N sets of generated data and the N sets of real data; and / or Determine a second sub-loss based on the features of the N groups of generated data and the features of the N groups of real data, wherein the second sub-loss represents the degree of similarity between the features of the N groups of generated data and the features of the real data; The second generation loss includes the first sub-loss and / or the second sub-loss.
8. The data generation method according to claim 7, wherein: Each group of sample data includes first label data and a k-dimensional vector; Each group of real data includes second label data and an r-dimensional vector; Each group of generated data includes an r-dimensional vector output by the initial generation model and first label data in the corresponding sample data; The first label data in each group of sample data is the same as the second label data in the corresponding group of real data; Wherein, k and r are both positive integers.
9. The data generation method according to claim 8, wherein: The k data in the k-dimensional vector are k random values that conform to the normal distribution; The r data in the r-dimensional vector respectively correspond to the r amino acids included in the target gene, and each data in the r-dimensional vector is used to indicate whether the corresponding amino acid has mutated; The first label data and the second label data are used to indicate whether a target gene has mutated.
10. The data generation method according to claim 8 or 9, wherein: The first sub-loss represents the distance between the r-dimensional vectors of the N groups of generated data and the r-dimensional vectors of the N groups of real data; Determining a first sub-loss based on the N groups of generated data and the N groups of real data includes: Calculate the vector difference between the r-dimensional vector of each group of generated data and the r-dimensional vector of the corresponding real data; The first sub-loss is determined based on N vector differences respectively corresponding to the N groups of generated data.
11. The data generation method according to any one of claims 8 to 10, wherein: The features of the generated data include numerical features of r data in the r-dimensional vector of the generated data, and the features of the real data include numerical features of r data in the r-dimensional vector of the real data; The r data in the r-dimensional vector of the real data are composed of p kinds of values; The second sub-loss represents the degree of proximity between the value of each data in the r-dimensional vector of the N groups of generated data and the p values.
12. The data generation method according to claim 11, wherein: Determining a second sub-loss based on the features of the N groups of generated data and the features of the N groups of real data includes: For each group of the generated data, determine the degree of numerical proximity between the value of each data in the r-dimensional vector of the generated data and the p kinds of numerical values, wherein the degree of numerical proximity between the value of the data and the p kinds of numerical values is represented by the minimum value of the absolute values of the differences between the value of the data and the p kinds of numerical values; Determine the degree of proximity between the value of each group of generated data and the p values based on the degree of proximity between the value of each data in the r-dimensional vector of each group of generated data and the p values; The second sub-loss is determined based on the proximity between the values of the N groups of generated data and the p values.
13. The data generation method according to any one of claims 8 to 12, wherein: The discrimination result output by the initial discrimination model is the probability that a set of data input into the initial discrimination model belongs to the real data; The discrimination result output by the initial discriminant model is a value greater than or equal to 0 and less than or equal to 1. The closer the discrimination result is to 1, the closer a set of data input into the initial discriminant model is to the real data.
14. The data generation method according to claim 13, wherein: Determining a first generation loss based on the N first discrimination results includes: The first generation loss is determined according to the degree of proximity of each of the N first discrimination results to the value 1, wherein the closer the N first discrimination results are to the value 1, the closer the first generation loss is to the value 0.
15. The data generation method according to claim 6, wherein: Determining a discriminant model loss based on the N first discriminant results and the N second discriminant results includes: The discrimination model loss is determined based on the degree of proximity of each first discrimination result among the N first discrimination results to the value 1 and the degree of proximity of each second discrimination result among the N second discrimination results to the value 1, wherein the closer the N second discrimination results are to the value 1 and the closer the N first discrimination results are to the value 0, the smaller the discrimination model loss is.
16. The data generation method according to any one of claims 7 to 14, wherein: Determine the generative model loss, also including: A weighted sum of the first generation loss, the first sub-loss, and the second sub-loss is calculated as the generation model loss.
17. The data generation method according to any one of claims 1 to 16, wherein: The initial generation model includes a plurality of blocks connected in sequence, each of which includes a linear mapping layer, a normalization layer and an activation layer; The multiple blocks are used to adjust the dimension of the sample data to obtain generated data with target dimensions.
18. A model training method, comprising: Input the sample data into the initial generation model to obtain the generated data; Input the generated data and the real data into the initial discriminant model to obtain the discriminant results; Determine a generation model loss, wherein the generation model loss includes a first generation loss and a second generation loss, the first generation loss is determined based on the discrimination result, the second generation loss is determined based on the generated data and the real data, and the second generation loss represents the gap between the generated data and the real data; The generative model loss is used to adjust model parameters of the initial generative model.
19. A data generating device, comprising: A target generation module is configured to input initial data into a target generation model to obtain target generation data; An output module, configured to output the target generated data; The target generation model is obtained by training an initial network model, wherein the initial network model includes an initial generation model and an initial discrimination model, and the training process includes: Input the sample data into the initial generation model to obtain the generated data; Inputting the generated data and the real data into an initial discriminant model to obtain a discriminant result; Determine a generation model loss, wherein the generation model loss includes a first generation loss and a second generation loss, the first generation loss is determined based on the discrimination result, the second generation loss is determined based on the generated data and the real data, and the second generation loss represents a numerical difference between the generated data and the real data; The generative model loss is used to adjust model parameters of the initial generative model.
20. A model training device, comprising: An initial generation module, configured to input sample data into an initial generation model to obtain generated data; An initial discrimination module, configured to input the generated data and the real data into an initial discrimination model to obtain a discrimination result; a loss determination module configured to determine a generation model loss, wherein the generation model loss includes a first generation loss and a second generation loss, the first generation loss is determined based on the discrimination result, the second generation loss is determined based on the generation data and the real data, and the second generation loss represents a gap between the generation data and the real data; A parameter adjustment module is configured to adjust the model parameters of the initial generation model using the generation model loss.
21. An electronic device comprising: processor; A memory storing one or more computer program modules; The one or more computer program modules are configured to be executed by the processor to implement the method according to any one of claims 1 to 18.
22. A computer-readable storage medium storing non-transitory computer-readable instructions, which can implement the method of any one of claims 1 to 18 when executed by a computer.
Citation Information
Patent Citations
Method and device for generating sample data
CN113205414A
Training method and device for data generation system based on differential privacy
CN113642731A
Training method of generative adversarial network, data classification method and related equipment
CN114118345A
Image generation method and device, equipment and medium
CN114648681A
Method and device for text-based image generation
US20220005235A1