Comments (6)
Seems like the difference is in the output of Katz.predict
. On my computer, this yields 0.010038160200000002, whereas in CI it gives 0.010101010100000004.
Given this test case:
G.add_weighted_edges_from(
[(1, 2, 1), (0, 2, 5), (2, 3, 1), (0, 4, 2), (1, 4, 1), (3, 5, 1), (4, 5, 3)]
)
the difference happens for nodes 1 and 2.
from linkpred.
Hmm, looks like it's not due to numpy or networkx version...
from linkpred.
Minimal testcase:
import networkx as nx
from linkpred.predictors import Katz
G = nx.Graph()
G.add_weighted_edges_from(
[(1, 2, 1), (0, 2, 5), (2, 3, 1), (0, 4, 2), (1, 4, 1), (3, 5, 1), (4, 5, 3)]
)
katz = Katz(G).predict(beta=beta, weight="weight", dtype=int)
assert katz[(1, 2)] == 0.010038160200000002
from linkpred.
Seems like the difference is between scipy 1.9 and 1.10.
from linkpred.
Matrix multiplication in scipy.sparse 1.10 is fundamentally different! It does element-wise multiplication.
In 1.9:
[9]: adj.todense()
array([[0, 1, 0, 0, 1, 0],
[1, 0, 5, 1, 0, 0],
[0, 5, 0, 0, 2, 0],
[0, 1, 0, 0, 0, 1],
[1, 0, 2, 0, 0, 3],
[0, 0, 0, 1, 3, 0]], dtype=int32)
[10]: (adj**2).todense()
array([[ 2, 0, 7, 1, 0, 3],
[ 0, 27, 0, 0, 11, 1],
[ 7, 0, 29, 5, 0, 6],
[ 1, 0, 5, 2, 3, 0],
[ 0, 11, 0, 3, 14, 0],
[ 3, 1, 6, 0, 0, 10]], dtype=int32)
In 1.10:
[10]: (adj**2).todense()
array([[ 0, 1, 0, 0, 1, 0],
[ 1, 0, 25, 1, 0, 0],
[ 0, 25, 0, 0, 4, 0],
[ 0, 1, 0, 0, 0, 1],
[ 1, 0, 4, 0, 0, 9],
[ 0, 0, 0, 1, 9, 0]], dtype=int32)
from linkpred.
This is presumably related to this note from the scipy.sparse
documentation:
x * y
no longer performs matrix multiplication, but element-wise multiplication (just like with NumPy arrays). To make code work with both arrays and matrices, usex @ y
for matrix multiplication.
from linkpred.
Related Issues (20)
- Clarify `excluded` parameter to `Predictor.__init__` HOT 1
- ROC Plot HOT 5
- error when running linkpred from terminal HOT 4
- Error when clling linkpred in linux HOT 10
- Test Community predictor HOT 3
- How to do link prediction on a large graph without 'MemoryError' HOT 3
- Error when nodes name are string type and int type HOT 2
- AssertionError with self-loops from Python but not from command line HOT 5
- I plot ROC curve successfully, but the range of the X axis isn't 0 to 1 HOT 1
- Port test suite to pytest HOT 1
- Typo while importing a module in Community class HOT 3
- ZeroDivisionError HOT 3
- EvaluationSheet : fully understand the universe terme HOT 1
- Dependabot couldn't authenticate with https://pypi.python.org/simple/
- how to explain the input file format HOT 2
- linkpred is in maintenance mode
- Update test infrastructure
- UndefinedError: Measure is undefined if there are no relevant or retrieved items HOT 1
- What link prediction method is used by the sample code in the linkpred folder HOT 4
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 linkpred.