Repository: spark
Updated Branches:
  refs/heads/master 7226e1906 -> 6d5aeaae2


[SPARK-14969][MLLIB] Remove duplicate implementation of compute in 
LogisticGradient

## What changes were proposed in this pull request?

This PR removes duplicate implementation of compute in LogisticGradient class

## How was this patch tested?

unit tests

Author: dding3 <[email protected]>

Closes #12747 from dding3/master.


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

Branch: refs/heads/master
Commit: 6d5aeaae264579673bb75d32a8e4cd96aad9cf83
Parents: 7226e19
Author: dding3 <[email protected]>
Authored: Fri Apr 29 10:19:51 2016 +0100
Committer: Sean Owen <[email protected]>
Committed: Fri Apr 29 10:19:51 2016 +0100

----------------------------------------------------------------------
 mllib/src/main/scala/org/apache/spark/ml/ann/Layer.scala      | 7 -------
 .../scala/org/apache/spark/mllib/optimization/Gradient.scala  | 6 ------
 2 files changed, 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/6d5aeaae/mllib/src/main/scala/org/apache/spark/ml/ann/Layer.scala
----------------------------------------------------------------------
diff --git a/mllib/src/main/scala/org/apache/spark/ml/ann/Layer.scala 
b/mllib/src/main/scala/org/apache/spark/ml/ann/Layer.scala
index 913479f..3588ac1 100644
--- a/mllib/src/main/scala/org/apache/spark/ml/ann/Layer.scala
+++ b/mllib/src/main/scala/org/apache/spark/ml/ann/Layer.scala
@@ -577,13 +577,6 @@ private[ann] object FeedForwardModel {
  * @param dataStacker data stacker
  */
 private[ann] class ANNGradient(topology: Topology, dataStacker: DataStacker) 
extends Gradient {
-
-  override def compute(data: Vector, label: Double, weights: Vector): (Vector, 
Double) = {
-    val gradient = Vectors.zeros(weights.size)
-    val loss = compute(data, label, weights, gradient)
-    (gradient, loss)
-  }
-
   override def compute(
     data: Vector,
     label: Double,

http://git-wip-us.apache.org/repos/asf/spark/blob/6d5aeaae/mllib/src/main/scala/org/apache/spark/mllib/optimization/Gradient.scala
----------------------------------------------------------------------
diff --git 
a/mllib/src/main/scala/org/apache/spark/mllib/optimization/Gradient.scala 
b/mllib/src/main/scala/org/apache/spark/mllib/optimization/Gradient.scala
index 240baeb..450ed8f 100644
--- a/mllib/src/main/scala/org/apache/spark/mllib/optimization/Gradient.scala
+++ b/mllib/src/main/scala/org/apache/spark/mllib/optimization/Gradient.scala
@@ -146,12 +146,6 @@ class LogisticGradient(numClasses: Int) extends Gradient {
 
   def this() = this(2)
 
-  override def compute(data: Vector, label: Double, weights: Vector): (Vector, 
Double) = {
-    val gradient = Vectors.zeros(weights.size)
-    val loss = compute(data, label, weights, gradient)
-    (gradient, loss)
-  }
-
   override def compute(
       data: Vector,
       label: Double,


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to