lyhue1991 / pythonairoad Goto Github PK
View Code? Open in Web Editor NEWsource code of some articles
source code of some articles
您好,我在看 DBSCAN算法的Spark实现.ipynb 代码时候,有一处不是很明白,希望可以解答一下。
文中在第八步骤
/*================================================================================*/
// 八,求每一个簇的代表核心和簇元素数量
/*================================================================================*/
....
val rdd_result = rdd_cluster.reduceByKey((a,b)=>{
val id_set = a._3 | b._3 # 不明白
val result = if(a._2>=b._2) (a._1,a._2,id_set)
else (b._1,b._2,id_set)
result
})
...
在这里,rdd_cluster
进行了按照键的归并操作,但是rdd_cluster的已经是聚类的结果了,就说明rdd_cluster
的键都是唯一的,没有重复的,所以我认为这一步骤reduceByKey
是无用操作,是吗?
第二,如果我的第一的疑问有问题,那么成功运行了reduceByKey
的逻辑,但是在reduceByKey
的代码中,对相同类的邻居集合进行了并集|
操作,为什么邻居数量result._2
取的不是id_set
的长度,而是Max(a._2,b._2)
?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.