Skip to content
Snippets Groups Projects
Commit 2d33323c authored by Reynold Xin's avatar Reynold Xin
Browse files

[MLlib] Add support for BooleanType to VectorAssembler.

Author: Reynold Xin <rxin@databricks.com>

Closes #5648 from rxin/vectorAssembler-boolean and squashes the following commits:

1bf3d40 [Reynold Xin] [MLlib] Add support for BooleanType to VectorAssembler.
parent d9e70f33
No related branches found
No related tags found
No related merge requests found
......@@ -55,7 +55,7 @@ class VectorAssembler extends Transformer with HasInputCols with HasOutputCol {
schema(c).dataType match {
case DoubleType => UnresolvedAttribute(c)
case t if t.isInstanceOf[VectorUDT] => UnresolvedAttribute(c)
case _: NumericType =>
case _: NumericType | BooleanType =>
Alias(Cast(UnresolvedAttribute(c), DoubleType), s"${c}_double_$uid")()
}
}
......@@ -68,7 +68,7 @@ class VectorAssembler extends Transformer with HasInputCols with HasOutputCol {
val outputColName = map(outputCol)
val inputDataTypes = inputColNames.map(name => schema(name).dataType)
inputDataTypes.foreach {
case _: NumericType =>
case _: NumericType | BooleanType =>
case t if t.isInstanceOf[VectorUDT] =>
case other =>
throw new IllegalArgumentException(s"Data type $other is not supported.")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment