单项选择题
MLlib中创建稀疏矩阵((0.0,2.0),(3.0,0.0),(0.0,6.0))的语句是()
A.val dm:Matrix=Matrices.dense(3,2,Array(0.0,3.0,0.0,2.0,0.0,6.0))
B.val dm:Matrix=Matrices.sparse(3,2,Array(0.0,2.0,3.0,0.0,0.0,6.0))
C.val sm:Matrix=Matrices.sparse(3,2,Array(0,1,2),Array(1,0,1),Array(2,3,6))
D.val sm:Matrix=Matrices.dense(3,2,Array(0,1,2),Array(1,0,1),Array(2,3,6))
相关考题
-
单项选择题
基于密集向量(1.0,0.0,3.0)创建一个LabledPoint,设其标识值为1.0,以下正确的选项为()
A.val pos=LabeledPoint(1.0,Vectors.dense(1.0,0.0,3.0))
B.val pos=LabeledPoint(1.0,(1.0,0.0,3.0))
C.val pos=LabeledPoint(Vectors.dense(1.0,0.0,3.0),1.0)
D.val pos=LabeledPoint((1.0,0.0,3.0),1.0) -
单项选择题
val rdd=sc.parallelize(1to10).filter(_%2==0)rdd.collect上述代码的执行结果为()
A.Array(1,2,3,4,5,6,7,8,9,10)
B.Array(1,3,5,7,9)
C.Array(2,4,6,8,10)
D.Array(1,10) -
单项选择题
val rdd=sc.parallelize(List(("Tom",2),("Lee",5),("Lee",6),(“Tom”,7)))rdd.reduceByKey((x,y)=>x+y).collect上述代码的执行结果为()
A.Array((1,2),(3,10))
B.Array((9,“Tom”),(11,“Lee”))
C.Array((“Tom”,9),(“Lee”,11))
D.Array((“Tom”,2,7),(“Lee”,5,6))
