在computesvd()函数中使用的映射器和还原器是什么?

发布于 2025-01-31 10:08:41 字数 795 浏览 3 评论 0原文

我是新手映射减少的新手,我想进行一些研究以使用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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

终止放荡 2025-02-07 10:08:41

您可以在此函数 mappartitionsdredbykey的用法来自RDD对象,该对象与MapReduce相似,但不是与Hadoop MapReduce相同的库

You can see in this function the usage of mapPartitions and reduceByKey from the RDD object, which do something similar to MapReduce, but is not the same library as Hadoop Mapreduce

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文