taddallas / metacom

R package for the analysis of metacommunity structure
GNU General Public License v3.0
10 stars 9 forks source link

Bad optimization and code comments #15

Closed lucascamacho closed 5 years ago

lucascamacho commented 5 years ago

Hello Tad,

my name is Lucas Camacho and I'm MSc student in the Ecology Department in Bioscience Institute - USP, São Paulo Brazil.

First of all, I would like to thank you for creating this package that helps the scientists works with bipartite networks and leaving the package code open. I believe this openness makes positive contributions to the way we do science today. I've been trying to use a specific function in the package called Modularity that calculates Barber's 2007 modularity index in adjacency matrices (in my case, pollinator and plant).

Unfortunately, my attempts to use Modularity were quite frustrating. I deeply believe that there are serious optimization issues in your code due to the time it takes for few simulations to finish. I am trying to get the modularity index proposed by Barber in an adjacency matrix with 27 species only (13 plants and 14 pollinators) and with the sims parameter set to 10 (the smallest allowed). The function has not returned result in the 40 minutes I waited. Too much time for such a small network. My attempts to use the function were not restricted to this network or this same number of sims. I even used different computers with different processing capabilities. All with the same delay.

Curious with the delay I looked at the source code and could not clearly understand the processes performed in the function. I believe that the amount of comments in the code needs to be improved to better understand who has not written the package but wants to understand how the processes are being done.

Finally, I would like to point out that using its function in my analysis would be fundamental but not feasible, considering the large amount of computer simulations we do today. This shows the importance of computer code optimization for big data uses.

I hope these comments help to realize that the code needs to be optimized and commented so that its use and understanding can be maximized.

Again, thanks for the availability of the package and code, and I hope it is greatly improved for use by interaction network scientists.

Kind regards

Lucas Camacho

taddallas commented 5 years ago

Lucas,

Thanks for your feedback! You're definitely right about the modularity function not being optimized. It's not a part of the original Elements of Metacommunity Structure analysis framework, and was included as a sort of extra function. I will probably go ahead and remove it. However, there is another option for using Barber's modularity, and that is the much faster version of the algorithm implemented by @tpoisot and @stouffer.

Manual: (https://cran.r-project.org/web/packages/lpbrim/lpbrim.pdf) Package: (https://github.com/PoisotLab/lpbrim)

Cheers, Tad

lucascamacho commented 5 years ago

Awesome,

Thanks for show me to another function that calculates Modularity.

Kind regards

Lucas