spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michał Zieliński <zielinski.mich...@gmail.com>
Subject Re: Spark ML : One hot Encoding for multiple columns
Date Wed, 17 Aug 2016 17:54:22 GMT
You can it just map over your columns and create a pipeline:

val columns = Array("colA", "colB", "colC")
val transformers: Array[PipelineStage] = columns.map {
x => new OneHotEncoder().setInputCol(x).setOutputCol(x + "Encoded")
}
val pipeline = new Pipeline()
  .setStages(transformers)



On 17 August 2016 at 18:18, janardhan shetty <janardhanp22@gmail.com> wrote:

> 2.0:
>
> One hot encoding currently accepts single input column is there a way to
> include multiple columns ?
>

Mime
View raw message