本文整理汇总了Python中pyspark.ml.feature.VectorAssembler.explainParams方法的典型用法代码示例。如果您正苦于以下问题:Python VectorAssembler.explainParams方法的具体用法?Python VectorAssembler.explainParams怎么用?Python VectorAssembler.explainParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyspark.ml.feature.VectorAssembler
的用法示例。
在下文中一共展示了VectorAssembler.explainParams方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Pipeline
# 需要导入模块: from pyspark.ml.feature import VectorAssembler [as 别名]
# 或者: from pyspark.ml.feature.VectorAssembler import explainParams [as 别名]
# MAGIC %md
# MAGIC Now that we have created two new features through bucketing, let's combined those two features into a `Vector` with `VectorAssembler`.
# MAGIC
# MAGIC Set the params of `assembler` so that both "lengthFeatures" and "widthFeatures" are assembled into a column called "featuresBucketized".
# MAGIC
# MAGIC Then, set the stages of `pipeline` to include both bucketizers and the assembler as the last stage.
# MAGIC
# MAGIC Finally, use `pipeline` to generate a new `DataFrame` called `irisAssembled`.
# COMMAND ----------
from pyspark.ml.feature import VectorAssembler
pipeline = Pipeline()
assembler = VectorAssembler()
print assembler.explainParams()
print '\n',pipeline.explainParams()
# COMMAND ----------
# ANSWER
# Set assembler params
(assembler
.setInputCols(['lengthFeatures', 'widthFeatures'])
.setOutputCol('featuresBucketized'))
pipeline.setStages([lengthBucketizer, widthBucketizer, assembler])
irisAssembled = pipeline.fit(irisSeparateFeatures).transform(irisSeparateFeatures)
display(irisAssembled)
# COMMAND ----------