Comments (9)
我用了club数据集,跑出来的Q值是0.2869而不是CSDN展示的0.38,请问是什么问题呢?
我这里是正常的,可能是随机数的影响?
from communitydetection.
G = load_graph('club.txt')
obj = Graph()
G1 = obj.createGraph("club.txt")
start_time = time.time()
algorithm = Louvain(G)
communities = algorithm.execute()
end_time = time.time()
# 按照社区大小从大到小排序输出
communities = sorted(communities, key=lambda b: -len(b)) # 按社区大小排序
count = 0
for communitie in communities:
count += 1
print("社区", count, " ", communitie)
print(cal_Q(communities, G1))
print(f'算法执行时间{end_time - start_time}')
from communitydetection.
G = load_graph('club.txt') obj = Graph() G1 = obj.createGraph("club.txt") start_time = time.time() algorithm = Louvain(G) communities = algorithm.execute() end_time = time.time() # 按照社区大小从大到小排序输出 communities = sorted(communities, key=lambda b: -len(b)) # 按社区大小排序 count = 0 for communitie in communities: count += 1 print("社区", count, " ", communitie) print(cal_Q(communities, G1)) print(f'算法执行时间{end_time - start_time}')
主要代码是这样的,应该也没什么能错的地方啊。。。
from communitydetection.
G = load_graph('club.txt') obj = Graph() G1 = obj.createGraph("club.txt") start_time = time.time() algorithm = Louvain(G) communities = algorithm.execute() end_time = time.time() # 按照社区大小从大到小排序输出 communities = sorted(communities, key=lambda b: -len(b)) # 按社区大小排序 count = 0 for communitie in communities: count += 1 print("社区", count, " ", communitie) print(cal_Q(communities, G1)) print(f'算法执行时间{end_time - start_time}')
主要代码是这样的,应该也没什么能错的地方啊。。。
最终分区的结果是一样的,就是Q值不对。
from communitydetection.
G = load_graph('club.txt') obj = Graph() G1 = obj.createGraph("club.txt") start_time = time.time() algorithm = Louvain(G) communities = algorithm.execute() end_time = time.time() # 按照社区大小从大到小排序输出 communities = sorted(communities, key=lambda b: -len(b)) # 按社区大小排序 count = 0 for communitie in communities: count += 1 print("社区", count, " ", communitie) print(cal_Q(communities, G1)) print(f'算法执行时间{end_time - start_time}')
主要代码是这样的,应该也没什么能错的地方啊。。。
最终分区的结果是一样的,就是Q值不对。
obj.createGraph有点问题,邻居没重复计算。所以我用的G1 = nx.karate_club_graph()。以后有空修改下。
from communitydetection.
改为无向图就行了, self.graph = nx.Graph()
from communitydetection.
改为无向图就行了, self.graph = nx.Graph()
哇,确实解决了,感谢大佬。
from communitydetection.
我用了俱乐部数据集,跑出来的Q值是0.2869而不是CSDN展示的0.38,请问是什么问题呢?
有偿求教
from communitydetection.
想求教这个louvain算法的整个流程讲解,我需要对其进行改进,有偿求教,微信号LBJgigigi13
from communitydetection.
Related Issues (8)
- 可视化结果展示 HOT 16
- 请教有没有可以确定社区数量的社区发现算法 HOT 7
- 权重组合问题 HOT 2
- 你好!请教问题,copra算法有问题 HOT 3
- 请教一下基于广义模块度社区检测的问题 HOT 4
- 大佬厉害,这是我第一个运行成功的代码,我有两个问题想问一下 HOT 2
- 大佬您好,请教您有针对LBSN数据集(类似foursquare、gowalla等)的社区检测的方法或者代码吗? 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 communitydetection.