Description Usage Arguments Value
View source: R/create_dubossarsky_network.R
Project cue by response "bipartite graph" to a cue by cue "unipartite graph"
1 |
bpg |
Cue by response matrix representing a bipartite graph |
A cue by cue matrix representing a directed unipartite graph.
This projection can be efficiently represented as the inner product of the bipartite graph and projection matrix. The projection matrix has the same dimensions as the bipartite graph, but transposed. To compose the projection matrix, we first count the number of cues for which each response was provided. Then, replicate this to fill the whole matrix (i.e., repeat this vector once per cue, and reshape into a response by cue matrix). Next, in each column of this new matrix, set values to zero to indicate responses that did not occur for each cue.
At this point, the projection matrix contains the values that would by used as N_p in the equation:
w_{i,j} = ∑_{i=1}^P \frac{w_{i,p}}{N_p - 1}
Before using as a product, (N_p - 1) must be inverted (\frac{1}{N_p - 1}). During the inversion, we ensure that the minimum value in the denominator is zero. Of course, when the denominator is zero this will produce infinities, but this corresponds to where word j is not associated with a particular response. Thus, infinities resulting from this inversion can be set to zero.
Finally, bpg represents the projection matrix.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.