[英]Does this function computeSVD use MapReduce in Pyspark
computeSVD()
是否使用 map , reduce 因為它是預定義的函數?
我不知道函數的代碼。
from pyspark.mllib.linalg import Vectors
from pyspark.mllib.linalg.distributed import RowMatrix
rows = sc.parallelize([
Vectors.sparse(5, {1: 1.0, 3: 7.0}),
Vectors.dense(2.0, 0.0, 3.0, 4.0, 5.0),
Vectors.dense(4.0, 0.0, 0.0, 6.0, 7.0)
])
mat = RowMatrix(rows)
# Compute the top 5 singular values and corresponding singular vectors.
svd = mat.computeSVD(5, computeU=True) <------------- this function
U = svd.U # The U factor is a RowMatrix.
s = svd.s # The singular values are stored in a local dense vector.
V = svd.V # The V factor is a local dense matrix.
確實如此,來自Spark 文檔
此頁面記錄了基於 RDD 的 API(spark.mllib 包)的 MLlib 指南部分。 請參閱基於 DataFrame 的 API(spark.ml 包)的 MLlib 主指南,它現在是 MLlib 的主要 API。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.