在computesvd()函数中使用的映射器和还原器是什么?
我是新手映射减少的新手,我想进行一些研究以使用MapReduce计算SVD。
- 代码方:我找到了
computesvd
a pyspark 函数,它使用 mapReduce ,如此讨论。 - 理论方面:在computesvd()函数中使用的映射器和还原器是什么?
我的代码
findspark.init('C:\spark\spark-3.0.3-bin-hadoop2.7')
conf=SparkConf()
conf.setMaster("local[*]")
conf.setAppName('firstapp')
sc = SparkContext(conf=conf)
spark = SparkSession(sc)
rows = np.loadtxt('data.txt', dtype=float) # data.txt is a (m rows x n cols) matrix m>n
rows = sc.parallelize(rows)
mat = RowMatrix(rows)
svd = mat.computeSVD(5, computeU=True)
我很大程度上会为任何帮助提供帮助。
i am new to Map reduce and i want to do some research to compute svd using mapreduce.
- the code side : i have found
computeSVD
a pyspark function and it uses mapreduce as said in this discussion . - the theory side : what is the mapper and reducer that are used in computeSVD() function ?
my code
findspark.init('C:\spark\spark-3.0.3-bin-hadoop2.7')
conf=SparkConf()
conf.setMaster("local[*]")
conf.setAppName('firstapp')
sc = SparkContext(conf=conf)
spark = SparkSession(sc)
rows = np.loadtxt('data.txt', dtype=float) # data.txt is a (m rows x n cols) matrix m>n
rows = sc.parallelize(rows)
mat = RowMatrix(rows)
svd = mat.computeSVD(5, computeU=True)
i would highely appriciate any help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在此函数
mappartitions
和dredbykey
的用法来自RDD对象,该对象与MapReduce相似,但不是与Hadoop MapReduce相同的库You can see in this function the usage of
mapPartitions
andreduceByKey
from the RDD object, which do something similar to MapReduce, but is not the same library as Hadoop Mapreduce