Analysis device, method, and program for analyzing neural network structure
Granted 24 Sep 2024 · 1 office action
Assignee: Nippon Telegraph and Telephone Corporation
Law firm: Law firm · Log in to unlock
Attorney: Attorney · Log in to unlock
Inventors: Chihiro Watanabe, Kunio Kashino, Kaoru Hiramatsu · Examiner: Tan H Tran · AU 2173 · TC 2100
Life of the application
8 dated eventsAbstract
It is possible to analyze what type of input/output mapping is mainly performed in the entire hidden layer of a neural network. A relationship analysis unit 30 calculates strength of a relationship of each combination of a dimension of the input data and a unit of the neural network and calculates strength of a relationship of each combination of the unit and a dimension of the output data. A role analysis unit 32 calculates a relationship between a prescribed number of types of roles and the unit and a relationship between the prescribed number of types of roles, the dimension of the input data, and the dimension of the output data on the basis of the strength of the relationship of each combination of the dimension of the input data and the unit of the neural network and the strength of the relationship of each combination of the unit and the dimension of the output data.
Description
10 parts›CROSS-REFERENCE TO RELATED APPLICATIONS
This application is a U.S. 371 Applications of International Patent Application No. PCT/JP2019/017220, filed on 23 Apr. 2019, which application claims priority to and the benefit of JP Application No. 2018-088177, filed on 1 May 2018, the disclosures of which are hereby incorporated herein by reference in their entireties.
›TECHNICAL FIELD
The present invention relates to an analysis device, a method, and a program and, in particular, to an analysis device, a method, and a program for analyzing the structure of a neural network.
›BACKGROUND ART
There has been a technology that applies a network analysis to a multilayer neural network learned from data to make it possible to extract a cluster structure and quantitatively determine the role of each extracted cluster from a relationship with each dimension of input/output data (Non-Patent Literature 1).
›CITATION LIST
Non Patent Literature
[NPL 1] Watanabe. C, Hiramatsu. K, and Kashino. K. “Understanding Community Structure in Layered Neural Networks”. ArXiv. 2018
›SUMMARY OF THE INVENTION
Technical Problem
The above existing technology makes it possible to read the role of each community in a community structure extracted from a multilayer neural network. However, since the clustering of units is performed for each layer of the neural network in the technology, it is not possible to grasp the similarity of the role of each unit between layers. In order to grasp not only the role assumed by a part of the neural network but also the fact as to what type of input/output mapping is mainly performed in the entire hidden layer of the neural network, a new technology is required.
The present invention has been made in view of the above circumstances and has an object of providing an analysis device, a method, and a program making it possible to analyze what type of input/output mapping is mainly performed in the entire hidden layer of a neural network.
Means for Solving the Problem
In order to achieve the above object, an analysis device according to the present invention includes: an input unit that receives a previously-learned neural network for outputting output data from input data on the basis of learning data including the input data and the output data; a relationship analysis unit that calculates strength of a relationship of each combination of a dimension of the input data and a unit of the neural network and calculates strength of a relationship of each combination of the unit and a dimension of the output data; and a role analysis unit that calculates a relationship between a prescribed number of types of roles and the unit and a relationship between the prescribed number of types of roles, the dimension of the input data, and the dimension of the output data on the basis of the strength of the relationship of each combination of the dimension of the input data and the unit of the neural network and the strength of the relationship of each combination of the unit and the dimension of the output data.
Further, an analysis method according to the present invention includes: receiving a previously-learned neural network for outputting output data from input data on the basis of learning data including the input data and the output data by an input unit; calculating strength of a relationship of each combination of a dimension of the input data and a unit of the neural network and calculating strength of a relationship of each combination of the unit and a dimension of the output data by a relationship analysis unit; and calculating a relationship between a prescribed number of types of roles and the unit and a relationship between the prescribed number of types of roles, the dimension of the input data, and the dimension of the output data on the basis of the strength of the relationship of each combination of the dimension of the input data and the unit of the neural network and the strength of the relationship of each combination of the unit and the dimension of the output data by a role analysis unit.
A program according to the present invention is a program for causing a computer to function as each unit of the above analysis device according to the present invention.
Effects of the Invention
According to the analysis device, the method, and the program of the present invention, a relationship between a prescribed number of types of roles and a unit and a relationship between the prescribed number of types of roles and a dimension of input data and a dimension of output data are calculated on the basis of the strength of the relationship of each combination of the dimension of the input data and the unit of a neural network and the strength of the relationship of each combination of the unit and the dimension of the output data. As a result, the effect of making it possible to analyze what type of input/output mapping is mainly performed in the entire hidden layer of the neural network is obtained.
›BRIEF DESCRIPTION OF DRAWINGS
FIG. 1 is a block diagram showing the configuration of an analysis device according to an embodiment of the present invention.
FIG. 2 is a diagram showing an example of a case in which a contribution degree to an input and an output in a unit of a hidden layer is expressed.
FIG. 3 is a diagram showing an example of a result obtained when nonnegative matrix factorization is applied to a matrix expressing the strength of a relationship with each dimension of input data and the strength of a relationship with each dimension of output data for each unit.
FIG. 4 is a flowchart showing an analysis processing routine in the analysis device according to the embodiment of the present invention.
›DESCRIPTION OF EMBODIMENTS · 1 of 3
Hereinafter, an embodiment of the present invention will be described in detail with reference to the drawings.
<Configuration of Analysis Device According to Embodiment of Present Invention>
Next, the configuration of an analysis device according to the embodiment of the present invention will be described. As shown in FIG. 1 , an analysis device 100 according to the embodiment of the present invention can be constituted by a computer including a CPU, a RAM, and a ROM storing a program or various data for performing an analysis processing routine that will be described later. Functionally, the analysis device 100 includes an input unit 10 , a computation unit 20 , and an output unit 50 as shown in FIG. 1 .
The input unit 10 receives a previously-learned neural network. Further, the input unit 10 receives learning data including the input data of the neural network and output data with respect to the input data. The neural network is learned as a neural network for outputting output data from input data on the basis of learning data including the input data and the output data.
The computation unit 20 is constituted by a relationship analysis unit 30 and a role analysis unit 32 .
On the basis of the information input to the input unit 10 , the relationship analysis unit 30 calculates the strength v ki in of the relationship of each combination of a dimension i of the input data and a unit k in the hidden layer of the neural network, and calculates the strength v kj out of the relationship of each combination of the unit k in the hidden layer and a dimension j of the output data.
Specifically, the relationship analysis unit 30 inputs the learning data to the neural network, and defines and calculates, for each combination of the dimension i of the input data and the unit k, the square error between the output of the unit k obtained by replacing the value of the dimension i of the input data representing the learning data with the average value of the dimension i of the input data included in the learning data and the output of the unit k with respect to the input data before the replacement as the strength v ki in of the relationship of the combination of the dimension i of the input data and the unit k.
Further, the relationship analysis unit 30 inputs the learning data to the neural network, and defines and calculates, for each combination of the unit k and the dimension j of the output data, the square error between the value of the dimension j of the output data obtained by replacing the output value of the unit k with the average output value of the unit k when the input data included in the learning data is input and the value of the dimension j of the output data before the replacement as the strength v kj out of the relationship of the combination of the unit k and the dimension j of the output data.
By the above computation, the strength of the relationship with the input/output dimension of each unit k is obtained by the vector forms
( v in ={v k,i in },v out ={v k,j out }),
each of which is a feature vector expressing the role of each unit k.
For example, when a neural network that performs text image recognition (outputs a result predicting what text is written in an image with the image as an input) is input, a vector expressing which part of the input image is seen and what text is recognized by each unit of a hidden layer in the neural network is calculated (see FIG. 2 ).
The role analysis unit 32 calculates the relationship between a prescribed number of types of roles and the unit and the relationship between the prescribed number of types of roles, the dimension of the input data, and the dimension of the output data on the basis of the strength of the relationship of each combination of the dimension of the input data and the unit in the hidden layer of the neural network and the strength of the relationship of each combination of the unit in the hidden layer and the dimension of the output data.
Specifically, the role analysis unit 32 applies, for each unit, nonnegative matrix factorization to a matrix expressing the strength of a relationship with each dimension of the input data and the strength of a relationship with each dimension of the output data to calculate a matrix expressing the relationship between the prescribed number of types of roles and the unit and a matrix expressing the relationship between the prescribed number of types of roles, the dimension of the input data, and the dimension of the output data.
For example, using the vectors v in and v out expressing the strength of the relationship with the input/output dimension of each unit k calculated by the relationship analysis unit 30 , the main role of the entire hidden layer (what type of input information is associated with what type of output information) is calculated as will be described below.
First, a vector expressing the strength of the relationship with the input/output dimension of each unit is expressed as a matrix V.
V={v k,l },
v b,I =v k,l in , for l= 1, . . . , a v
v k,l =v b,l-a out , for l=a+ 1, . . . , a+b.
However, the vectors v in and v out expressing the strength of the relationship with the input/output dimension of each unit k are not used as they are, but processing such as coupling the vectors v in and v out together as the matrix V after normalizing the vectors so that the maximum value and the minimum value of elements in the two vectors coincide with each other may be performed.
Here, a represents the dimension of the input data, and b represents the dimension of the output data. When the number of units of the hidden layer is represented as k 0 , V becomes the matrix of k 0 ×(a+b) (in which the row direction corresponds to each unit of the hidden layer and the column direction corresponds to each input/output dimension).
By the application of nonnegative matrix factorization to the above matrix V, two matrices W and H expressed by the following formula are obtained.
V≈WH [Formula 1]
Here, W represents the matrix of k 0 ×c, and H represents the matrix of c×(a+b). When it is assumed that the role of the unit of the entire hidden layer can be classified into c types, the roles of the c types (that are expressed by the matrix H) and the association degree between each unit in the hidden layer and the roles of the c types (that is expressed by the matrix W) are calculated. Each row of the matrix H expresses the roles classified into the c types from the viewpoint of the “strength of a relationship with each input/output dimension”. Each row of the matrix W expresses the role of each unit of the hidden layer from the viewpoint of “which of and to what degree the roles classified into the c types are assumed” (see FIG. 3 ). Note that the value (positive integer) of c is set in advance.
›DESCRIPTION OF EMBODIMENTS · 2 of 3
Further, the specific algorithm of the nonnegative matrix factorization is shown below.
In order to facilitate the interpretation of an analysis result by the relationship analysis unit 30 , the output unit 50 outputs the strength v ki in of the relationship of the combination of the dimension i of the input data and the unit k and the strength v kj out of the relationship of the combination of the unit k and the dimension j of the output data so as to be expressed by a vector or a matrix. For example, a case in which the present embodiment is applied to a neural network that performs text image recognition (outputs a result predicting what text is written in an image with the image as an input) to recognize a text image using the learning data of the text image will be described. In this example, with respect to the unit of the neural network as shown in FIG. 3 , it is possible to express a contribution degree as to what text is recognized by the unit in such a manner that the strength of a relationship with each output dimension of the unit is expressed as a contribution degree by a bar graph, or it is possible to express the strength of a relationship as a contribution degree as to which part of the information of an input image is received by the unit in such a manner that a contribution degree to the unit from each input dimension is expressed by the distribution of a matrix.
Further, the output unit 50 outputs each row of the matrix W representing an analysis result by the role analysis unit 32 as one expressing which of the “main roles” classified into the c types is assumed by each unit of the hidden layer. Thus, for example, it is possible to grasp the fact that the role of “distinguishing 4 and 9 from the information of pixels at the upper part of an image” and the role of “distinguishing 0 from the information of pixels at the central part of the image” are assumed by a certain unit of the hidden layer at a rate of about 50%, or the like.
Further, the output unit 50 outputs each row of the matrix H representing an analysis result by the role analysis unit 32 as one expressing the main role of the entire hidden layer. Thus, for example, it is possible to grasp the main role such as “distinguishing 4 and 9 from the information of pixels at the upper part of the image”.
<Operation of Analysis Device According to Embodiment of Present Invention>
Next, the operation of the analysis device 100 according to the embodiment of the present invention will be described. Upon receiving a previously-learned neural network and learning data including input data and output data by the input unit 10 , the analysis device 100 performs an analysis processing routine shown in FIG. 4 .
In step S 100 , the relationship analysis unit 30 inputs the learning data to the neural network, and defines and calculates, for each combination of a dimension i of the input data representing the learning data and a unit k in a hidden layer, the square error between the output of the unit k obtained by replacing the value of the dimension i of the input data with the average value of the dimension i of the input data included in the learning data and the output of the unit k with respect to the input data before the replacement as the strength v ki in of the relationship of the combination of the dimension i of the input data and the unit k. Further, the relationship analysis unit 30 inputs the learning data to the neural network, and defines and calculates, for each combination of the unit k in the hidden layer and a dimension j of the output data, the square error between the value of the dimension j of the output data obtained by replacing the output value of the unit k with the average output value of the unit k when the input data included in the learning data is input and the value of the dimension j of the output data before the replacement as the strength v kj out of the relationship of the combination of the unit k and the dimension j of the output data.
In step S 102 , the role analysis unit 32 applies, for each unit, nonnegative matrix factorization to a matrix V expressing the strength of a relationship with each dimension of the input data and the strength of a relationship with each dimension of the output data to calculate a matrix W expressing the relationship between a prescribed number of types of roles and the unit and a matrix H expressing the relationship between the prescribed number of types of roles, the dimension of the input data, and the dimension of the output data.
In step S 104 , the output unit 50 outputs the strength v ki in of the relationship of the combination of the dimension i of the input data and the unit k and the strength v kj out of the relationship of the combination of the unit k and the dimension j of the output data so as to be expressed by a vector or a matrix.
Further, the output unit 50 outputs each row of the matrix W representing an analysis result by the role analysis unit 32 as one expressing which of “main roles” classified into c types is assumed by each hidden unit. Further, the output unit 50 outputs each row of the matrix H representing an analysis result by the role analysis unit 32 as one expressing the main role of the entire hidden layer.
As described above, by calculating the relationship between a prescribed number of types of roles and a unit and the relationship between the prescribed number of types of roles and the dimension of input data and the dimension of output data on the basis of the strength of the relationship of each combination of the dimension of the input data and the unit of a neural network and the strength of the relationship of each combination of the unit and the dimension of the output data, it is possible to analyze what type of input/output mapping is mainly performed in the entire hidden layer of the neural network according to the analysis device of the embodiment of the present invention.
Further, by presenting the main role of the entire unit of a hidden layer from the viewpoint of “which dimension of the information of input data is used and which dimension of the information of an output is deduced” using the technology of the embodiment of the present invention, it is possible to roughly know the function of mapping from an input to an output in a neural network learned from data. For example, when the present technology is applied to a neural network that performs text image recognition as shown in FIG. 2 , it is possible to know the fact as to which part of an input image is seen and what text is recognized by the neural network in a hidden layer in such a manner as to be classified into main roles.
›DESCRIPTION OF EMBODIMENTS · 3 of 3
Further, by analyzing a relationship with the input/output of each unit with respect to a neural network learned from data and applying nonnegative matrix factorization to a matrix defined by the analysis, it is possible to acquire knowledge about a deduction mechanism in the entire hidden layer of the neural network.
Note that the present invention is not limited to the embodiment described above but various modifications or applications are made possible without departing from the spirit of the present invention.
›REFERENCE SIGNS LIST
10 input unit
20 computation unit
30 relationship analysis unit
32 role analysis unit
50 output unit
100 analysis device
›Tables in the description — 1
| 1: | The number of replications of the algorithm is | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| represented as a 0 , and the matrix expressing the role of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| each unit of the hidden layer is represented as V. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2: | The initialization of the matrices T and U may be | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| performed as, for example, follows: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| t | k | , | c | | i | . | i | . | d | . | ∼ | | N | | ( | μ | 1 | , | σ | 1 | ) | , | u | c | , | l | | i | . | i | . | d | . | ∼ | | N | | ( | μ | 2 | , | σ | 2 | ) | . | For | | example | , | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| μ 1 = σ 1 = μ 2 = σ 2 = 0.5 or the like may be set | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3: | for a = 1 to a 0 do | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4: | t k,c ← t k,c × ((VU T ) k,c /(TUU T ) k,c ). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5: | t k,c ← max(t k,c ,0) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6: | u c,l ← u c,l × ((T T V) c,l /(T T TU) c,l ). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7: | u c,l ← max(u c,l ,0). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8: | end for |
Claims as granted
17 claimsLog in to read the claims of this application.
Log in to unlockClassifications
2 codes- G06F18/21
- G06N3/04
Claim changes
SoonSee which claims were amended, added or cancelled during examination, with every added and removed word marked.
The published claims of this application are not paired with the granted ones in what we hold.
File wrapper
See the full prosecution history — every USPTO and applicant action on this file, in order.
Log in to unlockDocuments
Log in to open the documents of this file: the application as filed, every office action and response, the notice of allowance.
Log in to unlockChain of title
See the full assignment history — every owner this patent has passed through, with recordation dates and reel/frame numbers.
Log in to unlock