A method and device for constructing a neural network model with variable parameters
By dynamically adjusting the number of basic units of the neural network model, the under-fitting or over-fitting problem caused by the fixed parameter quantity of the existing neural network model is solved, the adaptation and rapid convergence of the model parameter quantity are realized, and the training process is simplified.
Patent Information
- Application Number
- CN202410748532.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-12
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2044-06-12
AI Technical Summary
The existing neural network model has a fixed number of parameters, which makes it easy to overfit when the amount of training data is insufficient, and easy to underfit when the amount of data is too large. Optimization relies on empirical settings and is difficult to adapt.
A method of constructing a neural network model with variable parameters is proposed. By obtaining the input sequence, a chain-type generative neural network model is constructed, and basic units are dynamically added or reduced during the training process to adapt to changes in the input sequence and adjust model parameters. quantity.
It realizes the adaptation of model parameters, rapid learning and convergence, avoids the problem of under-fitting or over-fitting, and simplifies the training cycle of the neural network model.
Smart Images

Figure CN118333101B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method and device for constructing a neural network model with variable parameters. Background Art
[0002] In existing neural network models, since the structure of the neural network model is relatively fixed, the parameter quantity will hardly change once it enters training. Whether it is the classic CNN, RNN and other network structures, or the current Transformer architecture generative network, the parameter quantity of the model remains unchanged from the time it is set before model training to the end of model training optimization.
[0003] The optimization of existing neural network models usually relies on manual experience to set the size of model parameters. When the amount of training data is small, if the parameter value is designed to be too large, it is easy to cause overfitting; when the amount of training data is large, if the parameter value is designed to be too small, it is easy to cause the model to fail to converge. Summary of the invention
[0004] The present invention provides a method and device for constructing a neural network model with variable parameters to solve the above problems.
[0005] In a first aspect, the present invention provides a method for constructing a neural network model with variable parameters, which specifically comprises the following steps:
[0006] Step S1, obtain input sequence A={ a 1 ,a 2 ,...,a n}, and build a chain generative neural network model based on the input sequence A;
[0007] Step S2, training and optimizing the chain generative neural network model;
[0008] Step S3, when the input sequence changes, determine whether the chain generative neural network model needs to increase or decrease basic units, and when it is necessary to increase or decrease basic units, execute step S4, otherwise, output the final chain generative neural network model;
[0009] Each of the basic units includes an object, wherein the object includes a neuron or a local network formed by a combination of multiple (in the present application, the term "multiple" means at least 2) neurons, and the input and output of the object are equal; or,
[0010] Each of the basic units includes a chain structure formed by linearly connecting multiple objects, wherein each object is connected together in a specific order to form a continuous chain; or,
[0011] Each of the basic units includes a multi-path structure (in the present application, the term "multi-path" refers to at least 2 paths) formed by nesting a plurality of the chain structures, and the chain structure is formed by linearly connecting a plurality of basic units to form a continuous, linear network structure;
[0012] Step S4: Determine whether to increase or decrease the number of basic units, and increase or decrease the basic units to m indivual;
[0013] Step S5: After the addition or reduction of basic units is completed, the chain generative neural network model is updated.
[0014] in, a 1 ,a 2 ,...,a n is the sequence A n elements, n is a natural number.
[0015] Preferably, in step S1, the input sequence includes n elements, where each element represents a basic unit in the text, including a word, character, subword, symbol, or other predefined text unit;
[0016] The length of the input sequence is the number of elements contained in the input sequence, each of the elements corresponds to an independent basic unit, and the basic units corresponding to different elements are the same or different.
[0017] Preferably, in step S1, the chain generative neural network model includes one or more of the multi-path structures.
[0018] Preferably, in step S3, the input and output of the chain structure are jointly determined by the basic units it contains, and it is allowed to adapt to different input and output requirements by adding a conversion layer;
[0019] The multi-path structure is formed by nesting multiple chain structures, each chain structure is used as a sub-path, allowing information to be processed in parallel on multiple paths;
[0020] The multi-path structure allows for combination and configuration through different chain structures.
[0021] Preferably, in step S1, an input sequence A={ a 1,a 2 ,...,a n}, and construct a chain-generated neural network model based on the input sequence A, which specifically includes the following steps:
[0022] Step S101: Extract features from each data segment in the input sequence A to form a sequence B={ b 1 ,b 2 ,..., b n};
[0023] Step S102: Perform linear or nonlinear transformation on sequence B to form sequence X={ x 1 ,x 2 ,...,x n};
[0024] Step S103: input each piece of data in the sequence X into the basic unit selection network, and map and obtain multiple basic units corresponding to each piece of data in the sequence X as candidates;
[0025] Step S104: for each piece of data in the sequence X, select the basic unit with the highest weight corresponding to the data from the multiple candidate basic units obtained by mapping, so as to obtain n A basic unit corresponding to the input sequence A;
[0026] Step S105: According to the obtained n Basic units are used to build a chain-type generative neural network model.
[0027] Preferably, in step S101, extracting the features of the input sequence includes converting the sequence ID of the input sequence into a computable sequence feature by means of Embedding.
[0028] in, b 1 ,b 2 ,...,b n is the sequence B n elements, n is a natural number.
[0029] in, x 1 ,x 2 ,...,x n is the number ofn elements, n is a natural number.
[0030] Preferably, in step S102, sequence A is linearly or nonlinearly transformed, including linearly or nonlinearly transforming sequence features through a Sequential network to form a transformed sequence feature B.
[0031] Preferably, in step S103, X is input into the basic unit selection network, and mapping is performed to obtain a plurality of basic units corresponding to each piece of data in the sequence X, including two methods;
[0032] in,
[0033] The first method specifically includes inputting each piece of data in the sequence X into the basic unit selection network to obtain multiple basic units corresponding to the piece of data;
[0034] The second method specifically includes: x 1 ,x 1 +x 2 ,...,x 1 + x 2 +...+x n The basic unit selection network is input in sequence in the form of to obtain multiple basic units.
[0035] Preferably, in step S2, the chain generative neural network model is trained and optimized, specifically comprising the following steps:
[0036] Step S201, constructing a loss function of the chain generative neural network model according to the business type of the chain generative neural network model application;
[0037] Step S202: input a plurality of input sequences for training, and complete the training optimization of the chain generative neural network model according to the loss function.
[0038] Preferably, in step S201, the loss function is used to guide the optimization adjustment of the parameters of the chain generative neural network model.
[0039] Preferably, in step S4, the basic unit is increased or decreased to m There are three specific methods:
[0040] The first method is to change the number of neurons in the output layer of the basic unit selection network by n Change tom ;
[0041] The second method is to add a new layer after the output layer of the basic unit selection network. m The network of neurons is used as the new output layer to output the basic unit and connect to the original last layer, making the original n Neurons and m neurons are fully connected;
[0042] The third method is to add a layer of neurons after the output layer of the basic unit selection network as a new output layer for the output of the basic unit. Each neuron in the original output layer is derived into one or more neurons.
[0043] In a second aspect, the present invention further provides a device for constructing a neural network model with variable parameters, which specifically includes the following modules:
[0044] Chained generative neural network model building module, used to obtain and generate a chained generative neural network model based on the input sequence A={ a 1 ,a 2 ,...,a n}Build a chained generative neural network model;
[0045] A chain-type generative neural network model training optimization module, used for training and optimizing the chain-type generative neural network model;
[0046] A basic unit update judgment module is used to judge whether the chain generative neural network model needs to increase or decrease basic units when the input sequence changes. When the basic units need to be increased or decreased, the basic unit update module is executed; otherwise, the final chain generative neural network model is output;
[0047] The basic unit update module is used to determine the number of basic units to be increased or decreased. m indivual;
[0048] The chain generative neural network model updating module is used to update the chain generative neural network model after the addition or reduction of basic units is completed.
[0049] Preferably, the chain generative neural network model building module includes the following submodules:
[0050] The feature extraction submodule is used to extract features from each data segment in the input sequence A to form a sequence B={ b 1 ,b 2 ,...,bn};
[0051] The feature transformation submodule is used to perform linear or nonlinear transformation on the sequence B to form a sequence X={ x 1 ,x 2 ,..., x n};
[0052] A basic unit mapping submodule is used to input each piece of data in the sequence X into the basic unit selection network, and map and obtain multiple basic units corresponding to each piece of data in the sequence X as candidates;
[0053] The optimal basic unit selection submodule is used to select the basic unit with the highest weight corresponding to each data in the sequence X from the multiple candidate basic units obtained by mapping, so as to obtain n A basic unit corresponding to the input sequence A;
[0054] The network model construction submodule is used to obtain n Basic units to build a chain-type generative neural network model;
[0055] Preferably, the chain generative neural network model training optimization module includes the following submodules:
[0056] A loss function construction submodule, used to construct a loss function of the chain generative neural network model according to the business type of the chain generative network model application;
[0057] The network model updating submodule is used to input a plurality of input sequences for training and complete the training optimization of the chain generative neural network model according to the loss function.
[0058] In a third aspect, the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a method for constructing a neural network model with variable parameters as described in any one of the first aspects of the present application.
[0059] In a fourth aspect, the present invention further provides an electronic device, comprising: a memory storing a computer program; and a processor communicatively connected to the memory, for executing a method for constructing a neural network model with variable parameters as described in any one of the first aspects of the present application when the computer program is called.
[0060] Compared with the prior art, the present invention has the following obvious outstanding substantive features and significant advantages:
[0061] In order to solve the problem that the optimization of existing neural network models usually relies on experience to set the size of model parameters, the amount of training data and the parameter requirements do not match, which leads to underfitting or overfitting of the neural network model, the present invention proposes a method for constructing a neural network model with variable parameters, which realizes the adaptation of parameter magnitude for specific application scenarios. By making the parameters variable, the model can learn and converge quickly, alleviating the problem of long training cycle of the neural network model and avoiding the occurrence of underfitting or overfitting of the neural network model. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] The accompanying drawings, which constitute part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention. In the accompanying drawings:
[0063] Figure 1 It is a flow chart of a method for constructing a neural network model with variable parameters according to a preferred embodiment of the present invention;
[0064] Figure 2 This is an example flow chart of screening basic units through a basic unit selection network based on an input sequence X in a method for building a neural network model with variable parameters in a preferred embodiment of the present invention;
[0065] Figure 3 This is an example flow chart of screening basic units through a basic unit selection network based on the accumulated features of an input sequence X in a method for building a neural network model with variable parameters in a preferred embodiment of the present invention;
[0066] Figure 4 It is a schematic diagram of a basic unit structure in a method for constructing a neural network model with variable parameters in a preferred embodiment of the present invention;
[0067] Figure 5 It is another schematic diagram of a basic unit structure in a method for constructing a neural network model with variable parameters in a preferred embodiment of the present invention;
[0068] Figure 6 It is another schematic diagram of a basic unit structure in a method for constructing a neural network model with variable parameters in a preferred embodiment of the present invention;
[0069] Figure 7 It is a schematic diagram of the structure of a chain-type generative neural network model in a method for constructing a neural network model with variable parameters in a preferred embodiment of the present invention;
[0070] Figure 8 It is a schematic diagram of a first method of increasing or decreasing basic units in a method for constructing a neural network model with variable parameters in a preferred embodiment of the present invention;
[0071] Fig. 9 It is a schematic diagram of a second method for increasing or decreasing basic units in a method for constructing a neural network model with variable parameters in a preferred embodiment of the present invention;
[0072] Fig.10 It is a schematic diagram of an embodiment of a third method of increasing or decreasing basic units in a method for constructing a neural network model with variable parameters in a preferred embodiment of the present invention;
[0073] Fig.11 It is a flow chart of a method for constructing a chain-type generative neural network model in a method for constructing a neural network model with variable parameters in a preferred embodiment of the present invention;
[0074] Fig.12 It is a flow chart of a training optimization method of a chain-type generative neural network model in a method for constructing a neural network model with variable parameters in a preferred embodiment of the present invention;
[0075] Fig.13 It is a schematic diagram of the structure of a neural network model construction device with variable parameters according to a preferred embodiment of the present invention;
[0076] Fig.14 It is a schematic diagram of the structure of a neural network model construction device with variable parameters according to a preferred embodiment of the present invention;
[0077] Fig.15 It is a schematic diagram of the structure of a neural network model construction device with variable parameters according to a preferred embodiment of the present invention. DETAILED DESCRIPTION
[0078] The present invention provides a method and device for constructing a neural network model with variable parameters. In order to make the purpose, technical solution and effect of the present invention clearer and more specific, the present invention is further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0079] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices. Example
[0080] like Figure 1-Figure 12 As shown, the method for constructing a neural network model with variable parameters described in this embodiment specifically includes the following steps:
[0081] Step S1, obtain and according to the input sequence A={ a 1 ,a 2 ,...,a n}Build a chained generative neural network model.
[0082] In a specific implementation of the present invention, in step S1, the input sequence includes n elements, each of which represents a basic unit in the text, including words, characters, subwords, symbols, or other predefined text units.
[0083] The length of the input sequence is the number of elements contained in the input sequence, each of the elements corresponds to an independent basic unit, and the basic units corresponding to different elements are the same or different.
[0084] The chain-type generative neural network model includes one or more of the multi-path structures.
[0085] In a specific implementation of the present invention, in step S1, a chain generative neural network model is constructed according to the input sequence A, which specifically includes the following steps:
[0086] Step S101: Extract features from each data segment in the input sequence A to form a sequence B={ b 1 ,b 2 ,..., b n}.
[0087] In a specific implementation of the present invention, in step S101, features of the input sequence are extracted, including converting the sequence ID of the input sequence into a computable sequence feature by means of embedding or the like.
[0088] Step S102: Perform linear or nonlinear transformation on sequence B to form sequence X={ x 1 ,x 2 ,...,x n}.
[0089] In a specific implementation of the present invention, in step S102, sequence A is linearly or nonlinearly transformed, including linearly or nonlinearly transforming sequence features through a Sequential network or the like, to form transformed sequence features B.
[0090] Step S103: input each piece of data in the sequence X into the basic unit selection network, and map and obtain multiple basic units corresponding to each piece of data in the sequence X as candidates.
[0091] In a specific implementation of the present invention, in step S103, X is input into a basic unit selection network, and mapping is performed to obtain a plurality of basic units corresponding to each piece of data in the sequence X, including two methods.
[0092] Among them, the first method specifically includes inputting each data in the sequence X into the basic unit selection network respectively to obtain multiple basic units corresponding to the data.
[0093] The second method specifically includes: x 1 ,x 1 +x 2 ,...,x 1 + x 2 +...+x n The basic unit selection network is input in sequence in the form of to obtain multiple basic units.
[0094] Step S104: for each piece of data in the sequence X, select the basic unit with the highest weight corresponding to the data from the multiple candidate basic units obtained by mapping, so as to obtain n A basic unit corresponding to the input sequence A.
[0095] Step S105: According to the obtained n A basic unit is used to construct a chain-type generative neural network model. Step S2: training and optimizing the chain-type generative neural network model.
[0096] In a specific implementation of the present invention, in step S2, the chain generative neural network model is trained and optimized, which specifically includes the following steps:
[0097] Step S201: construct a loss function of the chain generative neural network model according to the business type of the chain generative network model application.
[0098] Step S202: input a plurality of input sequences for training, and complete the training optimization of the chain generative neural network model according to the loss function.
[0099] Wherein, in step S201, the loss function is used to guide the optimization adjustment of the parameters of the chain generative neural network model.
[0100] Step S3, when the input sequence changes, determine whether the chain generative neural network model needs to increase or decrease basic units, and when it is necessary to increase or decrease basic units, execute step S4, otherwise, output the final chain generative neural network model;
[0101] Each of the basic units includes an object, wherein the object includes a neuron or a local network formed by a combination of multiple neurons, and the input and output of the object are equal; or,
[0102] Each of the basic units includes a chain structure formed by linearly connecting multiple objects, wherein each object is connected together in a specific order to form a continuous chain; or,
[0103] Each of the basic units includes a multi-path structure formed by nesting a plurality of the chain structures, and the chain structure is formed by linearly connecting a plurality of basic units to form a continuous, linear network structure.
[0104] like Figure 4-Figure 7 As shown, Figure 4 It is a basic unit with single input and single output, and the basic unit consists of a neuron. Figure 5 It is a basic unit with single input and single output. The basic unit is divided into a three-layer network structure. The first and third layers are composed of one neuron each, and the middle layer is composed of three neurons. After the basic unit is input, the input is transmitted to the three neurons in the middle layer through three paths. Finally, the three neurons transmit the output to the output neurons of the third layer respectively to obtain the final output result. Figure 6 It is a basic unit with dual input and dual output. Figure 7 It is a chain-type generative neural network model composed of multiple dual-input and dual-output basic units.
[0105] The input and output of the chain structure are jointly determined by the basic units it contains, and it is allowed to adapt to different input and output requirements by adding conversion layers;
[0106] The multi-path structure is formed by nesting multiple chain structures, each chain structure is used as a sub-path, allowing information to be processed in parallel on multiple paths;
[0107] The multi-path structure allows for combination and configuration through different chain structures.
[0108] Step S4: Determine whether to increase or decrease the number of basic units, and increase or decrease the number of basic units to m indivual.
[0109] Among them, in step S4, the basic unit is increased or decreased to m There are three specific methods:
[0110] The first method is to change the number of neurons in the output layer of the basic unit selection network by n Change to m .
[0111] The second method is to add a new layer after the output layer of the basic unit selection network. m The network of neurons is used as the new output layer to output the basic unit and connect to the original last layer, making the original n Neurons and m The neurons are fully connected.
[0112] The third method is to add a layer of neurons after the output layer of the basic unit selection network as a new output layer for the output of the basic unit. Each neuron in the original output layer is derived into one or more neurons.
[0113] Step S5: After the addition or reduction of basic units is completed, the chain generative neural network model is updated. Example
[0114] like Figure 13-Figure 15 As shown, the apparatus for constructing a neural network model with variable parameters described in this embodiment specifically includes the following modules:
[0115] Chained generative neural network model building module, used to obtain and generate a chained neural network model based on the input sequence A={ a 1 ,a 2 ,...,a n}Build a chained generative neural network model.
[0116] The chain generative neural network model construction module includes the following submodules:
[0117] The feature extraction submodule is used to extract features from each data segment in the input sequence A to form a sequence B={ b 1 ,b 2 ,...,b n}.
[0118] The feature transformation submodule is used to perform linear or nonlinear transformation on the sequence B to form a sequence X={ x 1 ,x 2 ,..., x n}.
[0119] The basic unit mapping submodule is used to input each piece of data in the sequence X into the basic unit selection network, and map and obtain multiple basic units corresponding to each piece of data in the sequence X as candidates.
[0120] The optimal basic unit selection submodule is used to select the basic unit with the highest weight corresponding to each data in the sequence X from the multiple candidate basic units obtained by mapping, so as to obtain n A basic unit corresponding to the input sequence A.
[0121] The network model construction submodule is used to obtain n Basic units are used to build a chain-type generative neural network model.
[0122] The chain generative neural network model is trained and optimized by a module for training and optimizing the chain generative neural network model.
[0123] The basic unit update judgment module is used to judge whether the chain generative neural network model needs to increase or decrease basic units when the input sequence changes. When the basic units need to be increased or decreased, the basic unit update module is executed; otherwise, the final chain generative neural network model is output.
[0124] The basic unit update module is used to determine the number of basic units to be increased or decreased. m indivual.
[0125] The chain generative neural network model updating module is used to update the chain generative neural network model after the addition or reduction of basic units is completed.
[0126] The chain generative neural network model training optimization module includes the following submodules:
[0127] The loss function construction submodule is used to construct the loss function of the chain generative neural network model according to the business type of the chain generative network model application.
[0128] The network model updating submodule is used to input a plurality of input sequences for training and complete the training optimization of the chain generative neural network model according to the loss function.
[0129] The specific embodiments of the present invention are described in detail above, but they are only examples, and the present invention is not limited to the specific embodiments described above. For those skilled in the art, any equivalent modifications and substitutions made to the present invention are also within the scope of the present invention. Therefore, the equalization changes and modifications made without departing from the spirit and scope of the present invention should be included in the scope of the present invention.
Claims
1. A method for constructing a neural network model with variable parameters, characterized in that: The specific steps include: Step S1, obtain and according to the input sequence A={ a 1 ,a 2 ,...,a n }Build a chained generative neural network model; Step S2, training and optimizing the chain generative neural network model; Step S3, when the input sequence changes, determine whether the chain generative neural network model needs to increase or decrease basic units, and when it is necessary to increase or decrease basic units, execute step S4, otherwise, output the final chain generative neural network model; Each of the basic units includes an object, wherein the object includes a neuron or a local network formed by a combination of multiple neurons, and the input and output of the object are equal; or, Each of the basic units includes a chain structure formed by linearly connecting multiple objects, wherein each object is connected together in a specific order to form a continuous chain; or, Each of the basic units includes a multi-path structure formed by nesting a plurality of the chain structures, wherein the chain structure is formed by linearly connecting a plurality of basic units to form a continuous, linear network structure; Step S4: Determine whether to increase or decrease the number of basic units, and increase or decrease the basic units to m indivual, m is a natural number; Step S5: after the addition or reduction of the basic units is completed, updating the chain generative neural network model; in, a 1 ,a 2 ,...,a n is the sequence A n elements, n is a natural number; In step S1, a chain generative neural network model is constructed according to the input sequence A, which specifically includes the following steps: Step S101: Extract features from each data segment in the input sequence A to form a sequence B={ b 1 ,b 2 ,...,b n }; Step S102: Perform linear or nonlinear transformation on sequence B to form sequence X={ x 1 ,x 2 ,...,x n }; Step S103: input each piece of data in the sequence X into the basic unit selection network, and map and obtain multiple basic units corresponding to each piece of data in the sequence X as candidates; Step S104: for each piece of data in the sequence X, select the basic unit with the highest weight corresponding to the data from the multiple candidate basic units obtained by mapping, so as to obtain n A basic unit corresponding to the input sequence A; Step S105: According to the obtained n Basic units to build a chain-type generative neural network model; in, b 1 ,b 2 ,...,b n is the sequence B n elements, n is a natural number; in, x 1 ,x 2 ,...,x n is the number of n elements, n is a natural number; In step S103, X is input into the basic unit selection network, and mapping is performed to obtain a plurality of basic units corresponding to each piece of data in the sequence X, including two methods; in, The first method specifically includes inputting each piece of data in the sequence X into the basic unit selection network to obtain multiple basic units corresponding to the piece of data; The second method specifically includes: x 1 ,x 1 +x 2 ,...,x 1 +x 2 +...+x n The basic unit selection network is input in sequence in the form of to obtain multiple basic units.
2. A method for constructing a neural network model with variable parameters according to claim 1, characterized in that: In step S1, the input sequence includes n elements, where each element represents a basic unit in the text, including a word, character, subword, symbol, or other predefined text unit; The length of the input sequence is the number of elements contained in the input sequence, each of the elements corresponds to an independent basic unit, and the basic units corresponding to different elements are the same or different.
3. The method for constructing a neural network model with variable parameters according to claim 1, characterized in that: In step S1, the chain generative neural network model includes one or more of the multi-path structures.
4. The method for constructing a neural network model with variable parameters according to claim 1, characterized in that: In step S3, the input and output of the chain structure are jointly determined by the basic units it contains, and it is allowed to adapt to different input and output requirements by adding conversion layers; The multi-path structure is formed by nesting multiple chain structures, each chain structure is used as a sub-path, allowing information to be processed in parallel on multiple paths; The multi-path structure allows for combination and configuration through different chain structures.
5. The method for constructing a neural network model with variable parameters according to claim 1, characterized in that: In step S101, features of the input sequence are extracted, including converting the sequence ID of the input sequence into computable sequence features through embedding.
6. The method for constructing a neural network model with variable parameters according to claim 1, characterized in that: In step S102, sequence A is linearly or nonlinearly transformed, including linearly or nonlinearly transforming sequence features through a Sequential network to form a transformed sequence feature B.
7. The method for constructing a neural network model with variable parameters according to claim 1, characterized in that: In step S2, the chain generative neural network model is trained and optimized, specifically including the following steps: Step S201, constructing a loss function of the chain generative neural network model according to the business type of the chain generative neural network model application; Step S202: input a plurality of input sequences for training, and complete the training optimization of the chain generative neural network model according to the loss function.
8. The method for constructing a neural network model with variable parameters according to claim 7, characterized in that: In step S201, the loss function is used to guide the optimization adjustment of the parameters of the chain generative neural network model.
9. The method for constructing a neural network model with variable parameters according to claim 1, characterized in that: In step S4, the basic unit is increased or decreased to m There are three specific methods: The first method is to change the number of neurons in the output layer of the basic unit selection network by n Change to m ; The second method is to add a new layer after the output layer of the basic unit selection network. m The network of neurons is used as the new output layer to output the basic unit and connect to the original last layer, making the original n Neurons and m neurons are fully connected; The third method is to add a layer of neurons after the output layer of the basic unit selection network as a new output layer for the output of the basic unit. Each neuron in the original output layer is derived into one or more neurons.
10. A neural network model construction device with variable parameters, characterized in that: The modules include: Chained generative neural network model building module, used to obtain and generate a chained generative neural network model based on the input sequence A={ a 1 ,a 2 ,...,a n }Build a chained generative neural network model; A chain-type generative neural network model training optimization module, used for training and optimizing the chain-type generative neural network model; A basic unit update judgment module is used to judge whether the chain generative neural network model needs to increase or decrease basic units when the input sequence changes. When the basic units need to be increased or decreased, the basic unit update module is executed; otherwise, the final chain generative neural network model is output; The basic unit update module is used to determine the number of basic units to be increased or decreased. m indivual; A chain generative neural network model updating module, used to update the chain generative neural network model after the addition or reduction of basic units is completed; The chain generative neural network model construction module includes the following submodules: The feature extraction submodule is used to extract features from each data segment in the input sequence A to form a sequence B={ b 1 , b 2 ,...,b n }; The feature transformation submodule is used to perform linear or nonlinear transformation on the sequence B to form a sequence X={ x 1 ,x 2 ,...,x n }; A basic unit mapping submodule is used to input each piece of data in the sequence X into the basic unit selection network, and map and obtain multiple basic units corresponding to each piece of data in the sequence X as candidates; The optimal basic unit selection submodule is used to select the basic unit with the highest weight corresponding to each data in the sequence X from the multiple candidate basic units obtained by mapping, so as to obtain n A basic unit corresponding to the input sequence A; Wherein, for each piece of data in the sequence X, a basic unit with the highest weight corresponding to the data is selected from multiple candidate basic units obtained by mapping, including two methods; The first method specifically includes inputting each piece of data in the sequence X into the basic unit selection network to obtain multiple basic units corresponding to the piece of data; The second method specifically includes: x 1 ,x 1 +x 2 ,...,x 1 +x 2 +...+x n The basic unit selection network is input in the form of sequentially to obtain multiple basic units; The network model construction submodule is used to obtain n Basic units to build a chain-type generative neural network model; The chain generative neural network model training optimization module includes the following submodules: A loss function construction submodule, used to construct a loss function of the chain generative neural network model according to the business type of the chain generative network model application; The network model updating submodule is used to input a plurality of input sequences for training and complete the training optimization of the chain generative neural network model according to the loss function.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements a method for constructing a neural network model with variable parameters as described in any one of claims 1 to 9.
12. An electronic device, characterized in that: It includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements a method for constructing a neural network model with variable parameters as described in any one of claims 1 to 9.
Citation Information
Patent Citations
Neural network node self-increasing / decreasing method, device and storage medium
CN109508781A
Lightweight adaptive network learning method oriented to multi-mode and multi-task learning
CN116644316A
Construction method and device of generative neural network tree structure and storage medium
CN117312483A
Memory enhancement method and device for natural language associated features and storage medium
CN117313716A
Generating images using sequences of generative neural networks
CN117561549A
