diff options
author | Jacek Laskowski <jacek@japila.pl> | 2016-05-05 16:34:27 -0700 |
---|---|---|
committer | Andrew Or <andrew@databricks.com> | 2016-05-05 16:34:27 -0700 |
commit | bbb77734374010e36731bf6db1fac0273de8206d (patch) | |
tree | 0ee24dee864521415ce1ae5e3a0b9857e147b4c9 /mllib | |
parent | 02c07e8999dca545849cb3aa758a624dc51cd1e9 (diff) | |
download | spark-bbb77734374010e36731bf6db1fac0273de8206d.tar.gz spark-bbb77734374010e36731bf6db1fac0273de8206d.tar.bz2 spark-bbb77734374010e36731bf6db1fac0273de8206d.zip |
[SPARK-15152][DOC][MINOR] Scaladoc and Code style Improvements
## What changes were proposed in this pull request?
Minor doc and code style fixes
## How was this patch tested?
local build
Author: Jacek Laskowski <jacek@japila.pl>
Closes #12928 from jaceklaskowski/SPARK-15152.
Diffstat (limited to 'mllib')
-rw-r--r-- | mllib/src/main/scala/org/apache/spark/ml/feature/Binarizer.scala | 6 | ||||
-rw-r--r-- | mllib/src/main/scala/org/apache/spark/mllib/util/MLUtils.scala | 5 |
2 files changed, 5 insertions, 6 deletions
diff --git a/mllib/src/main/scala/org/apache/spark/ml/feature/Binarizer.scala b/mllib/src/main/scala/org/apache/spark/ml/feature/Binarizer.scala index 898ac2cc89..35bc46a5f3 100644 --- a/mllib/src/main/scala/org/apache/spark/ml/feature/Binarizer.scala +++ b/mllib/src/main/scala/org/apache/spark/ml/feature/Binarizer.scala @@ -104,9 +104,9 @@ final class Binarizer(override val uid: String) case DoubleType => BinaryAttribute.defaultAttr.withName(outputColName).toStructField() case _: VectorUDT => - new StructField(outputColName, new VectorUDT, true) - case other => - throw new IllegalArgumentException(s"Data type $other is not supported.") + StructField(outputColName, new VectorUDT) + case _ => + throw new IllegalArgumentException(s"Data type $inputType is not supported.") } if (schema.fieldNames.contains(outputColName)) { diff --git a/mllib/src/main/scala/org/apache/spark/mllib/util/MLUtils.scala b/mllib/src/main/scala/org/apache/spark/mllib/util/MLUtils.scala index 774170ff40..86ce9705a3 100644 --- a/mllib/src/main/scala/org/apache/spark/mllib/util/MLUtils.scala +++ b/mllib/src/main/scala/org/apache/spark/mllib/util/MLUtils.scala @@ -104,7 +104,7 @@ object MLUtils { val (indices, values) = items.tail.filter(_.nonEmpty).map { item => val indexAndValue = item.split(':') val index = indexAndValue(0).toInt - 1 // Convert 1-based indices to 0-based. - val value = indexAndValue(1).toDouble + val value = indexAndValue(1).toDouble (index, value) }.unzip @@ -119,8 +119,7 @@ object MLUtils { previous = current i += 1 } - - (label, indices.toArray, values.toArray) + (label, indices, values) } /** |