Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

question about code #1

Open
KAI-SUWer opened this issue Oct 13, 2021 · 3 comments
Open

question about code #1

KAI-SUWer opened this issue Oct 13, 2021 · 3 comments

Comments

@KAI-SUWer
Copy link

it is a nice work, but i have some questions to ask you, wish you can help me to solve.
code from dlpthresCurve file:

          adj = adj(:,:,2:end);  
          predMat = predMat(:,:,2:end);
          if strcmp(links,'new')
              nodeNew = ~nodeExisting;  
              activeMask = nodeNew & activeMask;

now we suppose t=1,so 'nodeNew' is edge that doesn't exist at time t=1;'ActiveMask' is the fully connected condition of activated nodes at t=1. Is ’nodeNew&activeMask‘ limiting new connections at t+1=2 to active nodes at t=1 ?

@KAI-SUWer
Copy link
Author

activeMask = false(n,n,tMax-1);
for t = 1:tMax-1
activeMaskCurr = nodeActive(:,t)*nodeActive(:,t)'; % Should be changed to nodeActive(:,t+1)*nodeActive(:,t+1)'
activeMaskCurr(diag(true(n,1))) = 0;
activeMask(:,:,t) = activeMaskCurr;
if directed == false
activeMask(:,:,t) = tril(activeMask(:,:,t));
end
end
adj = adj(:,:,2:end);
predMat = predMat(:,:,2:end);
if strcmp(links,'new')
nodeNew = ~nodeExisting;
activeMask = nodeNew & activeMask; % If it is changed, it corresponds to all possible new edges of t+1
elseif strcmp(links,'existing')
activeMask = nodeExisting & activeMask;
end
adjVect = adj(activeMask); % Extract ground_trueth links of all possible new edges at the corresponding time
predVect = predMat(activeMask) % So you can calculate PRAUC in terms of adjVect and preVect

Please see my code comments.

@kevin-s-xu
Copy link
Member

now we suppose t=1,so 'nodeNew' is edge that doesn't exist at time t=1;'ActiveMask' is the fully connected condition of activated nodes at t=1. Is ’nodeNew&activeMask‘ limiting new connections at t+1=2 to active nodes at t=1 ?

This is correct. We do not try to predict links to nodes that have just become active at time t+1 (new nodes). Without any information about those nodes, any predictions we make would be to a "generic" new node since we don't have any information regarding the new node. See Section 5 of Yang et al. (2015) for discussion on this.

Yang, Y., Lichtenwalter, R. N., & Chawla, N. V. (2015). Evaluating link prediction methods. Knowledge and Information Systems, 45, 751-782. https://www3.nd.edu/~dial/publications/yang2015evaluating.pdf

@KAI-SUWer
Copy link
Author

KAI-SUWer commented Nov 9, 2021

Thank you very much for your answer.
I have one last question, how to calculate P and N in the indicators? Do you tally up edges and non-edges in all historical snapshots used for prediction, or otherwise? Thank you again.
Snipaste_2021-11-09_19-29-55

Instead of calculating the P and N values in your MATLAB code, you use a full one matrix to get a base_PRAUC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants