WO2020042832A1 - Method and device for automatically adding/removing neural network nodes, and storage medium - Google Patents

Method and device for automatically adding/removing neural network nodes, and storage medium Download PDF

Info

Publication number
WO2020042832A1
WO2020042832A1 PCT/CN2019/097181 CN2019097181W WO2020042832A1 WO 2020042832 A1 WO2020042832 A1 WO 2020042832A1 CN 2019097181 W CN2019097181 W CN 2019097181W WO 2020042832 A1 WO2020042832 A1 WO 2020042832A1
Authority
WO
WIPO (PCT)
Prior art keywords
neural network
network model
mnew
layer
neuron
Prior art date
Application number
PCT/CN2019/097181
Other languages
French (fr)
Chinese (zh)
Inventor
洪国强
肖龙源
蔡振华
李稀敏
刘晓葳
谭玉坤
Original Assignee
厦门快商通信息技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 厦门快商通信息技术有限公司 filed Critical 厦门快商通信息技术有限公司
Publication of WO2020042832A1 publication Critical patent/WO2020042832A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/082Learning methods modifying the architecture, e.g. adding, deleting or silencing nodes or connections

Definitions

  • the present invention relates to the field of neural networks, and in particular, to a method, device, and storage medium for self-incrementing and decreasing of neural network nodes.
  • Neural networks (Neural Networks, abbreviated as NNs), or Connection Models, are mathematical models of algorithms that imitate the behavioral characteristics of animal neural networks and perform distributed parallel information processing. This kind of network depends on the complexity of the system and adjusts the interconnection relationship between a large number of internal nodes to achieve the purpose of processing information.
  • a neural network consists of many neurons. Each neuron is also called a unit or a node. Neurons are connected together to form a network. Generally, neurons form multiple layers and are divided into three types of layers: input layer, hidden layer, and output layer, where the first layer is the input layer, and the first layer can contain one or more neurons; the output layer can contain one Or multiple neurons; the hidden layer can be one or more layers. Neurons in each layer will feed their output to the inputs of the neurons in the next hidden layer.
  • the number of nodes in the input layer and the number of nodes in the output layer are determined accordingly.
  • a very important and difficult problem encountered first is how to optimize the number of nodes in the hidden layer. Experiments show that once the number of hidden nodes in the neural network is too small, the network cannot have the necessary learning and information processing capabilities. Conversely, if the number of hidden nodes in the neural network is too large, it will not only greatly increase the complexity of the network structure (this is especially important for hardware-implemented networks), the neural network is more likely to fall into the local minimum during the learning process, and it will Makes the learning speed of the neural network very slow. The selection of the number of nodes in the hidden layer has been highly valued.
  • the purpose of the present invention is to overcome the existing technical problems, and propose a method, a device and a storage medium for self-incrementing and decreasing of a neural network node, so as to improve the learning ability of the neuron and reduce the useless calculation amount of the neuron.
  • the present invention provides a self-incrementing and subtracting method of a neural network node, which is applied to the training of a neural network model.
  • the original neural network model is labeled as Mo, and the neural network model Mo is performed layer by layer.
  • Self-increasing or decreasing operation processing; the self-increasing or decreasing method includes the following steps:
  • Step 1 Determine whether there are deductible neurons in the current layer. If yes, go to step 2; otherwise, go to step 4;
  • step two the neurons in the current layer are subjected to a subtraction operation, and the neural network model after the subtraction operation processing is marked as Mnew, and the weights and biases of the associated neurons are iteratively updated.
  • the element refers to the neuron of the next layer associated with the deleted neuron; after a certain number of iterations or convergence, iteratively trains the neural network model Mnew after the addition operation process;
  • Step 3 Compare the error function value of the loss function value of the neural network model Mnew after the iterative training with the loss function value of the neural network model Mo before the subtraction operation processing is less than the first set value a1, and then set the neural network model as the neural network.
  • Model Mnew return to step one; otherwise, restore the neural network model to neural network model Mo, and proceed to step four;
  • Step four add the neurons of the current layer to the operation layer, mark the neural network model processed by the operation as Mnew, add a neuron to the current layer, and iterate the weights and biases of the newly added neurons. Update; after a certain number of iterations or convergence, the iterative training neural network model Mnew is then iteratively trained;
  • Step 5 Compare the error function of the neural network model Mnew after the iterative training with the loss function value of the neural network model Mo before the increase operation process is less than the second set value a2, then accept the neural network model Mnew and return Step four, otherwise return to step one to enter the neuron increase / decrease operation processing until all neuron layers are processed.
  • step three when the neural network model Mnew converges or after a certain iteration, the error ratio between the loss function value of the neural network model Mnew and the loss function value of the neural network model Mo before the subtraction operation processing is less than the first set value, then Set the neural network model as the neural network model Mnew; set the loss value of the neural network model Mnew as Lossnew, the loss value of the neural network model Mo as Losso, and the first set value a1, when (Lossnew-Losso) / Losso ⁇ a1 Accept the neural network model Mnew. When (Lossnew-Losso) / Losso ⁇ a1, restore the neural network model to the neural network model Mo.
  • step 5 after the training is completed, the error ratio between the loss function value of the neural network model Mnew and the loss function value of the neural network model Mo before the increase operation processing is less than the second set value, then the neural network model Mnew is accepted;
  • the second set value a2 when (Lossnew-Losso) / Losso ⁇ a2, the neural network model Mnew that has been processed by the increment operation, and when (Lossnew-Losso) / Losso ⁇ a2, the neural network model is restored to the neural network model Mo.
  • judging whether a neuron that can be subtracted exists in the current layer is specifically:
  • the present invention iteratively updates the weights and biases of the associated neurons after performing a subtraction operation on the neurons in the current layer, specifically:
  • the current layer be the i-th layer
  • the current node is the j-th node of the i-th layer
  • the input of the deleted neuron is Xij
  • the input weight vector corresponding to the deleted neuron is Wij
  • the output corresponding to the deleted neuron Foutij F (Xij * Wij);
  • determining whether a neuron that can be subtracted exists in the current layer is specifically:
  • the current layer is the i-th layer, and the next layer is the (i + 1) -th layer, where j ⁇ j ’,
  • is the set value
  • bij is the offset value
  • the neuron in the current layer is subjected to a subtraction operation, specifically, deleting both the node Xij and the node Xij ′, and adding a new neuron Xij ”;
  • Winij ⁇ Winij '> 0
  • Winij " (Winij + Winij') / 2
  • Woutij" Woutij + Woutij ';
  • Woutij" -Woutij + Woutij '.
  • the present invention also provides a self-incrementing and decreasing device of a neural network node, which is applied to the training of a neural network model, which marks the original neural network model as Mo, and layers the neural layer by layer.
  • the network model Mo performs self-increasing and decreasing operations;
  • the self-increasing and decreasing device includes:
  • a model analysis module is used to determine whether there are neurons that can be subtracted in the current layer, and if so, the subtraction operation processing module is executed, otherwise the increment operation processing module is executed;
  • the subtraction operation processing module is configured to perform subtraction processing on the neurons in the current layer, mark the neural network model processed by the subtraction operation as Mnew, and perform iterative update on the weights and offsets of the associated neurons.
  • the associated neuron refers to the neuron in the next layer associated with the deleted neuron; after a certain number of iterations or convergence, the neural network model Mnew after the addition operation is subjected to iterative training;
  • the first error checking module is used to compare the error ratio between the loss function value of the neural network model Mnew after iterative training and the loss function value of the neural network model Mo before the subtraction operation processing is less than the first set value a1, and the neural network
  • the network model is set to the neural network model Mnew, and the model analysis module is returned; otherwise, the neural network model is restored to the neural network model Mo, and an operation processing module is added;
  • the augmented operation processing module is used to augment the neurons in the current layer, and mark the neural network model processed by the augmented operation as Mnew, add a neuron to the current layer, and add the weight and Iteratively update the bias; after a certain number of iterations or convergence, iteratively train the neural network model Mnew after the increase operation is processed;
  • the second error checking module is used to compare the error function value of the loss function value of the neural network model Mnew after the iterative training with the loss function value of the neural network model Mo before the increase operation processing is less than the second set value a2, then the neural network is accepted.
  • the network model Mnew is returned to the increase operation processing module, otherwise it returns to the model analysis module to enter the increase and decrease operation processing of the neurons in the next layer, and ends until all the neuron layers are processed.
  • the present invention also provides a computer-readable storage medium that stores computer instructions, and when the computer instructions are executed by a processor, the self-increment of the neural network node according to any one of the foregoing is implemented. Subtraction method
  • the method, device and storage medium for self-incrementing and decreasing of a neural network node of the present invention can not only improve the learning ability of a neuron, but also calculate Calculate the value of a neuron.
  • its value is less than a set threshold, it indicates that the value of the node is not large and can be deleted; or determine whether the contributions of Xij and Xij 'in the current layer are the same, and delete Xij and Xij ', replaced with Xij ", can reduce the amount of useless computation of neurons.
  • FIG. 1 is a schematic flowchart of a self-incrementing / decreasing method of a neural network node according to Embodiment 1 of the present invention
  • FIG. 2 is a schematic flowchart of a self-incrementing / decreasing method of a neural network node according to Embodiment 2 of the present invention.
  • a neural network is composed of many neurons, and each neuron is also called a unit or a node, and the neurons are connected together to form a network.
  • neurons form multiple layers and are divided into three types of layers: input layer, hidden layer, and output layer, where the first layer is the input layer, and the first layer can contain one or more neurons; the output layer can contain one Or multiple neurons; the hidden layer can be one or more layers, and each layer of neurons will feed their output to the input of the neuron in the next hidden layer.
  • the present invention provides a method for self-incrementing and decreasing of neural network nodes, which is applied to the training of a neural network model.
  • the original neural network model is labeled as Mo and the neural network is layer-by-layer.
  • the model Mo performs self-increasing and decreasing operations; the self-increasing and decreasing method includes the following steps:
  • Step 1 Determine whether there are deductible neurons in the current layer. If yes, go to step 2; otherwise, go to step 4;
  • step two the neurons in the current layer are subjected to a subtraction operation, and the neural network model after the subtraction operation processing is marked as Mnew, and the weights and biases of the associated neurons are iteratively updated.
  • the element refers to the neuron of the next layer associated with the deleted neuron; after a certain number of iterations or convergence, iteratively trains the neural network model Mnew after the addition operation process;
  • Step 3 Compare the error function value of the loss function value of the neural network model Mnew after the iterative training with the loss function value of the neural network model Mo before the subtraction operation processing is less than the first set value a1, and then set the neural network model as the neural network.
  • Model Mnew return to step one; otherwise, restore the neural network model to neural network model Mo, and proceed to step four;
  • Step four add the neurons of the current layer to the operation layer, mark the neural network model processed by the operation as Mnew, add a neuron to the current layer, and iterate the weights and biases of the newly added neurons. Update; after a certain number of iterations or convergence, the iterative training neural network model Mnew is then iteratively trained;
  • Step 5 Compare the error function of the neural network model Mnew after the iterative training with the loss function value of the neural network model Mo before the increase operation process is less than the second set value a2, then accept the neural network model Mnew and return Step four, otherwise return to step one to enter the neuron increase / decrease operation processing until all neuron layers are processed.
  • a threshold value judgment method or a contribution degree judgment method may be adopted, and specific implementation methods are described as follows:
  • Example 1 (accumulating or decreasing neurons according to the threshold method)
  • An embodiment of the present invention provides a method for increasing or decreasing a neural network node, which is applied to training a neural network model.
  • the method for increasing or decreasing a neural network node includes the following steps, as shown in FIG. 1:
  • Step S11 design the neural network structure according to the requirements, and train the neural network model using the data to make the neural network model converge or the number of iterations of the neural network exceeds a certain threshold;
  • step S12 the neuron is increased or decreased layer by layer
  • the current layer is the i-th layer
  • the current node is the j-th node of the i-th layer, denoted as Xij. Whether it is less than the set threshold value.
  • the set threshold value is preferably less than 0.01. It should be noted that the set threshold value can be adjusted according to the model and requirements.
  • the node Xij can be deleted.
  • the expression Calculate the value of a neuron. When its value is less than a set threshold, it indicates that the value of the node is not large, and can be deleted. When its value is greater than or equal to a set threshold, it indicates that the value of the node is large Cannot be deleted;
  • Step S13 Perform a subtraction operation on the neurons in the current layer, delete the node Xij, and mark the neural network model after the subtraction operation as Mnew, where the current layer is the i-th layer;
  • Step S14 Perform iterative training.
  • the neural network model Mnew converges or the value of the loss function of the neural network model Mnew after a certain iteration is compared with the loss function of the neural network model Mo before the increase or decrease operation processing is within an acceptable range, return to step S12; otherwise, restore the neural network model to the neural network model Mo, and proceed to step S15;
  • the current layer be the i-th layer
  • the current node is the j-th node of the i-th layer
  • the input of the deleted neuron is Xij
  • the input weight vector corresponding to the deleted neuron is Wij
  • the output corresponding to the deleted neuron Foutij F (Xij * Wij);
  • step S14 when the neural network model Mnew converges or after a certain iteration, the value of the loss function of the neural network model Mnew is compared with the neural network before the increase or decrease operation processing.
  • the loss function value of the model Mo is in an acceptable range, specifically, the error ratio of the loss function value of the neural network model Mnew after the neural network model Mnew converges or after a certain iteration is compared with the loss function value of the neural network model Mo before the subtraction operation processing.
  • the neural network model is set to the neural network model Mnew, the loss value of the neural network model Mnew is Lossnew, the loss value of the neural network model Mo is Losso, and the first set value is a1, when (Lossnew -Losso) / Losso ⁇ a1, accept the neural network model Mnew, and when (Lossnew-Losso) / Losso ⁇ a1, restore the neural network model to the neural network model Mo, where the first set value a1 can be determined according to the model and Adjustment needs to be made.
  • a1 0 is preferable. It should be noted that a1 may also be greater than 0.
  • step S15 the neurons in the current layer are processed by adding operations, and the neural network model processed by the adding operations is marked as Mnew.
  • a neuron is added to the current layer and randomly initialized.
  • the current layer is the i-th layer.
  • the added neuron is the j-th neuron in the i-th layer, labeled Xij; proceed to step S16;
  • Step S16 using the data to iteratively update only the newly-added neurons Xij Winij and Winoutij, and after a certain number of iterations or convergence, iteratively train the neural network model Mnew after the addition operation is processed; compare the neural network after training The loss function value of the model Mnew and the loss function value of the neural network model Mo. If there is a good change in the value, accept the neural network model Mnew and return to step S15, otherwise return to step S12 to enter the next layer (i.e. (1 layer) The increase and decrease of neurons is processed until all the neuron layers are processed.
  • the next layer i.e. (1 layer
  • step S16 after training, compare the loss function value of the neural network model Mnew with the loss function value of the neural network model Mo. If the value is good Changes in the neural network model Mnew, specifically: comparing the loss function value of the neural network model Mnew after the training with the loss function value of the neural network model Mo before the increase operation is smaller than the second set value, then Accept the neural network model Mnew and set the second set value to a2.
  • (Lossnew-Losso) / Losso ⁇ a2 accept the neural network model Mnew that is processed by the augmented operation.
  • a2 0, of course, a2 can also be greater than zero.
  • Example 2 (increase or decrease neurons based on contribution)
  • An embodiment of the present invention provides a method for increasing or decreasing a neural network node, which is applied to training a neural network model.
  • the method for increasing or decreasing a neural network node includes the following steps, as shown in FIG. 2:
  • Step S21 design the neural network structure according to the requirements, and train the neural network model using the data to make the neural network model converge or the number of iterations of the neural network exceeds a certain threshold;
  • step S22 the neuron is increased or decreased layer by layer
  • the current layer is the i-th layer, and the next layer is the (i + 1) -th layer, where j ⁇ j ’,
  • represents the angle between the two input weights.
  • is less than the set threshold ( ⁇ ) ( ⁇ ⁇ threshold ( ⁇ ))
  • the contribution of Xij and Xij ' is considered to be the same. It can be judged that there is a subtractable node in the current layer.
  • is adjusted according to a specific model and requirements.
  • Step S23 Perform a subtraction operation on the neurons in the current layer, and mark the neural network model after the subtraction operation as Mnew, where the current layer is the i-th layer;
  • step S24 iterative training is performed.
  • the value of the loss function of the neural network model Mnew after convergence or after a certain iteration is compared with the loss function value of the neural network model Mo before the increase or decrease operation processing is within an acceptable range, return to step S22; otherwise, restore the neural network model to the neural network model Mo, and proceed to step S25;
  • step S24 when the neural network model Mnew converges or after a certain iteration, the value of the loss function of the neural network model Mnew and the neural network before the increase and decrease operations are processed.
  • the loss function value of the model Mo is in an acceptable range, specifically, the error ratio of the loss function value of the neural network model Mnew after the neural network model Mnew converges or after a certain iteration is compared with the loss function value of the neural network model Mo before the subtraction operation processing.
  • the neural network model is set to the neural network model Mnew, the loss value of the neural network model Mnew is Lossnew, the loss value of the neural network model Mo is Losso, and the first set value is a1, when (Lossnew -Losso) / Losso ⁇ a1, accept the neural network model Mnew, and when (Lossnew-Losso) / Losso ⁇ a1, restore the neural network model to the neural network model Mo, where the first set value a1 can be determined according to the model and Adjustment needs to be made.
  • a1 ⁇ 0. It should be noted that a1 may be greater than 0.
  • step S25 the neurons in the current layer are processed by adding operations, and the neural network model processed by the adding operations is marked as Mnew.
  • a neuron is added to the current layer and initialized randomly, and the current layer is the i-th layer.
  • the added neuron is the j-th neuron in the i-th layer, labeled Xij; proceed to step S26;
  • step S26 the data is used to iteratively update only the newly-added neurons Xij Winij and Winoutij.
  • the neural network model Mnew after the addition operation is iteratively trained; the neural network is compared after the training is completed The loss function value of the model Mnew and the loss function value of the neural network model Mo. If there is a good change in the value, accept the neural network model Mnew and return to step S25, otherwise return to step S22 to enter the next layer (i.e. (1 layer)
  • the increase and decrease of neurons is processed until all the neuron layers are processed.
  • step S26 after training, compare the loss function value of the neural network model Mnew with the loss function value of the neural network model Mo. If the value is good Changes in the neural network model Mnew, specifically: comparing the loss function value of the neural network model Mnew after the training with the loss function value of the neural network model Mo before the increase operation is smaller than the second set value, then Accept the neural network model Mnew and set the second set value to a2. When (Lossnew-Losso) / Losso ⁇ a2, accept the neural network model Mnew that is processed by the augmented operation.
  • a2 When (Lossnew-Losso) / Losso ⁇ a2, set The neural network model is reduced to a neural network model Mo, where the second set value a2 can be adjusted according to the model and needs.
  • a2 ⁇ 0, of course, a2 can also be greater than 0.
  • Example 3 (device example corresponding to the method)
  • a self-incrementing / decreasing device for a neural network node is also provided, which is applied to the training of a neural network model.
  • the original neural network model is labeled as Mo, and the neural network model Mo is performed layer by layer.
  • Self-increasing or decreasing operation processing; the self-increasing or reducing device includes:
  • a model analysis module is used to determine whether there are neurons that can be subtracted in the current layer, and if so, the subtraction operation processing module is executed, otherwise the increment operation processing module is executed;
  • the subtraction operation processing module is configured to perform subtraction processing on the neurons in the current layer, mark the neural network model processed by the subtraction operation as Mnew, and perform iterative update on the weights and offsets of the associated neurons.
  • the associated neuron refers to the neuron in the next layer associated with the deleted neuron; after a certain number of iterations or convergence, the neural network model Mnew after the addition operation is subjected to iterative training;
  • the first error checking module is used to compare the error ratio between the loss function value of the neural network model Mnew after iterative training and the loss function value of the neural network model Mo before the subtraction operation processing is less than the first set value a1, and the neural network
  • the network model is set to the neural network model Mnew, and the model analysis module is returned; otherwise, the neural network model is restored to the neural network model Mo, and an operation processing module is added;
  • the augmented operation processing module is used to augment the neurons in the current layer, and mark the neural network model processed by the augmented operation as Mnew, add a neuron to the current layer, and add the weight and Iteratively update the bias; after a certain number of iterations or convergence, iteratively train the neural network model Mnew after the increase operation is processed;
  • the second error checking module is used to compare the error function value of the loss function value of the neural network model Mnew after the iterative training with the loss function value of the neural network model Mo before the increase operation processing is less than the second set value a2, then the neural network is accepted.
  • the network model Mnew is returned to the increase operation processing module, otherwise it returns to the model analysis module to enter the increase and decrease operation processing of the neurons in the next layer, and ends until all the neuron layers are processed.
  • the self-increasing or decreasing device includes at least one processor and a memory communicatively connected to the at least one processor, the memory stores instructions executable by the at least one processor, and the instructions are processed by the at least one processor.
  • the processor executes, so that the at least one processor executes a self-incrementing / decreasing method of a neural network node.
  • the self-incrementing / decreasing method of the neural network node is the same as that in Embodiment 1 or 2. The present invention is not described herein again.
  • Embodiment 4 (storage medium corresponding to the method)
  • a computer-readable storage medium stores computer instructions, and the computer instructions are executed by a processor to perform the above-mentioned method for increasing or decreasing a neural network node.
  • the method for self-incrementing and decrementing of network nodes is the same as that in Embodiment 1 or 2. The present invention will not repeat them here.
  • Embodiment 1 and Embodiment 2 of the present invention are two methods for judging whether or not there are subtractable neurons in the current layer. Of course, the two can also be combined under the technical inspiration of the embodiment of the present invention.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computing Systems (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Molecular Biology (AREA)
  • Artificial Intelligence (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Image Analysis (AREA)
  • Feedback Control In General (AREA)

Abstract

Disclosed are a method and device for automatically adding/removing neural network nodes, and a storage medium. The method is such that a neural network structure is designed as required, data is used to train a neural network model, thus allowing the neural network model to converge or the number of iterations of a neural network to exceed a certain threshold; and addition/removal operations are performed with respect to neurons on a per layer basis. The present invention, by means of automatically adding/removing neural network nodes, increases the learning capacity of the neurons on the one hand, and reduces the amount of useless computation for the neurons on the other hand.

Description

神经网络节点的自增减方法、装置及存储介质Method, device and storage medium for self-increment and decrease of neural network nodes 技术领域Technical field
本发明涉及神经网络领域,具体涉及一种神经网络节点的自增减方法、装置及存储介质。The present invention relates to the field of neural networks, and in particular, to a method, device, and storage medium for self-incrementing and decreasing of neural network nodes.
背景技术Background technique
神经网络(Neural Networks,简写为NNs)或称作连接模型(Connection Model),它是一种模仿动物神经网络行为特征,进行分布式并行信息处理的算法数学模型。这种网络依靠系统的复杂程度,通过调整内部大量节点之间相互连接的关系,从而达到处理信息的目的。Neural networks (Neural Networks, abbreviated as NNs), or Connection Models, are mathematical models of algorithms that imitate the behavioral characteristics of animal neural networks and perform distributed parallel information processing. This kind of network depends on the complexity of the system and adjusts the interconnection relationship between a large number of internal nodes to achieve the purpose of processing information.
神经网络由许多神经元组成,每个神经元也称为单元或者节点,神经元连接在一起形成网络。通常,神经元形成多层,分成三种类型的层,输入层、隐层和输出层,其中,第一层为输入层,第一层可包含一个或多个神经元;输出层可包含一个或多个神经元;隐层可以为一层或多层。每一层的神经元将把它们的输出馈送入下一隐层中神经元的输入。A neural network consists of many neurons. Each neuron is also called a unit or a node. Neurons are connected together to form a network. Generally, neurons form multiple layers and are divided into three types of layers: input layer, hidden layer, and output layer, where the first layer is the input layer, and the first layer can contain one or more neurons; the output layer can contain one Or multiple neurons; the hidden layer can be one or more layers. Neurons in each layer will feed their output to the inputs of the neurons in the next hidden layer.
当神经网络的训练集确定之后,输入层节点数和输出层节点数随之而确定,首先遇到的一个十分重要而又困难的问题是如何优化隐层的节点数。实验表明,一旦神经网络的隐层节点数过少,网络不能具有必要的学习能力和信息处理能力。反之,若神经网络的隐层节点数的过多,不仅会大大增加网络结构的复杂性(这一点对硬件实现的网络尤其重要),神经网络在学习过程中更易陷入局部极小点,而且会使神经网络的学习速度变得很慢。隐层的节点数的选择问题一直受到高度重视。After the training set of the neural network is determined, the number of nodes in the input layer and the number of nodes in the output layer are determined accordingly. A very important and difficult problem encountered first is how to optimize the number of nodes in the hidden layer. Experiments show that once the number of hidden nodes in the neural network is too small, the network cannot have the necessary learning and information processing capabilities. Conversely, if the number of hidden nodes in the neural network is too large, it will not only greatly increase the complexity of the network structure (this is especially important for hardware-implemented networks), the neural network is more likely to fall into the local minimum during the learning process, and it will Makes the learning speed of the neural network very slow. The selection of the number of nodes in the hidden layer has been highly valued.
发明内容Summary of the Invention
本发明的目的在于克服现有的技术问题,提出一种神经网络节点的自增减方法、装置及其存储介质,以提高神经元的学习能力,减少神经元的无用计算量。The purpose of the present invention is to overcome the existing technical problems, and propose a method, a device and a storage medium for self-incrementing and decreasing of a neural network node, so as to improve the learning ability of the neuron and reduce the useless calculation amount of the neuron.
为达成上述目的,本发明提供了一种神经网络节点的自增减方法,应用于神经网络模型的训练,其将原始的神经网络模型标记为Mo,并逐层对所述神经网络模型Mo进行自增减操作处理;所述自增减方法包括如下步骤:In order to achieve the above object, the present invention provides a self-incrementing and subtracting method of a neural network node, which is applied to the training of a neural network model. The original neural network model is labeled as Mo, and the neural network model Mo is performed layer by layer. Self-increasing or decreasing operation processing; the self-increasing or decreasing method includes the following steps:
步骤一,判断当前层是否存在可减去的神经元,若是,则进入步骤二,否则进入步骤四;Step 1: Determine whether there are deductible neurons in the current layer. If yes, go to step 2; otherwise, go to step 4;
步骤二,将当前层的神经元进行减操作处理,并将减操作处理后的神经网络模型标记为Mnew,并对相关联的神经元的权重和偏置进行迭代更新,所述相关联的神经元是指与被删除的神经元相关联的下一层的神经元;一定迭代次数或收敛后,再将该增操作处理后 的神经网络模型Mnew进行迭代训练;In step two, the neurons in the current layer are subjected to a subtraction operation, and the neural network model after the subtraction operation processing is marked as Mnew, and the weights and biases of the associated neurons are iteratively updated. The element refers to the neuron of the next layer associated with the deleted neuron; after a certain number of iterations or convergence, iteratively trains the neural network model Mnew after the addition operation process;
步骤三,比较迭代训练后的神经网络模型Mnew的损失函数值与减操作处理前的神经网络模型Mo的损失函数值的误差比小于第一设定值a1,则将神经网络模型设为神经网络模型Mnew,返回步骤一;否则,将神经网络模型还原为神经网络模型Mo,并进入步骤四;Step 3: Compare the error function value of the loss function value of the neural network model Mnew after the iterative training with the loss function value of the neural network model Mo before the subtraction operation processing is less than the first set value a1, and then set the neural network model as the neural network. Model Mnew, return to step one; otherwise, restore the neural network model to neural network model Mo, and proceed to step four;
步骤四,将当前层的神经元进行增操作处理,并将增操作处理后的神经网络模型标记为Mnew,在当前层增添一个神经元,并对新增的神经元的权重和偏置进行迭代更新;一定迭代次数或收敛后,再将该增操作处理后的神经网络模型Mnew进行迭代训练;Step four: add the neurons of the current layer to the operation layer, mark the neural network model processed by the operation as Mnew, add a neuron to the current layer, and iterate the weights and biases of the newly added neurons. Update; after a certain number of iterations or convergence, the iterative training neural network model Mnew is then iteratively trained;
步骤五,比较迭代训练后的神经网络模型Mnew的损失函数值与增操作处理前的神经网络模型Mo的损失函数值的误差比小于第二设定值a2,则接受神经网络模型Mnew,并返回步骤四,否则返回步骤一进入下一层的神经元的增减操作处理,直至所有的神经元层处理完后结束。Step 5: Compare the error function of the neural network model Mnew after the iterative training with the loss function value of the neural network model Mo before the increase operation process is less than the second set value a2, then accept the neural network model Mnew and return Step four, otherwise return to step one to enter the neuron increase / decrease operation processing until all neuron layers are processed.
优选的,步骤三中,当神经网络模型Mnew收敛或一定迭代后神经网络模型Mnew的损失函数值与减操作处理前的神经网络模型Mo的损失函数值的误差比小于第一设定值,则将神经网络模型设为神经网络模型Mnew;设神经网络模型Mnew的损失值为Lossnew,神经网络模型Mo的损失值为Losso,第一设定值a1,当(Lossnew-Losso)/Losso<a1时,接受神经网络模型Mnew,当(Lossnew-Losso)/Losso≥a1时,将神经网络模型还原为神经网络模型Mo。Preferably, in step three, when the neural network model Mnew converges or after a certain iteration, the error ratio between the loss function value of the neural network model Mnew and the loss function value of the neural network model Mo before the subtraction operation processing is less than the first set value, then Set the neural network model as the neural network model Mnew; set the loss value of the neural network model Mnew as Lossnew, the loss value of the neural network model Mo as Losso, and the first set value a1, when (Lossnew-Losso) / Losso <a1 Accept the neural network model Mnew. When (Lossnew-Losso) / Losso≥a1, restore the neural network model to the neural network model Mo.
优选的,步骤五中,训练完毕后比较神经网络模型Mnew的损失函数值与增操作处理前的神经网络模型Mo的损失函数值的误差比小于第二设定值,则接受神经网络模型Mnew;第二设定值a2,当(Lossnew-Losso)/Losso<a2时,接受增操作处理的神经网络模型Mnew,当(Lossnew-Losso)/Losso≥a2时,将神经网络模型还原为神经网络模型Mo。Preferably, in step 5, after the training is completed, the error ratio between the loss function value of the neural network model Mnew and the loss function value of the neural network model Mo before the increase operation processing is less than the second set value, then the neural network model Mnew is accepted; The second set value a2, when (Lossnew-Losso) / Losso <a2, the neural network model Mnew that has been processed by the increment operation, and when (Lossnew-Losso) / Losso≥a2, the neural network model is restored to the neural network model Mo.
进一步的,本发明一实施例,判断当前层是否存在可减去的神经元具体为:Further, according to an embodiment of the present invention, judging whether a neuron that can be subtracted exists in the current layer is specifically:
设当前层为第i层,当前节点为第i层第j个节点,记为Xij,判断
Figure PCTCN2019097181-appb-000001
是否小于设定阈值,若
Figure PCTCN2019097181-appb-000002
小于设定阈值,则节点Xij可删去,其中,Winijt为输入权重向量,t=(1~n),即:Winij={Winij1,Winij2...Winijn,bij};Woutijp为输出权重向量,p=(1~m),即:Woutij={Woutij1,Woutij2...Woutijm},bij为偏置值。
Let the current layer be the i-th layer and the current node be the j-th node of the i-th layer, denoted as Xij, and judge
Figure PCTCN2019097181-appb-000001
Whether it is less than the set threshold, if
Figure PCTCN2019097181-appb-000002
Less than the set threshold, the node Xij can be deleted, where Winijt is the input weight vector, t = (1 ~ n), that is: Winij = {Winij1, Winij2 ... Winijn, bij}; Woutijp is the output weight vector p = (1 ~ m), that is: Woutij = {Woutij1, Woutij2 ... Woutijm}, and bij is an offset value.
进一步的,本发明将当前层的神经元进行减操作处理后,对相关联的神经元的权重和偏置进行迭代更新,具体为:Further, the present invention iteratively updates the weights and biases of the associated neurons after performing a subtraction operation on the neurons in the current layer, specifically:
设当前层为第i层,当前节点为第i层第j个节点,被删除的神经元的输入为Xij,被删除的神经元对应的输入权重向量为Wij,被删除的神经元对应的输出为foutij=F(Xij*Wij);Let the current layer be the i-th layer, the current node is the j-th node of the i-th layer, the input of the deleted neuron is Xij, the input weight vector corresponding to the deleted neuron is Wij, and the output corresponding to the deleted neuron Foutij = F (Xij * Wij);
设对应(i+1)层的相关联的神经元的偏置为b(i+1)j,且所述相关联的神经元的对应的输入权重向量为W(i+1)j,则迭代更新后,偏置的更新值为:b`(i+1)j=b(i+1)j+foutij*W(i+1)j。Let the bias of the associated neuron corresponding to the (i + 1) layer be b (i + 1) j, and the corresponding input weight vector of the associated neuron be W (i + 1) j, then After the iterative update, the offset update value is: b` (i + 1) j = b (i + 1) j + foutij * W (i + 1) j.
进一步的,本发明另一实施例,判断当前层是否存在可减去的神经元具体为:Further, in another embodiment of the present invention, determining whether a neuron that can be subtracted exists in the current layer is specifically:
当前层为第i层,下一层为第(i+1)层,其中,j≠j’,The current layer is the i-th layer, and the next layer is the (i + 1) -th layer, where j ≠ j ’,
取第i层的第j个神经元Xij和第i层的第j’的神经元Xij’,Take the j-th neuron Xij of the i-th layer and the j'-th neuron Xij 'of the i-th layer,
当且仅当Xij和Xij’所连接的第(i+1)层神经元相同时进行比较,
Figure PCTCN2019097181-appb-000003
θ代表了两个输入权重的夹角,当θ小于设定的threshold(Ф)时,判断当前层存在可减去节点;
Compare if and only if the (i + 1) th layer of neurons connected to Xij and Xij 'are the same,
Figure PCTCN2019097181-appb-000003
θ represents the angle between the two input weights. When θ is less than the set threshold (Ф), it is judged that there is a subtractable node in the current layer;
其中,Ф为设定值;Xij的输入权重向量为Winij={Winij1,Winij2...Winijn,bij},Xij的输出权重向量为Woutij={Woutij1,Woutij2...Woutijm},bij为偏置值;Among them, Ф is the set value; the input weight vector of Xij is Winij = {Winij1, Winij2 ... Winijn, bij}, the output weight vector of Xij is Woutij = {Woutij1, Woutij2 ... Woutijm}, and bij is the offset value;
Xij’的输入权重向量为Winij’={Winij’1,Winij’2...Winij’n,bij’},Xij’的输出权重向量为Woutij’={Woutij’1,Woutij’2...Woutij’m},bij’为偏置值。The input weight vector of Xij 'is Winij' = {Winij'1, Winij'2 ... Winij'n, bij '}, and the output weight vector of Xij' is Woutij '= {Woutij'1, Woutij'2 ... Woutij'm}, bij 'is the offset value.
进一步的,上述的神经网络节点的自增减方法中,将当前层的神经元进行减操作处理,具体为将节点Xij和节点Xij’均删除,并增加一个新的神经元Xij”;Further, in the self-incrementing and subtracting method of the neural network node described above, the neuron in the current layer is subjected to a subtraction operation, specifically, deleting both the node Xij and the node Xij ′, and adding a new neuron Xij ”;
当Winij·Winij'>0,Winij”=(Winij+Winij')/2,Woutij”=Woutij+Woutij';When Winij · Winij '> 0, Winij "= (Winij + Winij') / 2, Woutij" = Woutij + Woutij ';
当Winij·Winij'<0,Winij”=(-Winij+Winij')/2,Woutij”=-Woutij+Woutij'。When Winij · Winij '<0, Winij "= (-Winij + Winij') / 2, Woutij" =-Woutij + Woutij '.
与所述方法相对应的,本发明还提供了一种神经网络节点的自增减装置,应用于神经网络模型的训练,其将原始的神经网络模型标记为Mo,并逐层对所述神经网络模型Mo进行自增减操作处理;所述自增减装置包括:Corresponding to the method, the present invention also provides a self-incrementing and decreasing device of a neural network node, which is applied to the training of a neural network model, which marks the original neural network model as Mo, and layers the neural layer by layer. The network model Mo performs self-increasing and decreasing operations; the self-increasing and decreasing device includes:
模型分析模块,用于判断当前层是否存在可减去的神经元,若是,则执行减操作处理模块,否则执行增操作处理模块;A model analysis module is used to determine whether there are neurons that can be subtracted in the current layer, and if so, the subtraction operation processing module is executed, otherwise the increment operation processing module is executed;
减操作处理模块,用于将当前层的神经元进行减操作处理,并将减操作处理后的神经网络模型标记为Mnew,并对相关联的神经元的权重和偏置进行迭代更新,所述相关联的神经元是指与被删除的神经元相关联的下一层的神经元;一定迭代次数或收敛后,再将该增操作处理后的神经网络模型Mnew进行迭代训练;The subtraction operation processing module is configured to perform subtraction processing on the neurons in the current layer, mark the neural network model processed by the subtraction operation as Mnew, and perform iterative update on the weights and offsets of the associated neurons. The associated neuron refers to the neuron in the next layer associated with the deleted neuron; after a certain number of iterations or convergence, the neural network model Mnew after the addition operation is subjected to iterative training;
第一误差校验模块,用于比较迭代训练后的神经网络模型Mnew的损失函数值与减操作处理前的神经网络模型Mo的损失函数值的误差比小于第一设定值a1,则将神经网络模型设为神经网络模型Mnew,返回模型分析模块;否则,将神经网络模型还原为神经网络模型Mo,并执行增操作处理模块;The first error checking module is used to compare the error ratio between the loss function value of the neural network model Mnew after iterative training and the loss function value of the neural network model Mo before the subtraction operation processing is less than the first set value a1, and the neural network The network model is set to the neural network model Mnew, and the model analysis module is returned; otherwise, the neural network model is restored to the neural network model Mo, and an operation processing module is added;
增操作处理模块,用于将当前层的神经元进行增操作处理,并将增操作处理后的神经网络模型标记为Mnew,在当前层增添一个神经元,并对新增的神经元的权重和偏置进行迭代更新;一定迭代次数或收敛后,再将该增操作处理后的神经网络模型Mnew进行迭代训练;The augmented operation processing module is used to augment the neurons in the current layer, and mark the neural network model processed by the augmented operation as Mnew, add a neuron to the current layer, and add the weight and Iteratively update the bias; after a certain number of iterations or convergence, iteratively train the neural network model Mnew after the increase operation is processed;
第二误差校验模块,用于比较迭代训练后的神经网络模型Mnew的损失函数值与增操作处理前的神经网络模型Mo的损失函数值的误差比小于第二设定值a2,则接受神经网络模型Mnew,并返回增操作处理模块,否则返回模型分析模块进入下一层的神经元的增减操作处理,直至所有的神经元层处理完后结束。The second error checking module is used to compare the error function value of the loss function value of the neural network model Mnew after the iterative training with the loss function value of the neural network model Mo before the increase operation processing is less than the second set value a2, then the neural network is accepted. The network model Mnew is returned to the increase operation processing module, otherwise it returns to the model analysis module to enter the increase and decrease operation processing of the neurons in the next layer, and ends until all the neuron layers are processed.
进一步的,本发还提供了一种计算机可读存储介质,所述计算机可读存储介质存储计算机指令,所述计算机指令被处理器执行时实现上述任一项所述的神经网络节点的自增减方法Further, the present invention also provides a computer-readable storage medium that stores computer instructions, and when the computer instructions are executed by a processor, the self-increment of the neural network node according to any one of the foregoing is implemented. Subtraction method
本发明的神经网络节点的自增减方法、装置及存储介质,与现有技术相比,本发明通过自动增减神经网络节点,一方面不仅能够提高神经元的学习能力,另一方面通过计算
Figure PCTCN2019097181-appb-000004
计算一个神经元的价值,当其值小于一个设定的阈值的时候,表明该节点的价值不大,可以删去;或者判断该当前层的Xij和Xij’的贡献是否相同,并删除Xij和Xij’,用Xij”进行替代,可以减少神经元的无用计算量。
Compared with the prior art, the method, device and storage medium for self-incrementing and decreasing of a neural network node of the present invention can not only improve the learning ability of a neuron, but also calculate
Figure PCTCN2019097181-appb-000004
Calculate the value of a neuron. When its value is less than a set threshold, it indicates that the value of the node is not large and can be deleted; or determine whether the contributions of Xij and Xij 'in the current layer are the same, and delete Xij and Xij ', replaced with Xij ", can reduce the amount of useless computation of neurons.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
此处所说明的附图用来提供对发明的进一步理解,构成本发明的一部分,本发明的示意性实施例及其说明用于解释本发明,并不构成对本发明的不当限定。在附图中:The drawings described herein are used to provide a further understanding of the invention and constitute a part of the invention. The exemplary embodiments of the invention and the description thereof are used to explain the invention, and do not constitute an improper limitation on the invention. In the drawings:
图1为本发明实施例1的所述神经网络节点的自增减方法的流程示意图;FIG. 1 is a schematic flowchart of a self-incrementing / decreasing method of a neural network node according to Embodiment 1 of the present invention; FIG.
图2为本发明实施例2的所述神经网络节点的自增减方法的流程示意图。FIG. 2 is a schematic flowchart of a self-incrementing / decreasing method of a neural network node according to Embodiment 2 of the present invention.
具体实施方式detailed description
为了使本发明所要解决的技术问题、技术方案及有益效果更加清楚、明白,以下结合附图和实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本发明,并不用于限定本发明。In order to make the technical problems, technical solutions and beneficial effects to be more clearly understood by the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
本发明中,神经网络由许多神经元组成,每个神经元也称为单元或者节点,神经元连接在一起形成网络。通常,神经元形成多层,分成三种类型的层,输入层、隐层和输出层,其中,第一层为输入层,第一层可包含一个或多个神经元;输出层可包含一个或多个神经元;隐层可以为一层或多层,每一层的神经元将把它们的输出馈送入下一隐层中神经元的输入。In the present invention, a neural network is composed of many neurons, and each neuron is also called a unit or a node, and the neurons are connected together to form a network. Generally, neurons form multiple layers and are divided into three types of layers: input layer, hidden layer, and output layer, where the first layer is the input layer, and the first layer can contain one or more neurons; the output layer can contain one Or multiple neurons; the hidden layer can be one or more layers, and each layer of neurons will feed their output to the input of the neuron in the next hidden layer.
本发明为了优化隐层的节点数,提供了一种神经网络节点的自增减方法,应用于神经 网络模型的训练,其将原始的神经网络模型标记为Mo,并逐层对所述神经网络模型Mo进行自增减操作处理;所述自增减方法包括如下步骤:In order to optimize the number of nodes in the hidden layer, the present invention provides a method for self-incrementing and decreasing of neural network nodes, which is applied to the training of a neural network model. The original neural network model is labeled as Mo and the neural network is layer-by-layer. The model Mo performs self-increasing and decreasing operations; the self-increasing and decreasing method includes the following steps:
步骤一,判断当前层是否存在可减去的神经元,若是,则进入步骤二,否则进入步骤四;Step 1: Determine whether there are deductible neurons in the current layer. If yes, go to step 2; otherwise, go to step 4;
步骤二,将当前层的神经元进行减操作处理,并将减操作处理后的神经网络模型标记为Mnew,并对相关联的神经元的权重和偏置进行迭代更新,所述相关联的神经元是指与被删除的神经元相关联的下一层的神经元;一定迭代次数或收敛后,再将该增操作处理后的神经网络模型Mnew进行迭代训练;In step two, the neurons in the current layer are subjected to a subtraction operation, and the neural network model after the subtraction operation processing is marked as Mnew, and the weights and biases of the associated neurons are iteratively updated. The element refers to the neuron of the next layer associated with the deleted neuron; after a certain number of iterations or convergence, iteratively trains the neural network model Mnew after the addition operation process;
步骤三,比较迭代训练后的神经网络模型Mnew的损失函数值与减操作处理前的神经网络模型Mo的损失函数值的误差比小于第一设定值a1,则将神经网络模型设为神经网络模型Mnew,返回步骤一;否则,将神经网络模型还原为神经网络模型Mo,并进入步骤四;Step 3: Compare the error function value of the loss function value of the neural network model Mnew after the iterative training with the loss function value of the neural network model Mo before the subtraction operation processing is less than the first set value a1, and then set the neural network model as the neural network. Model Mnew, return to step one; otherwise, restore the neural network model to neural network model Mo, and proceed to step four;
步骤四,将当前层的神经元进行增操作处理,并将增操作处理后的神经网络模型标记为Mnew,在当前层增添一个神经元,并对新增的神经元的权重和偏置进行迭代更新;一定迭代次数或收敛后,再将该增操作处理后的神经网络模型Mnew进行迭代训练;Step four: add the neurons of the current layer to the operation layer, mark the neural network model processed by the operation as Mnew, add a neuron to the current layer, and iterate the weights and biases of the newly added neurons. Update; after a certain number of iterations or convergence, the iterative training neural network model Mnew is then iteratively trained;
步骤五,比较迭代训练后的神经网络模型Mnew的损失函数值与增操作处理前的神经网络模型Mo的损失函数值的误差比小于第二设定值a2,则接受神经网络模型Mnew,并返回步骤四,否则返回步骤一进入下一层的神经元的增减操作处理,直至所有的神经元层处理完后结束。Step 5: Compare the error function of the neural network model Mnew after the iterative training with the loss function value of the neural network model Mo before the increase operation process is less than the second set value a2, then accept the neural network model Mnew and return Step four, otherwise return to step one to enter the neuron increase / decrease operation processing until all neuron layers are processed.
其中,如何判断是否需要进行增减操作,可采用阈值判断法或贡献度判断法,具体实施方式说明如下:Among them, how to determine whether an increase or decrease operation is required, a threshold value judgment method or a contribution degree judgment method may be adopted, and specific implementation methods are described as follows:
实施例1(根据阈值法进行增减神经元)Example 1 (accumulating or decreasing neurons according to the threshold method)
本发明实施例提供了一种神经网络节点的自增减方法,应用于神经网络模型的训练,所述神经网络节点的自增减方法包括如下步骤,如附图1所示:An embodiment of the present invention provides a method for increasing or decreasing a neural network node, which is applied to training a neural network model. The method for increasing or decreasing a neural network node includes the following steps, as shown in FIG. 1:
步骤S11,根据需求设计神经网络结构,并使用数据对神经网络模型进行训练,使神经网络模型收敛或者神经网络的迭代次数超过一定的阈值;Step S11: design the neural network structure according to the requirements, and train the neural network model using the data to make the neural network model converge or the number of iterations of the neural network exceeds a certain threshold;
步骤S12,逐层对神经元进行增减操作处理;In step S12, the neuron is increased or decreased layer by layer;
将当前的神经网络模型标记为Mo,判断当前层是否存在可减去的神经元,若当前层存在可减去的神经元,则进入步骤S13,否则,进入步骤S15;Mark the current neural network model as Mo to determine whether there are deductible neurons in the current layer. If there are deductible neurons in the current layer, go to step S13, otherwise, go to step S15;
其中,当前层为第i层,当前节点为第i层第j个节点,记为Xij,判断
Figure PCTCN2019097181-appb-000005
是否小于设定阈值,在本发明实施例,优选地,设定阈值小于0.01,需要说明的是,设定阈值可以根据模型和需求进行调整。
Among them, the current layer is the i-th layer, and the current node is the j-th node of the i-th layer, denoted as Xij.
Figure PCTCN2019097181-appb-000005
Whether it is less than the set threshold value. In the embodiment of the present invention, the set threshold value is preferably less than 0.01. It should be noted that the set threshold value can be adjusted according to the model and requirements.
Figure PCTCN2019097181-appb-000006
小于设定阈值,则该节点Xij可删去。该表达式
Figure PCTCN2019097181-appb-000007
计算一个神经元的价值,当其值小于一个设定的阈值的时候,表明该节点的价值不大,可以删去,当其值大于等于一个设定的阈值的时候,表明该节点的价值大,不可删去;
If
Figure PCTCN2019097181-appb-000006
Less than the set threshold, the node Xij can be deleted. The expression
Figure PCTCN2019097181-appb-000007
Calculate the value of a neuron. When its value is less than a set threshold, it indicates that the value of the node is not large, and can be deleted. When its value is greater than or equal to a set threshold, it indicates that the value of the node is large Cannot be deleted;
其中,Winijt为输入权重向量,t=(1~n),即:Winij={Winij1,Winij2...Winijn,bij};Woutijp为输出权重向量,p=(1~m),即:Woutij={Woutij1,Woutij2...Woutijm},bij为偏置值。Among them, Winijt is the input weight vector, t = (1 ~ n), that is: Winij = {Winij1, Winij2 ... Winijn, bij}; Woutijp is the output weight vector, p = (1 ~ m), that is: Woutij = {Woutij1, Woutij2 ... Woutijm}, and bij is the offset value.
步骤S13,将当前层的神经元进行减操作处理,将该节点Xij删除,并将减操作处理后的神经网络模型标记为Mnew,所述当前层为第i层;Step S13: Perform a subtraction operation on the neurons in the current layer, delete the node Xij, and mark the neural network model after the subtraction operation as Mnew, where the current layer is the i-th layer;
步骤S14,进行迭代训练,当神经网络模型Mnew收敛或一定迭代后神经网络模型Mnew的损失函数的值与增减操作处理前的神经网络模型Mo的损失函数值比较在可接受范围,则返回步骤S12;否则将神经网络模型还原为神经网络模型Mo,并进入步骤S15;Step S14: Perform iterative training. When the neural network model Mnew converges or the value of the loss function of the neural network model Mnew after a certain iteration is compared with the loss function of the neural network model Mo before the increase or decrease operation processing is within an acceptable range, return to step S12; otherwise, restore the neural network model to the neural network model Mo, and proceed to step S15;
对于i层,第j个神经元,其权重表达为Wij={Wij1,Wij2,..Wijn,bij},n为输入个数,bij为偏置值;其输出权重向量为Wijout={Wijout1,Wijout2,..Wijoutm},m为i+1层将该神经元作为输入的个数。For the i layer, the jth neuron has its weight expressed as Wij = {Wij1, Wij2, .. Wijn, bij}, n is the number of inputs, and bij is the bias value; its output weight vector is Wijout = {Wijout1, Wijout2, .. Wijoutm}, where m is the number of i + 1 layers that use this neuron as input.
由于第i层减去部分神经元会影响到i+1层的输入,当符合减操作时,进行如下优化,以减少该减操作带来的影响;即,本实施例中将当前层的神经元进行减操作处理后,还进一步对相关联的神经元的权重和偏置进行迭代更新,具体为:Since subtracting some neurons from the i-th layer will affect the input of the i + 1 layer, when the subtraction operation is met, the following optimizations are performed to reduce the impact of the subtraction operation; that is, the neurons in the current layer are replaced in this embodiment. After the element performs the subtraction operation, it further iteratively updates the weights and biases of the associated neurons, specifically:
设当前层为第i层,当前节点为第i层第j个节点,被删除的神经元的输入为Xij,被删除的神经元对应的输入权重向量为Wij,被删除的神经元对应的输出为foutij=F(Xij*Wij);Let the current layer be the i-th layer, the current node is the j-th node of the i-th layer, the input of the deleted neuron is Xij, the input weight vector corresponding to the deleted neuron is Wij, and the output corresponding to the deleted neuron Foutij = F (Xij * Wij);
设对应(i+1)层的相关联的神经元的偏置为b(i+1)j,且所述相关联的神经元的对应的输入权重向量为W(i+1)j,则迭代更新后,偏置的更新值为:b`(i+1)j=b(i+1)j+foutij*W(i+1)j。Let the bias of the associated neuron corresponding to the (i + 1) layer be b (i + 1) j, and the corresponding input weight vector of the associated neuron be W (i + 1) j, then After the iterative update, the offset update value is: b` (i + 1) j = b (i + 1) j + foutij * W (i + 1) j.
神经网络模型的损失函数值越小,代表其模型性能越好,在步骤S14中,当神经网络模型Mnew收敛或一定迭代后神经网络模型Mnew的损失函数的值与增减操作处理前的神经网络模型Mo的损失函数值比较在可接受范围,具体为,当神经网络模型Mnew收敛或一定迭代后神经网络模型Mnew的损失函数值与减操作处理前的神经网络模型Mo的损失函数值的误差比小于第一设定值,则将神经网络模型设为神经网络模型Mnew,设神经网络模型Mnew的损失值为Lossnew,神经网络模型Mo的损失值为Losso,第一设定值a1,当(Lossnew-Losso)/Losso<a1时,接受神经网络模型Mnew,当(Lossnew-Losso)/Losso≥a1时,将神经网络模型还原为神经网络模型Mo,其中,第一设定值a1可以根据模型和需要进行调整,在本发明实施例优选地,a1=0,需要说明的是, a1也可以大于0。The smaller the loss function value of the neural network model, the better its model performance. In step S14, when the neural network model Mnew converges or after a certain iteration, the value of the loss function of the neural network model Mnew is compared with the neural network before the increase or decrease operation processing. The loss function value of the model Mo is in an acceptable range, specifically, the error ratio of the loss function value of the neural network model Mnew after the neural network model Mnew converges or after a certain iteration is compared with the loss function value of the neural network model Mo before the subtraction operation processing. Less than the first set value, the neural network model is set to the neural network model Mnew, the loss value of the neural network model Mnew is Lossnew, the loss value of the neural network model Mo is Losso, and the first set value is a1, when (Lossnew -Losso) / Losso <a1, accept the neural network model Mnew, and when (Lossnew-Losso) / Losso≥a1, restore the neural network model to the neural network model Mo, where the first set value a1 can be determined according to the model and Adjustment needs to be made. In the embodiment of the present invention, a1 = 0 is preferable. It should be noted that a1 may also be greater than 0.
步骤S15,将当前层的神经元进行增操作处理,并将增操作处理后的神经网络模型标记为Mnew,在当前层增添一个神经元,并随机进行初始化,所述当前层为第i层,该增添的神经元为第i层第j个神经元,标记为Xij;进入步骤S16;In step S15, the neurons in the current layer are processed by adding operations, and the neural network model processed by the adding operations is marked as Mnew. A neuron is added to the current layer and randomly initialized. The current layer is the i-th layer. The added neuron is the j-th neuron in the i-th layer, labeled Xij; proceed to step S16;
步骤S16,使用数据仅对新增的神经元Xij的Winij和Winoutij进行迭代更新,一定迭代次数或收敛后,再将该增操作处理后的神经网络模型Mnew进行迭代训练;训练完毕后比较神经网络模型Mnew的损失函数值和神经网络模型Mo的损失函数值,如果该值有很好的变化,则接受神经网络模型Mnew,并返回步骤S15,否则返回步骤S12进入下一层(即第i+1层)神经元的增减操作处理,直至所有的神经元层处理完后结束。Step S16, using the data to iteratively update only the newly-added neurons Xij Winij and Winoutij, and after a certain number of iterations or convergence, iteratively train the neural network model Mnew after the addition operation is processed; compare the neural network after training The loss function value of the model Mnew and the loss function value of the neural network model Mo. If there is a good change in the value, accept the neural network model Mnew and return to step S15, otherwise return to step S12 to enter the next layer (i.e. (1 layer) The increase and decrease of neurons is processed until all the neuron layers are processed.
神经网络模型的损失函数值越小,代表其模型性能越好,在步骤S16中,训练完毕后比较神经网络模型Mnew的损失函数值和神经网络模型Mo的损失函数值,如果该值有很好的变化,则接受神经网络模型Mnew,具体为:训练完毕后比较神经网络模型Mnew的损失函数值与增操作处理前的神经网络模型Mo的损失函数值的误差比小于第二设定值,则接受神经网络模型Mnew,设第二设定值为a2,当(Lossnew-Losso)/Losso<a2时,接受增操作处理的神经网络模型Mnew,当(Lossnew-Losso)/Losso≥a2时,将神经网络模型还原为神经网络模型Mo,其中,第二设定值a2可以根据模型和需要进行调整,在本发明实施例优选地,a2=0,当然a2也可以大于0。The smaller the loss function value of the neural network model, the better its model performance. In step S16, after training, compare the loss function value of the neural network model Mnew with the loss function value of the neural network model Mo. If the value is good Changes in the neural network model Mnew, specifically: comparing the loss function value of the neural network model Mnew after the training with the loss function value of the neural network model Mo before the increase operation is smaller than the second set value, then Accept the neural network model Mnew and set the second set value to a2. When (Lossnew-Losso) / Losso <a2, accept the neural network model Mnew that is processed by the augmented operation. When (Lossnew-Losso) / Losso≥a2, set The neural network model is reduced to a neural network model Mo, where the second set value a2 can be adjusted according to the model and needs. In the embodiment of the present invention, preferably, a2 = 0, of course, a2 can also be greater than zero.
实施例2(根据贡献度进行增减神经元)Example 2 (increase or decrease neurons based on contribution)
本发明实施例提供了一种神经网络节点的自增减方法,应用于神经网络模型的训练,所述神经网络节点的自增减方法包括如下步骤,如附图2所示:An embodiment of the present invention provides a method for increasing or decreasing a neural network node, which is applied to training a neural network model. The method for increasing or decreasing a neural network node includes the following steps, as shown in FIG. 2:
步骤S21,根据需求设计神经网络结构,并使用数据对神经网络模型进行训练,使神经网络模型收敛或者神经网络的迭代次数超过一定的阈值;Step S21: design the neural network structure according to the requirements, and train the neural network model using the data to make the neural network model converge or the number of iterations of the neural network exceeds a certain threshold;
步骤S22,逐层对神经元进行增减操作处理;In step S22, the neuron is increased or decreased layer by layer;
将当前的神经网络模型标记为Mo,判断当前层是否存在可减去的神经元,若当前层存在可减去的神经元,则进入步骤S23,否则,进入步骤S25;Mark the current neural network model as Mo, and determine whether there are deductible neurons in the current layer. If there are deductible neurons in the current layer, go to step S23, otherwise, go to step S25;
当前层为第i层,下一层为第(i+1)层,其中,j≠j’,The current layer is the i-th layer, and the next layer is the (i + 1) -th layer, where j ≠ j ’,
取第i层的第j个神经元Xij和第i层的第j’的神经元Xij’,Take the j-th neuron Xij of the i-th layer and the j'-th neuron Xij 'of the i-th layer,
当且仅当Xij和Xij’所连接的第(i+1)层神经元相同时进行比较,
Figure PCTCN2019097181-appb-000008
θ代表了两个输入权重的夹角,当θ小于设定的threshold(Ф)时(θ<threshold(Ф)),认为Xij和Xij’的贡献是相同的,判断当前层存在可减去节点;在本发明实施例优选地,Ф<1°,需要说明的是,其中,Ф至根据具体模型和需求调整。
Compare if and only if the (i + 1) th layer of neurons connected to Xij and Xij 'are the same,
Figure PCTCN2019097181-appb-000008
θ represents the angle between the two input weights. When θ is less than the set threshold (Ф) (θ <threshold (Ф)), the contribution of Xij and Xij 'is considered to be the same. It can be judged that there is a subtractable node in the current layer. In the embodiment of the present invention, preferably, Φ <1 °, it should be noted that, Φ to is adjusted according to a specific model and requirements.
步骤S23,将当前层的神经元进行减操作处理,并将减操作处理后的神经网络模型标 记为Mnew,所述当前层为第i层;Step S23: Perform a subtraction operation on the neurons in the current layer, and mark the neural network model after the subtraction operation as Mnew, where the current layer is the i-th layer;
将当前层的神经元进行减操作处理,同时去掉Xij和Xij’,以一个新的神经元Xij”替代两者作,具体为将节点Xij和节点Xij’均删除,并增加一个新的神经元Xij”,Subtract the neurons in the current layer, remove Xij and Xij 'at the same time, replace them with a new neuron Xij ", specifically delete both nodes Xij and Xij', and add a new neuron Xij ",
其中当Winij·Winij'>0,Winij”=(Winij+Winij')/2,Woutij”=Woutij+Woutij';当Winij·Winij'<0,Winij”=(-Winij+Winij')/2,Woutij”=-Woutij+Woutij';When Winij · Winij '> 0, Winij "= (Winij + Winij') / 2, Woutij" = Woutij + Woutij '; When Winij · Winij' <0, Winij "= (-Winij + Winij ') / 2, Woutij "=-Woutij + Woutij ';
步骤S24,进行迭代训练,当神经网络模型Mnew收敛或一定迭代后神经网络模型Mnew的损失函数的值与增减操作处理前的神经网络模型Mo的损失函数值比较在可接受范围,则返回步骤S22;否则将神经网络模型还原为神经网络模型Mo,并进入步骤S25;In step S24, iterative training is performed. When the value of the loss function of the neural network model Mnew after convergence or after a certain iteration is compared with the loss function value of the neural network model Mo before the increase or decrease operation processing is within an acceptable range, return to step S22; otherwise, restore the neural network model to the neural network model Mo, and proceed to step S25;
神经网络模型的损失函数值越小,代表其模型性能越好,在步骤S24中,当神经网络模型Mnew收敛或一定迭代后神经网络模型Mnew的损失函数的值与增减操作处理前的神经网络模型Mo的损失函数值比较在可接受范围,具体为,当神经网络模型Mnew收敛或一定迭代后神经网络模型Mnew的损失函数值与减操作处理前的神经网络模型Mo的损失函数值的误差比小于第一设定值,则将神经网络模型设为神经网络模型Mnew,设神经网络模型Mnew的损失值为Lossnew,神经网络模型Mo的损失值为Losso,第一设定值a1,当(Lossnew-Losso)/Losso<a1时,接受神经网络模型Mnew,当(Lossnew-Losso)/Losso≥a1时,将神经网络模型还原为神经网络模型Mo,其中,第一设定值a1可以根据模型和需要进行调整,在本发明实施例优选地,a1≤0,需要说明的是,a1可以大于0。The smaller the loss function value of the neural network model is, the better its model performance is. In step S24, when the neural network model Mnew converges or after a certain iteration, the value of the loss function of the neural network model Mnew and the neural network before the increase and decrease operations are processed. The loss function value of the model Mo is in an acceptable range, specifically, the error ratio of the loss function value of the neural network model Mnew after the neural network model Mnew converges or after a certain iteration is compared with the loss function value of the neural network model Mo before the subtraction operation processing. Less than the first set value, the neural network model is set to the neural network model Mnew, the loss value of the neural network model Mnew is Lossnew, the loss value of the neural network model Mo is Losso, and the first set value is a1, when (Lossnew -Losso) / Losso <a1, accept the neural network model Mnew, and when (Lossnew-Losso) / Losso≥a1, restore the neural network model to the neural network model Mo, where the first set value a1 can be determined according to the model and Adjustment needs to be made. In the embodiment of the present invention, preferably a1 ≦ 0. It should be noted that a1 may be greater than 0.
步骤S25,将当前层的神经元进行增操作处理,并将增操作处理后的神经网络模型标记为Mnew,在当前层增添一个神经元,并随机进行初始化,所述当前层为第i层,该增添的神经元为第i层第j个神经元,标记为Xij;进入步骤S26;In step S25, the neurons in the current layer are processed by adding operations, and the neural network model processed by the adding operations is marked as Mnew. A neuron is added to the current layer and initialized randomly, and the current layer is the i-th layer. The added neuron is the j-th neuron in the i-th layer, labeled Xij; proceed to step S26;
步骤S26,使用数据仅对新增的神经元Xij的Winij和Winoutij进行迭代更新,一定迭代次数或收敛后,再将该增操作处理后的神经网络模型Mnew进行迭代训练;训练完毕后比较神经网络模型Mnew的损失函数值和神经网络模型Mo的损失函数值,如果该值有很好的变化,则接受神经网络模型Mnew,并返回步骤S25,否则返回步骤S22进入下一层(即第i+1层)神经元的增减操作处理,直至所有的神经元层处理完后结束。In step S26, the data is used to iteratively update only the newly-added neurons Xij Winij and Winoutij. After a certain number of iterations or convergence, the neural network model Mnew after the addition operation is iteratively trained; the neural network is compared after the training is completed The loss function value of the model Mnew and the loss function value of the neural network model Mo. If there is a good change in the value, accept the neural network model Mnew and return to step S25, otherwise return to step S22 to enter the next layer (i.e. (1 layer) The increase and decrease of neurons is processed until all the neuron layers are processed.
神经网络模型的损失函数值越小,代表其模型性能越好,在步骤S26中,训练完毕后比较神经网络模型Mnew的损失函数值和神经网络模型Mo的损失函数值,如果该值有很好的变化,则接受神经网络模型Mnew,具体为:训练完毕后比较神经网络模型Mnew的损失函数值与增操作处理前的神经网络模型Mo的损失函数值的误差比小于第二设定值,则接受神经网络模型Mnew,设第二设定值为a2,当(Lossnew-Losso)/Losso<a2时,接受增操作处理的神经网络模型Mnew,当(Lossnew-Losso)/Losso≥a2时,将神经网络模 型还原为神经网络模型Mo,其中,第二设定值a2可以根据模型和需要进行调整,在本发明实施例优选地,a2≤0,当然a2也可以大于0。The smaller the loss function value of the neural network model, the better its model performance. In step S26, after training, compare the loss function value of the neural network model Mnew with the loss function value of the neural network model Mo. If the value is good Changes in the neural network model Mnew, specifically: comparing the loss function value of the neural network model Mnew after the training with the loss function value of the neural network model Mo before the increase operation is smaller than the second set value, then Accept the neural network model Mnew and set the second set value to a2. When (Lossnew-Losso) / Losso <a2, accept the neural network model Mnew that is processed by the augmented operation. When (Lossnew-Losso) / Losso≥a2, set The neural network model is reduced to a neural network model Mo, where the second set value a2 can be adjusted according to the model and needs. In the embodiment of the present invention, preferably, a2 ≤ 0, of course, a2 can also be greater than 0.
实施例3(与方法对应的装置实施例)Example 3 (device example corresponding to the method)
在本发明实施例,还提供了一种神经网络节点的自增减装置,应用于神经网络模型的训练,其将原始的神经网络模型标记为Mo,并逐层对所述神经网络模型Mo进行自增减操作处理;所述自增减装置包括:In the embodiment of the present invention, a self-incrementing / decreasing device for a neural network node is also provided, which is applied to the training of a neural network model. The original neural network model is labeled as Mo, and the neural network model Mo is performed layer by layer. Self-increasing or decreasing operation processing; the self-increasing or reducing device includes:
模型分析模块,用于判断当前层是否存在可减去的神经元,若是,则执行减操作处理模块,否则执行增操作处理模块;A model analysis module is used to determine whether there are neurons that can be subtracted in the current layer, and if so, the subtraction operation processing module is executed, otherwise the increment operation processing module is executed;
减操作处理模块,用于将当前层的神经元进行减操作处理,并将减操作处理后的神经网络模型标记为Mnew,并对相关联的神经元的权重和偏置进行迭代更新,所述相关联的神经元是指与被删除的神经元相关联的下一层的神经元;一定迭代次数或收敛后,再将该增操作处理后的神经网络模型Mnew进行迭代训练;The subtraction operation processing module is configured to perform subtraction processing on the neurons in the current layer, mark the neural network model processed by the subtraction operation as Mnew, and perform iterative update on the weights and offsets of the associated neurons. The associated neuron refers to the neuron in the next layer associated with the deleted neuron; after a certain number of iterations or convergence, the neural network model Mnew after the addition operation is subjected to iterative training;
第一误差校验模块,用于比较迭代训练后的神经网络模型Mnew的损失函数值与减操作处理前的神经网络模型Mo的损失函数值的误差比小于第一设定值a1,则将神经网络模型设为神经网络模型Mnew,返回模型分析模块;否则,将神经网络模型还原为神经网络模型Mo,并执行增操作处理模块;The first error checking module is used to compare the error ratio between the loss function value of the neural network model Mnew after iterative training and the loss function value of the neural network model Mo before the subtraction operation processing is less than the first set value a1, and the neural network The network model is set to the neural network model Mnew, and the model analysis module is returned; otherwise, the neural network model is restored to the neural network model Mo, and an operation processing module is added;
增操作处理模块,用于将当前层的神经元进行增操作处理,并将增操作处理后的神经网络模型标记为Mnew,在当前层增添一个神经元,并对新增的神经元的权重和偏置进行迭代更新;一定迭代次数或收敛后,再将该增操作处理后的神经网络模型Mnew进行迭代训练;The augmented operation processing module is used to augment the neurons in the current layer, and mark the neural network model processed by the augmented operation as Mnew, add a neuron to the current layer, and add the weight and Iteratively update the bias; after a certain number of iterations or convergence, iteratively train the neural network model Mnew after the increase operation is processed;
第二误差校验模块,用于比较迭代训练后的神经网络模型Mnew的损失函数值与增操作处理前的神经网络模型Mo的损失函数值的误差比小于第二设定值a2,则接受神经网络模型Mnew,并返回增操作处理模块,否则返回模型分析模块进入下一层的神经元的增减操作处理,直至所有的神经元层处理完后结束。The second error checking module is used to compare the error function value of the loss function value of the neural network model Mnew after the iterative training with the loss function value of the neural network model Mo before the increase operation processing is less than the second set value a2, then the neural network is accepted. The network model Mnew is returned to the increase operation processing module, otherwise it returns to the model analysis module to enter the increase and decrease operation processing of the neurons in the next layer, and ends until all the neuron layers are processed.
所述自增减装置包括至少一个处理器、与所述至少一个处理器通信连接的存储器,所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器执行神经网络节点的自增减方法,所述神经网络节点的自增减方法与实施例1或2相同,本发明在此不再赘述。The self-increasing or decreasing device includes at least one processor and a memory communicatively connected to the at least one processor, the memory stores instructions executable by the at least one processor, and the instructions are processed by the at least one processor. The processor executes, so that the at least one processor executes a self-incrementing / decreasing method of a neural network node. The self-incrementing / decreasing method of the neural network node is the same as that in Embodiment 1 or 2. The present invention is not described herein again.
实施例4(与方法对应的存储介质)Embodiment 4 (storage medium corresponding to the method)
在本发明实施例,还提供了一种计算机可读存储介质,所述计算机可读存储介质存储计算机指令,所述计算机指令被处理器执行上述的神经网络节点的自增减方法,所述神经网络节点的自增减方法与实施例1或2相同,本发明在此不再赘述。In the embodiment of the present invention, a computer-readable storage medium is also provided. The computer-readable storage medium stores computer instructions, and the computer instructions are executed by a processor to perform the above-mentioned method for increasing or decreasing a neural network node. The method for self-incrementing and decrementing of network nodes is the same as that in Embodiment 1 or 2. The present invention will not repeat them here.
需要说明的是,本发明实施例1和实施例2为2种当前层是否存在可减去的神经元的 判断方法,当然也可以在本发明实施例的技术启示下对两种进行结合。It should be noted that Embodiment 1 and Embodiment 2 of the present invention are two methods for judging whether or not there are subtractable neurons in the current layer. Of course, the two can also be combined under the technical inspiration of the embodiment of the present invention.
在本发明说明书的描述中,上述说明描述了本发明的优选实施例,但应当理解本发明并非局限于上述实施例,且不应看作对其他实施例的排除。本领域的普通技术人员可以理解:在不脱离本发明的原理和宗旨的情况下可以对这些实施例进行多种变化、修改、替换和变型,本发明的范围由权利要求及其等同物限定。In the description of the specification of the present invention, the above description describes the preferred embodiments of the present invention, but it should be understood that the present invention is not limited to the above embodiments and should not be regarded as excluding other embodiments. Those of ordinary skill in the art can understand that various changes, modifications, substitutions, and alterations can be made to these embodiments without departing from the principle and spirit of the present invention, and the scope of the present invention is defined by the claims and their equivalents.

Claims (9)

  1. 一种神经网络节点的自增减方法,应用于神经网络模型的训练,其特征在于,将原始的神经网络模型标记为Mo,并逐层对所述神经网络模型Mo进行自增减操作处理;所述自增减方法包括如下步骤:A self-incrementing and decreasing method of a neural network node, which is applied to the training of a neural network model, is characterized in that the original neural network model is marked as Mo, and the neural network model Mo is processed by self-incrementing and decreasing operation layer by layer; The self-increase / decrease method includes the following steps:
    步骤一,判断当前层是否存在可减去的神经元,若是,则进入步骤二,否则进入步骤四;Step 1: Determine whether there are deductible neurons in the current layer. If yes, go to step 2; otherwise, go to step 4;
    步骤二,将当前层的神经元进行减操作处理,并将减操作处理后的神经网络模型标记为Mnew,并对相关联的神经元的权重和偏置进行迭代更新,所述相关联的神经元是指与被删除的神经元相关联的下一层的神经元;一定迭代次数或收敛后,再将该增操作处理后的神经网络模型Mnew进行迭代训练;In step two, the neurons in the current layer are subjected to a subtraction operation, and the neural network model after the subtraction operation processing is marked as Mnew, and the weights and biases of the associated neurons are iteratively updated. The element refers to the neuron of the next layer associated with the deleted neuron; after a certain number of iterations or convergence, iteratively trains the neural network model Mnew after the addition operation process;
    步骤三,比较迭代训练后的神经网络模型Mnew的损失函数值与减操作处理前的神经网络模型Mo的损失函数值的误差比小于第一设定值a1,则将神经网络模型设为神经网络模型Mnew,返回步骤一;否则,将神经网络模型还原为神经网络模型Mo,并进入步骤四;Step 3: Compare the error function value of the loss function value of the neural network model Mnew after the iterative training with the loss function value of the neural network model Mo before the subtraction operation processing is less than the first set value a1, and then set the neural network model as the neural network. Model Mnew, return to step one; otherwise, restore the neural network model to neural network model Mo, and proceed to step four;
    步骤四,将当前层的神经元进行增操作处理,并将增操作处理后的神经网络模型标记为Mnew,在当前层增添一个神经元,并对新增的神经元的权重和偏置进行迭代更新;一定迭代次数或收敛后,再将该增操作处理后的神经网络模型Mnew进行迭代训练;Step four: add the neurons of the current layer to the operation layer, mark the neural network model processed by the operation as Mnew, add a neuron to the current layer, and iterate the weights and biases of the newly added neurons. Update; after a certain number of iterations or convergence, the iterative training neural network model Mnew is then iteratively trained;
    步骤五,比较迭代训练后的神经网络模型Mnew的损失函数值与增操作处理前的神经网络模型Mo的损失函数值的误差比小于第二设定值a2,则接受神经网络模型Mnew,并返回步骤四,否则返回步骤一进入下一层的神经元的增减操作处理,直至所有的神经元层处理完后结束。Step 5: Compare the error function of the neural network model Mnew after the iterative training with the loss function value of the neural network model Mo before the increase operation process is less than the second set value a2, then accept the neural network model Mnew and return Step four, otherwise return to step one to enter the neuron increase / decrease operation processing until all neuron layers are processed.
  2. 根据权利要求1所述的神经网络节点的自增减方法,其特征在于,The method for increasing or decreasing a neural network node according to claim 1, wherein:
    判断当前层是否存在可减去的神经元具体为:Determining whether there are neurons that can be subtracted in the current layer is as follows:
    设当前层为第i层,当前节点为第i层第j个节点,记为Xij,判断
    Figure PCTCN2019097181-appb-100001
    是否小于设定阈值,若
    Figure PCTCN2019097181-appb-100002
    小于设定阈值,则节点Xij可删去,其中,Winijt为输入权重向量,t=(1~n),即:Winij={Winij1,Winij2...Winijn,bij};Woutijp为输出权重向量,p=(1~m),即:Woutij={Woutij1,Woutij2...Woutijm},bij为偏置值。
    Let the current layer be the i-th layer and the current node be the j-th node of the i-th layer, denoted as Xij, and judge
    Figure PCTCN2019097181-appb-100001
    Whether it is less than the set threshold, if
    Figure PCTCN2019097181-appb-100002
    Less than the set threshold, the node Xij can be deleted, where Winijt is the input weight vector, t = (1 ~ n), that is: Winij = {Winij1, Winij2 ... Winijn, bij}; Woutijp is the output weight vector p = (1 ~ m), that is: Woutij = {Woutij1, Woutij2 ... Woutijm}, and bij is an offset value.
  3. 根据权利要求1所述的神经网络节点的自增减方法,其特征在于,The method for increasing or decreasing a neural network node according to claim 1, wherein:
    将当前层的神经元进行减操作处理后,对相关联的神经元的权重和偏置进行迭代更新,具体为:After performing the subtraction operation on the neurons in the current layer, the weights and biases of the associated neurons are updated iteratively, as follows:
    设当前层为第i层,当前节点为第i层第j个节点,被删除的神经元的输入为Xij,被删除的神经元对应的输入权重向量为Wij,被删除的神经元对应的输出为foutij=F(Xij*Wij);Let the current layer be the i-th layer, the current node is the j-th node of the i-th layer, the input of the deleted neuron is Xij, the input weight vector corresponding to the deleted neuron is Wij, and the output corresponding to the deleted neuron Foutij = F (Xij * Wij);
    设对应(i+1)层的相关联的神经元的偏置为b(i+1)j,且所述相关联的神经元的对应的输入权重向量为W(i+1)j,则迭代更新后,偏置的更新值为:b`(i+1)j=b(i+1)j+foutij*W(i+1)j。Let the bias of the associated neuron corresponding to the (i + 1) layer be b (i + 1) j, and the corresponding input weight vector of the associated neuron be W (i + 1) j, then After the iterative update, the offset update value is: b` (i + 1) j = b (i + 1) j + foutij * W (i + 1) j.
  4. 根据权利要求1所述的神经网络节点的自增减方法,其特征在于,The method for increasing or decreasing a neural network node according to claim 1, wherein:
    判断当前层是否存在可减去的神经元具体为:Determining whether there are neurons that can be subtracted in the current layer is as follows:
    设当前层为第i层,下一层为第(i+1)层,其中,j≠j’,Let the current layer be the ith layer and the next layer be the (i + 1) th layer, where j ≠ j ’,
    取第i层的第j个神经元Xij和第i层的第j’的神经元Xij’,Take the j-th neuron Xij of the i-th layer and the j'-th neuron Xij 'of the i-th layer,
    当且仅当Xij和Xij’所连接的第(i+1)层神经元相同时进行比较,
    Figure PCTCN2019097181-appb-100003
    θ代表了两个输入权重的夹角,当θ小于设定的threshold(Ф)时,判断当前层存在可减去节点;
    Compare if and only if the (i + 1) th layer of neurons connected to Xij and Xij 'are the same,
    Figure PCTCN2019097181-appb-100003
    θ represents the angle between the two input weights. When θ is less than the set threshold (Ф), it is judged that there is a subtractable node in the current layer;
    其中,Ф为设定值;Xij的输入权重向量为Winij={Winij1,Winij2...Winijn,bij},Xij的输出权重向量为Woutij={Woutij1,Woutij2...Woutijm},bij为偏置值;Among them, Ф is the set value; the input weight vector of Xij is Winij = {Winij1, Winij2 ... Winijn, bij}, the output weight vector of Xij is Woutij = {Woutij1, Woutij2 ... Woutijm}, and bij is the offset value;
    Xij’的输入权重向量为Winij’={Winij’1,Winij’2...Winij’n,bij’},Xij’的输出权重向量为Woutij’={Woutij’1,Woutij’2...Woutij’m},bij’为偏置值。The input weight vector of Xij 'is Winij' = {Winij'1, Winij'2 ... Winij'n, bij '}, and the output weight vector of Xij' is Woutij '= {Woutij'1, Woutij'2 ... Woutij'm}, bij 'is the offset value.
  5. 根据权利要求4所述的神经网络节点的自增减方法,其特征在于,The method for automatically increasing or decreasing a neural network node according to claim 4, wherein:
    将当前层的神经元进行减操作处理,具体为将节点Xij和节点Xij’均删除,并增加一个新的神经元Xij”,Subtract the neurons in the current layer, specifically deleting both the node Xij and the node Xij ’and adding a new neuron Xij",
    当Winij·Winij'>0,Winij”=(Winij+Winij')/2,Woutij”=Woutij+Woutij';When Winij · Winij '> 0, Winij "= (Winij + Winij') / 2, Woutij" = Woutij + Woutij ';
    当Winij·Winij'<0,Winij”=(-Winij+Winij')/2,Woutij”=-Woutij+Woutij'。When Winij · Winij '<0, Winij "= (-Winij + Winij') / 2, Woutij" =-Woutij + Woutij '.
  6. 根据权利要求1所述的神经网络节点的自增减方法,其特征在于,The method for increasing or decreasing a neural network node according to claim 1, wherein:
    步骤三中,当神经网络模型Mnew收敛或一定迭代后神经网络模型Mnew的损失函数值与减操作处理前的神经网络模型Mo的损失函数值的误差比小于第一设定值,则将神经网络模型设为神经网络模型Mnew;设神经网络模型Mnew的损失值为Lossnew,神经网络模型Mo的损失值为Losso,第一设定值a1,当(Lossnew-Losso)/Losso<a1时,接受神经网络模型Mnew,当(Lossnew-Losso)/Losso≥a1时,将神经网络模型还原为神经网络模型Mo。In step three, when the neural network model Mnew converges or the error ratio between the loss function value of the neural network model Mnew and the loss function value of the neural network model Mo before the subtraction operation is less than the first set value, the neural network is changed. The model is set to the neural network model Mnew; the loss value of the neural network model Mnew is Lossnew, the loss value of the neural network model Mo is Losso, and the first set value is a1. When (Lossnew-Losso) / Losso <a1, the neural network is accepted. The network model Mnew restores the neural network model to the neural network model Mo when (Lossnew-Losso) / Losso≥a1.
  7. 根据权利要求1所述的神经网络节点的自增减方法,其特征在于,The method for increasing or decreasing a neural network node according to claim 1, wherein:
    步骤五中,训练完毕后比较神经网络模型Mnew的损失函数值与增操作处理前的神经网络模型Mo的损失函数值的误差比小于第二设定值,则接受神经网络模型Mnew;第二设定值a2,当(Lossnew-Losso)/Losso<a2时,接受增操作处理的神经网络模型Mnew,当(Lossnew-Losso)/Losso≥a2时,将神经网络模型还原为神经网络模型Mo。In step 5, after the training, the error ratio between the loss function value of the neural network model Mnew and the loss function value of the neural network model Mo before the increase operation process is less than the second set value, then the neural network model Mnew is accepted; the second set The fixed value a2, when (Lossnew-Losso) / Losso <a2, the neural network model Mnew that has been processed by the increment operation, and when (Lossnew-Losso) / Losso≥a2, the neural network model is restored to the neural network model Mo.
  8. 一种神经网络节点的自增减装置,应用于神经网络模型的训练,其特征在于,将原始的神经网络模型标记为Mo,并逐层对所述神经网络模型Mo进行自增减操作处理;所述自增减装置包括:A self-incrementing and decreasing device for a neural network node, which is applied to the training of a neural network model, is characterized in that the original neural network model is marked as Mo, and the neural network model Mo is processed by self-incrementing and decreasing operation layer by layer; The self-increasing and decreasing device includes:
    模型分析模块,用于判断当前层是否存在可减去的神经元,若是,则执行减操作处理模块,否则执行增操作处理模块;A model analysis module is used to determine whether there are neurons that can be subtracted in the current layer, and if so, the subtraction operation processing module is executed, otherwise the increment operation processing module is executed;
    减操作处理模块,用于将当前层的神经元进行减操作处理,并将减操作处理后的神经网络模型标记为Mnew,并对相关联的神经元的权重和偏置进行迭代更新,所述相关联的神经元是指与被删除的神经元相关联的下一层的神经元;一定迭代次数或收敛后,再将该增操作处理后的神经网络模型Mnew进行迭代训练;The subtraction operation processing module is configured to perform subtraction processing on the neurons in the current layer, mark the neural network model processed by the subtraction operation as Mnew, and perform iterative update on the weights and offsets of the associated neurons. The associated neuron refers to the neuron in the next layer associated with the deleted neuron; after a certain number of iterations or convergence, the neural network model Mnew after the addition operation is subjected to iterative training;
    第一误差校验模块,用于比较迭代训练后的神经网络模型Mnew的损失函数值与减操作处理前的神经网络模型Mo的损失函数值的误差比小于第一设定值a1,则将神经网络模型设为神经网络模型Mnew,返回模型分析模块;否则,将神经网络模型还原为神经网络模型Mo,并执行增操作处理模块;The first error checking module is used to compare the error ratio between the loss function value of the neural network model Mnew after iterative training and the loss function value of the neural network model Mo before the subtraction operation processing is less than the first set value a1, and the neural network The network model is set to the neural network model Mnew, and the model analysis module is returned; otherwise, the neural network model is restored to the neural network model Mo, and an operation processing module is added;
    增操作处理模块,用于将当前层的神经元进行增操作处理,并将增操作处理后的神经网络模型标记为Mnew,在当前层增添一个神经元,并对新增的神经元的权重和偏置进行迭代更新;一定迭代次数或收敛后,再将该增操作处理后的神经网络模型Mnew进行迭代训练;The augmented operation processing module is used to augment the neurons in the current layer, and mark the neural network model processed by the augmented operation as Mnew, add a neuron to the current layer, and add the weight and Iteratively update the bias; after a certain number of iterations or convergence, iteratively train the neural network model Mnew after the increase operation is processed;
    第二误差校验模块,用于比较迭代训练后的神经网络模型Mnew的损失函数值与增操作处理前的神经网络模型Mo的损失函数值的误差比小于第二设定值a2,则接受神经网络模型Mnew,并返回增操作处理模块,否则返回模型分析模块进入下一层的神经元的增减操作处理,直至所有的神经元层处理完后结束。The second error checking module is used to compare the error function value of the loss function value of the neural network model Mnew after the iterative training with the loss function value of the neural network model Mo before the increase operation processing is less than the second set value a2, then the neural network is accepted. The network model Mnew is returned to the increase operation processing module, otherwise it returns to the model analysis module to enter the increase and decrease operation processing of the neurons in the next layer, and ends until all the neuron layers are processed.
  9. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储计算机指令,所述计算机指令被处理器执行时实现如权利要求1-7任一项所述的神经网络节点的自增减方法。A computer-readable storage medium, characterized in that the computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the self-implementation of the neural network node according to any one of claims 1-7 is performed. Increase or decrease method.
PCT/CN2019/097181 2018-08-29 2019-07-23 Method and device for automatically adding/removing neural network nodes, and storage medium WO2020042832A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810991846.4A CN109508781A (en) 2018-08-29 2018-08-29 Increase and decrease method, apparatus and the storage medium certainly of neural network node
CN201810991846.4 2018-08-29

Publications (1)

Publication Number Publication Date
WO2020042832A1 true WO2020042832A1 (en) 2020-03-05

Family

ID=65745643

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/097181 WO2020042832A1 (en) 2018-08-29 2019-07-23 Method and device for automatically adding/removing neural network nodes, and storage medium

Country Status (2)

Country Link
CN (1) CN109508781A (en)
WO (1) WO2020042832A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111475321A (en) * 2020-05-08 2020-07-31 中国人民解放军国防科技大学 Neural network security property verification method based on iterative abstract analysis
CN112070213A (en) * 2020-08-28 2020-12-11 Oppo广东移动通信有限公司 Neural network model optimization method, device, equipment and storage medium

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109508781A (en) * 2018-08-29 2019-03-22 厦门快商通信息技术有限公司 Increase and decrease method, apparatus and the storage medium certainly of neural network node
CN118333101B (en) * 2024-06-12 2024-08-23 上海岩芯数智人工智能科技有限公司 Variable-parameter neural network model construction method and device

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102313796A (en) * 2011-05-27 2012-01-11 北京工业大学 Soft measuring method of biochemical oxygen demand in sewage treatment
CN102879541A (en) * 2012-07-31 2013-01-16 辽宁工程技术大学 Online biochemical oxygen demand (BOD) soft measurement method based on dynamic feedforward neural network
US20160155049A1 (en) * 2014-11-27 2016-06-02 Samsung Electronics Co., Ltd. Method and apparatus for extending neural network
CN107272418A (en) * 2017-07-27 2017-10-20 青岛格莱瑞智能控制技术有限公司 A kind of bionic intelligence control method for the neutral net that is self-regulated based on many intensions
CN107273971A (en) * 2017-06-13 2017-10-20 石家庄铁道大学 Architecture of Feed-forward Neural Network self-organizing method based on neuron conspicuousness
CN109508781A (en) * 2018-08-29 2019-03-22 厦门快商通信息技术有限公司 Increase and decrease method, apparatus and the storage medium certainly of neural network node

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102313796A (en) * 2011-05-27 2012-01-11 北京工业大学 Soft measuring method of biochemical oxygen demand in sewage treatment
CN102879541A (en) * 2012-07-31 2013-01-16 辽宁工程技术大学 Online biochemical oxygen demand (BOD) soft measurement method based on dynamic feedforward neural network
US20160155049A1 (en) * 2014-11-27 2016-06-02 Samsung Electronics Co., Ltd. Method and apparatus for extending neural network
CN107273971A (en) * 2017-06-13 2017-10-20 石家庄铁道大学 Architecture of Feed-forward Neural Network self-organizing method based on neuron conspicuousness
CN107272418A (en) * 2017-07-27 2017-10-20 青岛格莱瑞智能控制技术有限公司 A kind of bionic intelligence control method for the neutral net that is self-regulated based on many intensions
CN109508781A (en) * 2018-08-29 2019-03-22 厦门快商通信息技术有限公司 Increase and decrease method, apparatus and the storage medium certainly of neural network node

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111475321A (en) * 2020-05-08 2020-07-31 中国人民解放军国防科技大学 Neural network security property verification method based on iterative abstract analysis
CN111475321B (en) * 2020-05-08 2024-04-26 中国人民解放军国防科技大学 Neural network security property verification method based on iterative abstract analysis
CN112070213A (en) * 2020-08-28 2020-12-11 Oppo广东移动通信有限公司 Neural network model optimization method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN109508781A (en) 2019-03-22

Similar Documents

Publication Publication Date Title
WO2020042832A1 (en) Method and device for automatically adding/removing neural network nodes, and storage medium
CN111602149B (en) Self-organizing partial sequence network
Okut Bayesian regularized neural networks for small n big p data
CN107679618B (en) Static strategy fixed-point training method and device
CN112101530B (en) Neural network training method, device, equipment and storage medium
US20170004399A1 (en) Learning method and apparatus, and recording medium
JP6610278B2 (en) Machine learning apparatus, machine learning method, and machine learning program
Araújo et al. A morphological-rank-linear evolutionary method for stock market prediction
Neyshabur et al. Path-normalized optimization of recurrent neural networks with relu activations
CN111788585B (en) Training method and system for deep learning model
US11977972B2 (en) Residual semi-recurrent neural networks
JP7009020B2 (en) Learning methods, learning systems, learning devices, methods, applicable devices, and computer programs
Hassanin et al. Grey wolf optimizer-based back-propagation neural network algorithm
CN111523686A (en) Method and system for model joint training
Yang et al. Direct adaptive control for a class of discrete‐time unknown nonaffine nonlinear systems using neural networks
Shao et al. Relaxed conditions for convergence of batch BPAP for feedforward neural networks
CN111967015A (en) Defense agent method for improving Byzantine robustness of distributed learning system
Bastian et al. A simplified natural gradient learning algorithm
US20220114047A1 (en) Method for mitigating error of quantum circuit and apparatus thereof
Hou et al. Generalized kernel maximum correntropy criterion with variable center: Formulation and performance analysis
WO2019232965A1 (en) Error calibration method and device for analog neural network processor
CN107665315A (en) A kind of based role suitable for Hadoop and the access control method trusted
JP2000259598A (en) Optimization learning method for neural network
CN110852361B (en) Image classification method and device based on improved deep neural network and electronic equipment
Bai et al. Adaptive momentum with discriminative weight for neural network stochastic optimization

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19854349

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19854349

Country of ref document: EP

Kind code of ref document: A1