Comments (5)
I saw a previous post commenting the problem but nobody answer him:
#57
from bctpy.
I have checked the function, in line 110-111 you have this error message if the adjacency matrix has negative values:
if np.min(W) < -1e-10:
raise BCTParamError('adjmat must not contain negative weights')
But then for lines 122 to 138 if we select the negative_sym option or the_asym the program should continue:
if B in ('negative_sym', 'negative_asym'):
W0 = W * (W > 0)
s0 = np.sum(W0)
B0 = W0 - gamma * np.outer(np.sum(W0, axis=1), np.sum(W, axis=0)) / s0
W1 = W * (W < 0)
s1 = np.sum(W1)
if s1:
B1 = (W1 - gamma * np.outer(np.sum(W1, axis=1), np.sum(W1, axis=0))
/ s1)
else:
B1 = 0
elif np.min(W) < -1e-10:
raise BCTParamError("Input connection matrix contains negative "
'weights but objective function dealing with negative weights '
'was not selected')
However since you impose first the condition in lines 110-111 the function doesn't execute at all, I think that the condition from line 110-111 should be eliminated, since in lines 122 to 138 this problem is already dealt if the proper objective function isn't chosen.
from bctpy.
I believe you can happily eliminate the lines:
if np.min(W) < -1e-10:
raise BCTParamError('adjmat must not contain negative weights')
Moreover you need to fix a bit the code, there are a few errors using 'negative_asym' or 'negative_sym'. The value of modularity is normalized by s
twice in this case and the calculation of both B0
and B1
are wrong. I'll open a pull request with the fixed code.
from bctpy.
from bctpy.
Fixed in PR #65
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.