aboutsummaryrefslogtreecommitdiff
path: root/mllib/src
diff options
context:
space:
mode:
authorReynold Xin <rxin@databricks.com>2015-04-22 23:54:48 -0700
committerReynold Xin <rxin@databricks.com>2015-04-22 23:54:48 -0700
commit2d33323cadbf58dd1d05ffff998d18cad6a896cd (patch)
tree99626bcaa5b8f07f86f820b51ffc7cb8ff215c70 /mllib/src
parentd9e70f331fc3999d615ede49fc69a993dc65f272 (diff)
downloadspark-2d33323cadbf58dd1d05ffff998d18cad6a896cd.tar.gz
spark-2d33323cadbf58dd1d05ffff998d18cad6a896cd.tar.bz2
spark-2d33323cadbf58dd1d05ffff998d18cad6a896cd.zip
[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.
Diffstat (limited to 'mllib/src')
-rw-r--r--mllib/src/main/scala/org/apache/spark/ml/feature/VectorAssembler.scala4
1 files changed, 2 insertions, 2 deletions
diff --git a/mllib/src/main/scala/org/apache/spark/ml/feature/VectorAssembler.scala b/mllib/src/main/scala/org/apache/spark/ml/feature/VectorAssembler.scala
index fd16d3d6c2..7b2a451ca5 100644
--- a/mllib/src/main/scala/org/apache/spark/ml/feature/VectorAssembler.scala
+++ b/mllib/src/main/scala/org/apache/spark/ml/feature/VectorAssembler.scala
@@ -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.")