Data generation method and device, model training method and device, equipment and medium
By introducing the initial generation model and the initial discriminant model into the data generation model, and adjusting the parameters using the generative model loss, the problem of low quality of generated data in the existing technology is solved, and the degree of closeness between generated data and real data is achieved.
Patent Information
- Application Number
- CN202311086311.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-28
- Publication Date
- 2025-02-28
AI Technical Summary
During the training process, existing data generation models are difficult to accurately reflect the differences between the generated data and the real data, resulting in low quality of the generated data.
By introducing an initial generation model and an initial discriminant model into the data generation model, the training process includes inputting sample data into the initial generation model to generate data, and inputting the generated data and real data into the initial discriminant model to obtain discriminant results, calculating the generation model loss based on these results, and adjusting the model parameters using this loss.
This method can more accurately reflect the proximity between the generated data and the real data, improve the quality of the generated data, and make it closer to the real data.
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
Technical Field
[0001] 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
[0002] Data generation models are a type of model based on probability theory and statistical learning, and are widely used in predicting and simulating practical problems. Data generation models can generate data that conforms to the actual situation by modeling the distribution of data, or analyze and process data through methods such as classification, clustering, and dimensionality reduction. For example, data generation models can be used for data generation and simulation, automatically generating new data that conforms to the characteristics of given data, and can be used for data expansion, data enrichment, data testing, etc. Summary of the invention
[0003] 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 comprises 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 is determined based on the discrimination result, the second generation loss is determined based on the generation data and the real data, the second generation loss characterizes the numerical difference between the generation data and the real data; and adjusting the model parameters of the initial generation model using the generation model loss.
[0004] 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.
[0005] For example, in the data generation method provided by 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.
[0006] For example, in the data generation method provided by at least one example of the above-mentioned embodiments of the present disclosure, sample data is input into an initial generation model to obtain generated data, including: 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 respectively, and obtaining N groups of generated data corresponding to the N groups of sample data. The generated data and real data are input into an initial discriminant model to obtain a discrimination result, including: inputting the N groups of generated data and the N groups of real data into the initial discriminant model respectively, and obtaining 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.
[0007] 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 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; determining the generation model loss based on the first generation loss and the second generation loss.
[0008] For example, in the data generation method provided by at least one example of the above 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.
[0009] For example, in the data generation method provided by at least one example of the above-mentioned embodiments of the present disclosure, a second generation loss is determined based on the N groups of generated data and the N groups of real data, including: 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 features of the N groups of generated data and features of the N groups of real data, wherein the second sub-loss characterizes the degree of similarity between features of the N groups of generated data and features of the real data; wherein the second generation loss includes the first sub-loss and / or the second sub-loss.
[0010] For example, in the data generation method provided by at least one example of the above 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.
[0011] 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.
[0012] 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 characterizes 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 corresponding r-dimensional vector of the real data; based on the N vector differences corresponding to the N groups of generated data, the first sub-loss is determined.
[0013] For example, in the data generation method provided by at least one example of the above 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.
[0014] For example, in the data generation method provided by at least one example of the above-mentioned embodiments of the present disclosure, based on the characteristics of the N groups of generated data and the characteristics of the N groups of real data, the second sub-loss is determined, 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.
[0015] For example, in the data generation method provided by at least one example of the above embodiments of the present disclosure, the discrimination result output by the initial discriminant model is the probability that a group 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 group of data input into the initial discriminant model is to real data.
[0016] 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 proximity of each first discrimination result among 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.
[0017] For example, in the data generation method provided by at least one example of the above-mentioned embodiments of the present disclosure, the discriminant model loss is determined based on the N first discriminant results and the N second discriminant results, including: determining the discriminant model loss according to the degree of proximity of each first discriminant result among the N first discriminant results to the numerical value 1 and the degree of proximity of each second discriminant result among the N second discriminant results to the numerical value 1, wherein the closer the N second discriminant results are to the numerical value 1 and the closer the N first discriminant results are to the numerical value 0, the smaller the discriminant model loss is.
[0018] 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.
[0019] For example, in the data generation method provided by at least one example of the above embodiments of the present disclosure, the initial generation model includes a plurality of blocks connected in sequence, each of the blocks includes 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.
[0020] 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 discriminant result; determining a generative model loss, wherein the generative model loss comprises a first generative loss and a second generative loss, the first generative loss is determined based on the discriminant result, the second generative loss is determined based on the generated data and the real data, the second generative loss characterizes the gap between the generated data and the real data; and adjusting model parameters of the initial generative model using the generative model loss.
[0021] At least one embodiment of the present disclosure provides a data generation device, including a target generation module and an output module, wherein 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, wherein 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 discriminant result; determining a generation model loss, wherein the generation model loss includes a first generation loss and a second generation loss, wherein the first generation loss is determined based on the discriminant result, and the second generation loss is determined based on the generated data and the real data, and the second generation loss characterizes 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.
[0022] 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 by any embodiment of the present disclosure.
[0023] 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
[0024] 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, but are not intended to limit the present disclosure.
[0025] Figure 1 A flow chart of a model training method provided by at least one embodiment of the present disclosure is shown;
[0026] Figure 2 A training flow chart of an initial network model provided by at least one embodiment of the present disclosure is shown;
[0027] Figure 3 A schematic diagram of an initial generation model provided by at least one embodiment of the present disclosure is shown;
[0028] Figure 4 A schematic diagram showing an initial discriminant model provided by at least one embodiment of the present disclosure is shown;
[0029] Figure 5 A flowchart of determining a second generation loss provided by at least one embodiment of the present disclosure is shown;
[0030] Figure 6 A flow chart showing a data generation method provided by at least one embodiment of the present disclosure is shown;
[0031] Fig. 7A A schematic block diagram of a data generating device provided by at least one embodiment of the present disclosure is shown;
[0032] Figure 7B A schematic block diagram showing a model training device provided by at least one embodiment of the present disclosure
[0033] Fig. 8A A schematic block diagram of an electronic device provided by at least one embodiment of the present disclosure is shown;
[0034] Figure 8B A schematic block diagram showing another electronic device provided by at least one embodiment of the present disclosure; and
[0035] Fig. 9 A schematic diagram of a computer-readable storage medium provided by at least one embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0036] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution of the embodiments of the present disclosure will be clearly and completely described below in conjunction with the 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.
[0037] Unless otherwise defined, the technical terms or scientific terms used in the present disclosure should be understood by people with ordinary skills in the field to which the present disclosure belongs. The "first", "second" and similar words used in the present disclosure do not indicate any order, quantity or importance, but are only used to distinguish different components. Similarly, similar words such as "one", "one" or "the" do not indicate quantity restrictions, but indicate that there is at least one. Similar words such as "include" or "comprise" mean that the elements or objects appearing before the word cover the elements or objects listed after the word and their equivalents, without excluding other elements or objects. Similar words such as "connect" or "connected" are not limited to physical or mechanical connections, but can 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 described object changes, the relative positional relationship may also change accordingly.
[0038] Generative Adversarial Network (GAN) is a generative machine learning model that is widely used in various industries and can be used to create fictional data, images, text, etc.
[0039] Generative adversarial networks can be used to generate medical data. For example, the gene encoded as TP53 is generally located on human chromosome 17P13 and is a relatively important tumor suppressor gene. In the human body, it can control cells from excessive growth and proliferation to maintain normal life activities. If certain factors stimulate or carcinogenic factors affect the tumor suppressor gene, it will not be able to prevent the cell from becoming malignant, which usually leads to the occurrence of tumors. Therefore, the probability of tumor occurrence can be judged by the mutation of TP53. However, in reality, due to privacy and other reasons, there is usually not enough mutation data for research, so how to automatically generate mutation data becomes crucial. Using generative models such as generative adversarial networks to generate mutation data can solve the problem of insufficient mutation data required for research.
[0040] The generative adversarial network includes a generator and a discriminator. The role of the generator is to create synthetic virtual data (hereinafter also referred to as generated data), while the role of the discriminator is to determine whether its input data is real data or virtual data created from the generator. By training the generator and the discriminator, the generator can be made to imitate real data, that is, the virtual data created by the generator is close to the real data, reaching a level where it is difficult for the discriminator to classify the input data as virtual data or real data.
[0041] During the training process of the generative adversarial network, the loss function is used to calculate the model loss, and then the parameters of the generator and discriminator are adjusted according to the model loss. Among them, the loss function can be a function related to the output result of the discriminator, that is, the output result of the discriminator is used to calculate the model loss. However, the model loss calculated in this way cannot accurately reflect the gap between the virtual data generated by the generator and the real data, resulting in low quality of the data generated by the trained generator.
[0042] 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 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 generated data and real data into the initial discriminant model to obtain a discriminant 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 discriminant result, the second generation loss is determined based on the generated data and the real data, and the second generation loss characterizes 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.
[0043] According to at least one embodiment of the present disclosure, the first generation loss is calculated by the discrimination result of the initial discriminant model, the second generation loss is calculated based on the real data and the generated data, and the 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 as 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 more comprehensively reflects the closeness between the generated data and the real data. Using the generation model loss to adjust the generation model parameters can make the target generation model generated in the end more accurate, and the data generated by the target generation model is closer to the real data, thereby improving the data quality.
[0044] For ease of understanding, the following first describes the model training method, and then describes the data generation method performed using the trained generation model.
[0045] Figure 1 A flowchart of a model training method provided by at least one embodiment of the present disclosure is shown.
[0046] like Figure 1 As shown, the method may include steps S110 to S140.
[0047] Step S110: inputting sample data into the initial generation model to obtain generated data;
[0048] Step S120: inputting the generated data and the real data into the initial discriminant model to obtain the discriminant result;
[0049] Step S130: 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 gap between the generated data and the real data;
[0050] Step S140: using the generative model loss to adjust the model parameters of the initial generative model.
[0051] For example, before executing step S110, multiple groups of sample data and multiple groups of real data corresponding to the multiple groups of sample data may be obtained. The specific values of the sample data and the real data may be determined according to actual conditions.
[0052] For example, in step S110, the initial network model is trained multiple times using the multiple groups of sample data and the multiple groups 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 by the last training is used as the target network model. Each training process may include the above steps S110 to S140.
[0053] For example, the initial network model includes an initial generative model (a generative model may also be referred to as a generator) and an initial discriminative model (a discriminative model may also be referred to as 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.
[0054] For example, step S110 may include: inputting 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.
[0055] 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, and 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.
[0056] For example, each training process may further include: determining a discriminant model loss, and adjusting the model parameters of the initial discriminant model using the discriminant model loss, wherein the discriminant model loss is determined based on the discrimination result of the initial discriminant model. For example, in 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.
[0057] 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 by the stochastic gradient descent algorithm using the discriminative model loss until the number of training times reaches 5 times, and then the initial discriminative model can be fixed, and the initial generative model can be trained once by the stochastic gradient descent algorithm using the generative model loss, and this cycle can be repeated until the number of training times reaches a predetermined number (e.g., 500 times) or the model converges.
[0058] For example, the sample data is the input data of the generative model. The data volume and data type of the sample data can be determined according to the actual application scenario. For example, if you want to use the generative model to generate image data, then the sample data can be image data, which can include pixel coordinate attributes and color attributes, etc. If you want to use the generative model to generate gene mutation data, since the gene mutation data can be a multidimensional vector, then the sample data can also be a multidimensional vector.
[0059] Figure 2 A training flowchart of an initial network model provided by at least one embodiment of the present disclosure is shown.
[0060] like Figure 2 As shown, each set of sample data may include, for example, first label data (denoted by y i ) and k-dimensional vectors (denoted by z i Represents), i is a positive integer less than or equal to N.
[0061] For example, a k-dimensional vector may include k data arranged in sequence. 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.
[0062] For example, each set of real data includes the second label data (denoted by y i ) and r-dimensional vectors (denoted by x i denoted), r is a positive integer. For example, the real data is the data collected in reality. In the application scenario of generating gene mutation data, the r-dimensional vector in each set of real data can be the amino acid sequence of the target gene extracted from the individual with the target gene mutation. For example, the r-dimensional vector (x i ) can correspond to the r amino acids included in the target gene respectively, and the r-dimensional vector (x i ) is used to characterize whether the corresponding amino acid has mutated. For example, the TP53 gene contains 393 amino acids. Correspondingly, each set of real data may 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 certain data in the 393-dimensional vector mutates, the value of the data may be equal to 1, indicating that the corresponding amino acid has mutated. Otherwise, the value of the data may be equal to 0, indicating that the corresponding amino acid has not mutated.
[0063] 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 mutates, that is, to reflect whether the target gene as a whole mutates. 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 mutate, it means that the target gene as a whole mutates, 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 group 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 mutate, the value of the second label data also represents that the target gene mutates.
[0064] For example, the first label data has the same function as the second label data, and is also used to characterize whether the target gene has mutated. The first label data characterizes the gene mutation property of the generated data that you want to generate using the generative model. If you want the generative model to generate generated data with gene mutation, then the first label data can be set to 01. If you want the generative model to generate generated data without gene mutation, then the first label data can be set to 00.
[0065] For example, in some embodiments, N groups of sample data may correspond to N groups of real data respectively, and the first label data in each group of sample data may be determined according to the second label data in the corresponding group of real samples, and the first label data in each group of sample data may 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.
[0066] For example, by setting label data (first label data and second label data), the situation or state of the real data is reflected as a whole, which is conducive to enabling the generation model to generate data with corresponding characteristics according to different label data, thereby improving the accuracy of the model.
[0067] like Figure 2 As shown, 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 (symbolized by x i `or x' n Represented), 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 concatenated with the first label data respectively, and N groups of generated data {(x1`,y1),(x2`,y2),(x3`,y3),…,(x N `,y N )}.
[0068] For example, the initial generation 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.
[0069] Figure 3A schematic diagram of an initial generation model provided by at least one embodiment of the present disclosure is shown.
[0070] like Figure 3 As shown, the initial generative model includes multiple blocks (e.g., block1 to block5), each block can be represented as block (input dimension, output dimension), 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 may include block (102, 128) -> block (128, 256) -> block (256, 512) -> block (512, 1024) -> block (1024, 393) -> sigmoid (), where -> indicates the direction of data flow, that is, the output of the previous block is used as the input of the next block, and sigmoid () represents 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 onehot representation, the dimension is, for example, 2, so the dimension of the concatenated vector is 102.
[0071] For example, each block in the initial generation model may include a linear mapping layer (input dimension, output dimension), a normalization layer, and an activation layer (e.g., LeakyRelu), and 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.
[0072] 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 (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 symbol o i The discrimination result (the first discrimination result and the second discrimination result) may represent the probability that a set of data input into the initial discrimination model is real data. The discrimination result (the first discrimination result and the second discrimination result) may be 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 the set of data input into the initial discrimination model is to real data.
[0073] 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 )), o i `Also expressed as D((x i `,y i )) or D((G(z i ,y i ),y i )).
[0074] For example, N groups of generated data generated based on 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 sets of real data can be input into the initial discriminant model in sequence to obtain N second discriminant results {o1, o2, o3, …, o N}.
[0075] Figure 4 A schematic diagram of an initial discriminant model provided by at least one embodiment of the present disclosure is shown.
[0076] like Figure 4 As shown, the initial discriminant model can 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 )’s dimension (393+2=395).
[0077] For example, in each training process, after obtaining N first discrimination results, a first generation loss (represented by the symbol G_loss1) can be determined based on the N first discrimination results. In addition, based on the N groups of generated data and the N groups of real data, a second generation loss is determined, wherein the second generation loss represents the numerical difference between the N groups of generated data and the N groups of real data. Based on the first generation loss and the second generation loss, the generation model loss G_loss is determined.
[0078] For example, the first generation loss may 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 may reflect the numerical difference between the generated data and the real data, which may be the distance between the numerical values or the similarity between the features of the numerical values.
[0079] For example, determining the second generation loss based on the generated data and the real data may be to calculate the second generation loss based on the r-dimensional vector in the generated data and the r-dimensional vector in the real data, 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.
[0080] According to the embodiments of the present disclosure, the first generation loss is calculated by the discrimination result of the initial discriminant model, the second generation loss is calculated based on the real data and the generated data, and the 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 as 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 more comprehensively reflects the closeness between the generated data and the real data. Using the generation model loss to adjust the generation model parameters can make the target generation model generated in the end more accurate, and the data generated by the target generation model is closer to the real data, thereby improving the data quality.
[0081] Figure 5 A flowchart for determining a second generation loss provided by at least one embodiment of the present disclosure is shown.
[0082] like Figure 5 As shown, for example, the process of determining the second generation loss may include step S131 and / or step S132.
[0083] Step S131: Based on the N groups of generated data and the N groups of real data, determine a first sub-loss (expressed as reconstruction_loss), wherein the first sub-loss represents the numerical distance between the N groups of generated data and the N groups of real data.
[0084] Step S132: Determine the second sub-loss (using structure_loss or structure_loss) based on the features of the N sets of generated data and the features of the N sets of real data. 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.
[0085] For example, the second generation loss may include a first sub-loss (restruction_loss) and / or a second sub-loss (structure_loss).
[0086] For example, in step S131, the first sub-loss (restruction_loss) can characterize the distance between the r-dimensional vectors of N groups of generated data and the r-dimensional vectors of N groups of real data, which can be determined using Manhattan distance (also called L1 distance), for example.
[0087] 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 groups of generated data, the first sub-loss (restructuring_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 the vector difference to calculate the distance between the two types of data, the distance calculation between the multidimensional vector of the generated data and the multidimensional vector of the real data is realized.
[0088] For example, the calculation formula of the first sub-loss (restruction_loss) can be as follows (1):
[0089]
[0090] Among them, z i ~p z (z) means z i Sampling is from Gaussian distribution, |.| is L1 norm, represents 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.
[0091] 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.
[0092] For example, the first sub-loss is determined by the distance between the generated data and the real data. The first sub-loss is a 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 with 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 the value 0 and the value 1), making the generated data closer to the real data.
[0093] 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.
[0094] For example, the numerical feature may be a numerical composition feature (e.g., what types of numerical values it is composed of), a numerical change trend feature (e.g., gradually increasing or gradually decreasing), etc. In the application scenario of generating gene mutation data, the numerical composition feature is used to reflect the characteristics of the data.
[0095] 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) can characterize 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.
[0096] For example, the r data in the r-dimensional vector of the real data are composed of two values: value 0 and value 1. Value 0 indicates that the corresponding amino acid has not mutated, and value 1 indicates that the corresponding amino acid has mutated. The second sub-loss (structure_loss) characterizes the degree of closeness of each value of the r-dimensional vector of the N sets of generated data to the value 0 and the value 1.
[0097] For example, the more similar the generated data is to the real data in terms of features, 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 the representation vector of the TP53 gene, each dimension corresponds to the amino acid at the corresponding position of the TP53 gene, and the r-dimensional vector of the real data is a vector composed of values 0 and 1. Then each dimension in the r-dimensional vector of the generated data is also expected to be a value 0 and a value 1, rather than other numbers such as 0.5 and 0.2.
[0098] 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).
[0099] For example, the calculation formula of the second sub-loss (structure_loss) may include the following formulas (2) and (3):
[0100]
[0101]
[0102] Among them, |·| 2 is the L2 norm, x n ` represents the nth value in the r-dimensional vector xi, |1-x n `| represents x n The absolute value of the difference from the value 1, |x n `| 2 for|x n `-0| 2 , which means 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 value of each data in the vector is close to the p values (for example, 0 and 1). 393 represents the amount of data contained in the r-dimensional vector (for example, r = 393). f(x`) can be used to represent the closeness between the value of each set of generated data and the p values. loss represents the second child loss, represents the 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 ) is closer to 0, f(x`) is closer to 0, and the second sub-loss (structure_loss) is also closer to 0.
[0103] 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 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 make the data generated by the generative model 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.
[0104] 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 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.
[0105] For example, the expectation for the generative model is that the data generated by the generative model is as similar to the real data as possible, that is, the direction of the training of the initial generative model is to make the probability of the generated data being recognized as real data by the discriminant model higher and higher. The value 1 indicates a probability of 100%. If the first discriminant result is closer to the value 1 and the first generation loss is closer to the value 0, it means that the generated data is closer to the real data. Therefore, it is hoped that the first generation loss is closer to the value 0 as possible.
[0106] For example, the calculation formula of the first generation loss (G_loss1) can be as follows (4):
[0107]
[0108] in, represents the N logD((G(z i ,yi ), 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_lossl) is and the closer it is to 0.
[0109] 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).
[0110] For example, the calculation formula of the generative model loss (G_loss) can be as follows (5):
[0111] G_loss=G_loss1+a×restruction_loss+b×structure_loss (5)
[0112] Among them, a and b are weight coefficients.
[0113] For example, during the training process, 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 is continuously reduced and approaches 0. The generative model loss G_loss is continuously reduced and approaches 0, which means that the first generative loss (G_loss1), the first sub-loss (restmction_loss) and the second sub-loss (structure_loss) are each continuously reduced and approach 0. The closer the first generative loss is to 0, the higher the probability of identifying the generated data as real data. The closer the first sub-loss is to 0, the smaller the distance between the generated data and the real data. The closer the second sub-loss is to 0, the higher the similarity between the data features of the generated data and the data features of the real data. For example, the values of the r-dimensional vector of the generated data are closer to the values 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 real data from the above three aspects.
[0114] For example, for the discriminative model loss (using D_loss or D loss), the discriminant model loss (D_loss) can be determined according to the degree of proximity of each first discriminant result in the N first discriminant results to the value 1 and the degree of proximity of each second discriminant result in the N second discriminant results to the value 1, wherein the closer the N second discriminant results are to the value 1 and the closer the N first discriminant results are to the value 0, the smaller the discriminant model loss is.
[0115] For example, since the role of the discriminant model is to identify generated data and real data, the training direction of the discriminant model is to hope that the discriminant model can distinguish generated data from real data more and more accurately. The value 1 indicates a probability of 100%. If the first discriminant result is closer to the value 0, the discriminant model loss is smaller (for example, closer to negative infinity), indicating that the generated data is less likely to be discriminated as real data. If the second discriminant result is closer to the value 1, the discriminant model loss is smaller (for example, closer to 0), indicating that the real data is more likely to be discriminated as real data, then it is hoped that the discriminant model loss is as small as possible.
[0116] For example, the calculation formula of the discriminant model loss can be as follows (5):
[0117]
[0118] Among them, D((x i ,y i )) is closer to 1, logD((x i ,y i )) is closer to 0, D((G(z i ,y i ), y i )) is closer to 0, logD((G(z i ,y i ), y i The closer )) is to negative infinity, the closer the discriminant model loss is to negative infinity.
[0119] For example, the initial discriminant model is trained using the above discriminant model loss, and the direction of the training is to make the discriminant model loss increasingly approach negative infinity, so that the trained target discriminant model can accurately distinguish between real data and virtual data generated by the model.
[0120] At least one embodiment of the present disclosure provides a data generating method.
[0121] Figure 6 A flow chart of a data generation method provided by at least one embodiment of the present disclosure is shown.
[0122] like Figure 6 As shown, the data generating method includes steps S610 to S620.
[0123] Step S610: input the initial data into the target generation model to obtain target generation data.
[0124] Step S620: Output target generation data.
[0125] The target generation model is obtained by training the 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 the real data into the initial discriminant model to obtain the discriminant 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 discriminant result, the second generation loss is determined based on the generated data and the real data, and the second generation loss characterizes 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.
[0126] 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.
[0127] According to at least one embodiment of the present disclosure, the first generation loss is calculated by the discrimination result of the initial discriminant model, the second generation loss is calculated based on the real data and the generated data, and the 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 as 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 more comprehensively reflects the closeness between the generated data and the real data. Using the generation model loss to adjust the generation model parameters can make the target generation model generated in the end more accurate, and the data generated by the target generation model is closer to the real data, thereby improving the data quality.
[0128] 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 generated 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.
[0129] For example, we can get the Gaussian distribution p z (z) is sampled to obtain a 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 the target gene data with mutation, 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 the target gene data that represents 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.
[0130] For example, outputting the target generation data may include: 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 and used in the training process of other models.
[0131] For example, in reality, due to privacy and other 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 mutation.
[0132] At least one embodiment of the present disclosure provides a data generating device.
[0133] Fig. 7A A schematic block diagram of a data generating device provided by at least one embodiment of the present disclosure is shown.
[0134] For example, Fig. 7A As shown, the data generating device 710 includes a target generating 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 (e.g., circuit) modules, software modules, or any combination of the two, and the following embodiments are the same and will not be repeated. For example, these units can be implemented by a central processing unit (CPU), an image processing unit (GPU), a tensor processing unit (TPU), a field programmable logic gate array (FPGA), or other forms of processing units with data processing capabilities and / or instruction execution capabilities 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 required, the data generating device 710 may also have other components and structures.
[0135] 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 can, for example, execute Figure 6 Described step S610.
[0136] The output module 712 is configured to output the target generated data. The output module 712 can, for example, execute Figure 6 Described step S620.
[0137] At least one embodiment of the present disclosure provides a model training device.
[0138] Figure 7B A schematic block diagram of a model training device provided by at least one embodiment of the present disclosure is shown.
[0139] For example, Figure 7B As shown, 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 Figure 7B The components and structures of the model training device 720 shown are merely exemplary and non-restrictive. The model training device 720 may also have other components and structures as required.
[0140] The initial generation module 721 is configured to input the sample data into the initial generation model to obtain the generated data. The initial generation module 721 can, for example, execute Figure 1 Step S110 described.
[0141] The initial discrimination module 722 is configured to input the generated data and the real data into the initial discrimination model to obtain the discrimination result. The initial discrimination module 722 can, for example, execute Figure 1 Step S120 described.
[0142] The loss determination module 723 is configured to determine the generation model loss, wherein the generation model loss includes a first generation loss and a second generation loss, wherein 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 loss determination module 723 may, for example, execute Figure 1 Step S130 described.
[0143] The parameter adjustment module 724 is configured to adjust the model parameters of the initial generation model using the generation model loss. The parameter adjustment module 724 may, for example, perform Figure 1 Step S140 described.
[0144] 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 and 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 circuits, chips or devices, etc., or can be a combination of a processor and a memory. The embodiments of the present disclosure do not limit the specific implementation forms of the above-mentioned units.
[0145] 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 the memory; the processor may execute the codes and programs to implement some or all 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 as 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, used to implement some or all 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 as 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-temporary memories connected to the processors; and (3) firmware stored in the memories that is executable by the processors.
[0146] 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, please refer to the relevant descriptions of the data generating method and the model training method respectively, which will not be repeated here. Fig. 7A The data generating device 710 and Figure 7BThe components and structure of the model training device 720 shown are only exemplary and non-restrictive. As required, the data generation 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.
[0147] At least one embodiment of the present disclosure further provides an electronic device, which includes 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.
[0148] Fig. 8A A schematic block diagram of an electronic device provided in some embodiments of the present disclosure. Fig. 8A As shown, the electronic device 800 includes a processor 810 and a memory 820. The memory 820 stores non-temporary computer-readable instructions (e.g., one or more computer program modules). The processor 810 is used to run non-temporary computer-readable instructions, and the non-temporary computer-readable instructions are executed by the processor 810 when the processor 810 runs to execute 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.
[0149] It should be noted that Fig. 8A The components of the electronic device 800 shown are merely exemplary and non-limiting. The electronic device 800 may also have other components according to actual application requirements.
[0150] For example, the processor 810 and the memory 820 may communicate with each other directly or indirectly.
[0151] 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 the present disclosure.
[0152] For example, the processor 810 and the memory 820 may be arranged on a server side (or a cloud side).
[0153] 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 forms of 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, etc. The processor 810 can be a general-purpose processor or a special-purpose processor, and can control other components in the electronic device 800 to perform desired functions.
[0154] For example, the memory 820 may include any combination of one or more computer program products, and the computer program product 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 (cache), etc. Non-volatile memory may include, for example, read-only memory (ROM), hard disk, erasable programmable read-only memory (EPROM), portable compact disk read-only memory (CD-ROM), USB memory, flash memory, etc. One or more computer program modules may be stored on the computer-readable storage medium, and the processor 810 may run 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 application, etc. may also be stored in the computer-readable storage medium.
[0155] It should be noted that in the embodiments of the present disclosure, the specific functions and technical effects of the electronic device 800 can refer to the above description of the data generation method or model training method, which will not be repeated here.
[0156] Figure 8B This 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 may be a terminal device, etc. It should be noted that Figure 8B The electronic device 900 shown is merely an example and does not impose any limitation on the functions and scope of use of the embodiments of the present disclosure.
[0157] like Figure 8BAs shown, the electronic device 900 may include a processing device (e.g., a central processing unit, a graphics processor, 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. In the RAM 930, various programs and data required for the operation of the electronic device 900 are also stored. 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.
[0158] Typically, the following devices may be connected to the I / O interface 950: an input device 960 including, for example, a touch screen, a touch pad, 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 Figure 8B The electronic device 900 is shown to have various devices, but it should be understood that it is not required to implement or possess all of the devices shown, and the electronic device 900 may alternatively implement or possess more or fewer devices.
[0159] 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.
[0160] 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.
[0161] Fig. 9 A schematic diagram of a storage medium provided in some embodiments of the present disclosure. Fig. 9As shown, the storage medium 1000 stores non-transitory computer-readable instructions 1010. For example, when the 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.
[0162] For example, the storage medium 1000 may be applied to the electronic device 800. Fig. 8A The memory 820 in the electronic device 800 is shown. For example, the relevant description of the storage medium 1000 can refer to Fig. 8A The corresponding description of the memory 820 in the electronic device 800 is shown and will not be repeated here.
[0163] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. 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 a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0164] 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 are 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.
[0165] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
[0166] There are a few points to note about this disclosure:
[0167] (1) The drawings of the embodiments of the present disclosure only relate to the structures involved in the embodiments of the present disclosure, and other structures may refer to the general design.
[0168] (2) In the absence of conflict, the embodiments of the present disclosure and the features therein may be combined with each other to obtain new embodiments.
[0169] The above description is only a specific implementation 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 claim 1 or 2, 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, 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, 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 claim 8, 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 claim 8, 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 claim 7, 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 claim 1, 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.