[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 <dingding@dingding-ubuntu.sh.intel.com> Closes #12747 from dding3/master.
This commit is contained in:
parent
7226e19067
commit
6d5aeaae26
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue