spark-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject git commit: [SPARK-3856][MLLIB] use norm operator after breeze 0.10 upgrade
Date Thu, 09 Oct 2014 05:35:18 GMT
Repository: spark
Updated Branches:
  refs/heads/master f706823b7 -> 9c439d331


[SPARK-3856][MLLIB] use norm operator after breeze 0.10 upgrade

Got warning msg:

~~~
[warn] /Users/meng/src/spark/mllib/src/main/scala/org/apache/spark/mllib/feature/Normalizer.scala:50:
method norm in trait NumericOps is deprecated: Use norm(XXX) instead of XXX.norm
[warn]     var norm = vector.toBreeze.norm(p)
~~~

dbtsai

Author: Xiangrui Meng <meng@databricks.com>

Closes #2718 from mengxr/SPARK-3856 and squashes the following commits:

4f38169 [Xiangrui Meng] use norm operator


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/9c439d33
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/9c439d33
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/9c439d33

Branch: refs/heads/master
Commit: 9c439d33160ef3b31173381735dfa8cfb7d552ba
Parents: f706823
Author: Xiangrui Meng <meng@databricks.com>
Authored: Wed Oct 8 22:35:14 2014 -0700
Committer: Xiangrui Meng <meng@databricks.com>
Committed: Wed Oct 8 22:35:14 2014 -0700

----------------------------------------------------------------------
 .../main/scala/org/apache/spark/mllib/feature/Normalizer.scala   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/9c439d33/mllib/src/main/scala/org/apache/spark/mllib/feature/Normalizer.scala
----------------------------------------------------------------------
diff --git a/mllib/src/main/scala/org/apache/spark/mllib/feature/Normalizer.scala b/mllib/src/main/scala/org/apache/spark/mllib/feature/Normalizer.scala
index 3afb477..4734251 100644
--- a/mllib/src/main/scala/org/apache/spark/mllib/feature/Normalizer.scala
+++ b/mllib/src/main/scala/org/apache/spark/mllib/feature/Normalizer.scala
@@ -17,7 +17,7 @@
 
 package org.apache.spark.mllib.feature
 
-import breeze.linalg.{DenseVector => BDV, SparseVector => BSV}
+import breeze.linalg.{DenseVector => BDV, SparseVector => BSV, norm => brzNorm}
 
 import org.apache.spark.annotation.Experimental
 import org.apache.spark.mllib.linalg.{Vector, Vectors}
@@ -47,7 +47,7 @@ class Normalizer(p: Double) extends VectorTransformer {
    * @return normalized vector. If the norm of the input is zero, it will return the input
vector.
    */
   override def transform(vector: Vector): Vector = {
-    var norm = vector.toBreeze.norm(p)
+    var norm = brzNorm(vector.toBreeze, p)
 
     if (norm != 0.0) {
       // For dense vector, we've to allocate new memory for new output vector.


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org


Mime
View raw message