smartyfh / DANMF

Deep Autoencoder-like NMF
21 stars 8 forks source link

Input #3

Open rishabhramteke opened 5 years ago

rishabhramteke commented 5 years ago

How are you giving input A ? Can you show me the results that you achieved on various datasets? Both input and output.

smartyfh commented 5 years ago

The input A denotes the adjacency matrix of a network. For a network with n nodes, A is an n-by-n matrix, and its (i, j)-entry is 1 or 0. If nodes i and j are connected, then A(i, j) is 1, otherwise, it's 0. thanks

rishabhramteke commented 5 years ago

Yes. I know that. I am asking how are you giving input to the code.

rishabhramteke commented 5 years ago

Also can you send me the results that you got using this code on various datasets.

smartyfh commented 5 years ago

If the data are stored in CSV, we can use csvread to load data (like this: A = csvread('adjacencyMatrix.csv', 1, 1)). Sorry I cannot send you the results, for I do not store the intermediate results.

rishabhramteke commented 5 years ago

the thing is the code is not working that way. it is giving undefined variable error and i dont understand why

smartyfh commented 5 years ago

Which variable? Do you mean A? U can check what your A is in matlab.

rishabhramteke commented 5 years ago

Which Dataset did you use to run the code ? please run the code and send me the results. It is not working as you said it is supposed o be.

rishabhramteke commented 5 years ago

Also, there seems to be Incorrect dimensions for matrix multiplication in Line 93 of DANMF

rishabhramteke commented 5 years ago

And Line 120 too

smartyfh commented 5 years ago

Pls check our paper, the implementation is just the same as what the paper shows. Anyway, the implementation is quite simple. If you are not so familiar with Matlab, you can also use the python version (it is the same as the Matlab version). Maybe it will help you.

earthat commented 5 years ago

Hi @smartyfh

if we have the matrix of n*k then how would we calculate the adjacency matrix as square matrix is suitable for it.

smartyfh commented 5 years ago

Hi @smartyfh

if we have the matrix of n*k then how would we calculate the adjacency matrix as square matrix is suitable for it.

Hi, could you pls make it clearer? Sorry that I couldn't get your question.

earthat commented 5 years ago

the input matrix A is adjacency matrix which is a square one. My dataset has 359 samples with 2173 features. The adjacency matrix can't be calculated for it. In that case, can you please suggest how to modify this code for it.

smartyfh commented 5 years ago

the input matrix A is adjacency matrix which is a square one. My dataset has 359 samples with 2173 features. The adjacency matrix can't be calculated for it. In that case, can you please suggest how to modify this code for it.

Well, actually, you can replace the adjacency matrix A by any shape matrix X. However, the update rule may need to be modified as well. Because when deriving the updating rules, I used the property A = A^T. In your case, this property does not hold any more. So maybe you can follow the same procedure to derive the new updating rules.

earthat commented 5 years ago

In it there are two major issues:

-if we don't use the adjacency matrix, then theShallowNMF gives the NaN values

earthat commented 5 years ago

I found the graph regularizer L can be dropped. but the other issue of using matrix other than adjacency in the input of DNMF is NaN output in factors U and V.

Please suggest any hint for this.

smartyfh commented 5 years ago

In it there are two major issues:

-if we don't use the adjacency matrix, then theShallowNMF gives the NaN values

  • using any shape matrix has another issue of D = diag(sum(A)); L = D - A;. It doesn't support other than square. The L is further used in the cost function

The input matrix of ShallowNMF can be of any shape. But it should be nonnegative.

For the graph regularization term, you can omit it directly. Or you can construct your own graph just like spectral clustering, then you can calculate the Laplacian matrix L.

smartyfh commented 5 years ago

I found the graph regularizer L can be dropped. but the other issue of using matrix other than adjacency in the input of DNMF is NaN output in factors U and V.

Please suggest any hint for this.

I guess the reason is that your data have negative values.

earthat commented 5 years ago

I found the graph regularizer L can be dropped. but the other issue of using matrix other than adjacency in the input of DNMF is NaN output in factors U and V. Please suggest any hint for this.

I guess the reason is that your data have negative values.

Yes, you are absolutely correct. My features have negative values. Though I replaced the shallowNMF with nnmf from MATLAB. It created another issue for me. The Vi update has the dimensional issue due to the mismatch in P and A. The memory units in the first layer should be equal to the number of samples or we can see it empirically.

Unfortunately, the same error occurred if I input the matrix as |A|.

smartyfh commented 5 years ago

I found the graph regularizer L can be dropped. but the other issue of using matrix other than adjacency in the input of DNMF is NaN output in factors U and V. Please suggest any hint for this.

I guess the reason is that your data have negative values.

Yes, you are absolutely correct. My features have negative values. Though I replaced the shallowNMF with nnmf from MATLAB. It created another issue for me. The Vi update has the dimensional issue due to the mismatch in P and A. The memory units in the first layer should be equal to the number of samples or we can see it empirically.

Unfortunately, the same error occurred if I input the matrix as |A|.

Firstly, since your input is not square matrix, the updating rules should be modified accordingly.

Secondly, the ShallowNMF module shouldn't be replaced.

Thirdly, the input should be non-negative.

You can just create an adjacency matrix and run the code to see whether it works. Thanks!