Comments (7)
Could you give us an adjacency matrix as a failing case we can build a test from? Your current example is OK if you don't mind sharing it, otherwise a minimal failing example would be great. Something like a CSV in a gist would be perfect.
from bctpy.
thanks for the help! I put it here: https://github.com/rschmaelzle/misc.git
The matrix can contain negative values (I comment out the respecive line in bctpy that complain), it also happens after I set B[B<0]=0.
Best, R
from bctpy.
The implementation here isn't defined for negative weights (and I don't profess to know enough about the algorithm to address that), so I also ditched the negative values. However, I didn't run into any issues running it on either python 2.7 or 3.5 with the below snippet.
def test_community_louvain_failing()
x = np.load('path/to/does_not_work.npy')
x[x < 0] = 0
ci, q = bct.community_louvain(x)
print(ci, q)
(array([1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8]), 0.72635748243481213)
I'm using numpy 1.11 and scipy 1.17 - possibly it's a versioning issue? If you're using a conda environment try doing a conda env export > environment.yml
and posting that, or a conda list -e > spec-file.txt
, or if you're using pip then pip freeze > requirements2.txt
.
See my branch here https://github.com/clbarnes/bctpy/tree/bug-louvain-%2341 (there are a couple of other changes as my master branch is waiting to be merged into master but they don't touch the modularity code; I have checked on a branch rebased on base/master too)
See my CI build here https://travis-ci.org/clbarnes/bctpy/builds/127873637 (that uses numpy 1.10)
from bctpy.
Thanks, Chris! This helped! The error is on my side: I gave it a matrix and not an array. Saving it out converts to array, thus after re-importing everything works! Sorry!
re: negative values: You are right about general issues with negative values, but people I work with say that in this case (where B is prepared) it was ok.
Thanks for putting bct-py together! R
from bctpy.
Good to hear! It might be worth noting this in the documentation.
@aestrivex is the main man to thank!
from bctpy.
how? should i do anything?
@aestrivex thanks!
from bctpy.
No worries, I've added it to the readme changes already in a PR.
from bctpy.
Related Issues (20)
- NBS incorrectly(?) lumps positive and negative effects together
- B symmetrization inside if statement in community_louvain
- IndexError: index 2278 is out of bounds for axis 0 with size 2278 HOT 3
- bug: findwalks's for loop index is wrong at it's onset HOT 1
- Wrong description in `kcoreness_centrality_bu` HOT 1
- Update `get_rng` to return Generator instances
- Different implementations to compute global efficiency using bct.charpath and bct.efficiency_wei unclear HOT 1
- Does bct.efficiency_wei also work for directed networks? HOT 1
- Improve generalizability of partition_distance()
- No fucntion get_components.py inside module .algorithms? HOT 1
- Autofix(): Indexing error
- Issue with weighted transitivity and clustering coefficient? HOT 1
- Problem to run bct.modularity_dir with latest numpy HOT 1
- bct.charpath does not exclude 'Infs' in the distance matrix as mentioned in the documentation HOT 1
- Permutation max = 0 at stringent t-thresholds
- Official `bctpy` on `conda-forge` HOT 7
- local_assortativity_wu_sign not separating signs properly
- NBS covariates
- NBS parallel
- Release 0.6.1 missing tar.gz on Pipy HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bctpy.