如何将双精度数组的数据帧转换为矢量?

时间:2017-11-29 01:46:59

标签: scala apache-spark

我有以下数据帧,其中包含需要转换为Vectors的双精度数组,以便将其传递给ML算法。任何人都可以帮我这个吗?

fList: org.apache.spark.sql.DataFrame = [features: array<double>]
+--------------------------------------------------------------------------------+
|features                                                                        |
+--------------------------------------------------------------------------------+
|[2.5046410000000003, 2.1487149999999997, 1.0884870000000002, 3.5877090000000003]|
|[0.9558040000000001, 0.9843780000000002, 0.545025, 0.9979860000000002]          |
+--------------------------------------------------------------------------------+

预期产出: 应该看起来像这样。

fList: org.apache.spark.sql.DataFrame = [features: vector]

0 个答案:

没有答案