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

run_PHATE_EB fails in Matlab2015a at line 73 in compute_alpha_kernel_sparse #47

Closed
dxjones opened this issue Jul 29, 2018 · 3 comments
Closed

Comments

@dxjones
Copy link

dxjones commented Jul 29, 2018

There is a bug on line 73 in computer_alpha_kernel_sparse.m

When I execute "run_phate_EB" it fails because the 2 operands of "./" are different sizes.

I think this could probably be corrected using "repmat", assuming that is what was intended.

I wonder if this line of code depends on a very recent feature in Matlab that does the "repmat" implicitly. Since many research lab run do not run the most up-to-date version of Matlab, it would be better to use repmat explicitly.

Here are more details:

>> run_phate_EB
PCA using random SVD
Elapsed time is 6.751585 seconds.
Doing PCA
PCA using random SVD
PCA took 8.1852 seconds
using alpha decaying kernel
Computing alpha decay kernel:
Number of samples = 16825
First iteration: k = 100
Error using  ./ 
Matrix dimensions must agree.

Error in compute_alpha_kernel_sparse (line 73)
    K=exp(-(kdist(idx_thresh,:)./epsilon(idx_thresh)).^a);

Error in phate (line 196)
        K = compute_alpha_kernel_sparse(pc, 'k', k, 'a', a, 'distfun', distfun);

Error in run_phate_EB (line 35)
Y_PHATE_2D = phate(data, 't', 20);

When I print out the "size" of the 2 operands, ... here is what I get:

>> size( exp( kdist(idx_thresh,:)) )
ans =

        9228         100
>> size( epsilon(idx_thresh) )
ans =

        9228           1
@dxjones
Copy link
Author

dxjones commented Jul 29, 2018

Here is a one-line fix to resolve this error:

new line 73 in compute_alpha_kernel_sparse.m

    K=exp(-(kdist(idx_thresh,:)./repmat(epsilon(idx_thresh),1,size(kdist,2))).^a);

old:

    K=exp(-(kdist(idx_thresh,:)./epsilon(idx_thresh)).^a);

Similarly, another fix is required a few lines later:

new:

    K2=exp(-(kdist2(idx_thresh2,:)./repmat(epsilon2(idx_thresh2),1,size(kdist2,2))).^a);

old:

     K2=exp(-(kdist2(idx_thresh2,:)./epsilon2(idx_thresh2)).^a);

@dvdijk
Copy link
Contributor

dvdijk commented Jul 31, 2018

thanks for pointing out this issue. I have fixed it using your suggested code. Its currently on Dev branch but we'll merge to Master soon.

@scottgigante
Copy link
Collaborator

This issue was fixed in commit c39a40d

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

3 participants