Skip to content

Commit 1bed0a3

Browse files
sarutakmengxr
authored andcommitted
[SPARK-3372] [MLlib] MLlib doesn't pass maven build / checkstyle due to multi-byte character contained in Gradient.scala
Author: Kousuke Saruta <[email protected]> Closes apache#2248 from sarutak/SPARK-3372 and squashes the following commits: 73a28b8 [Kousuke Saruta] Replaced UTF-8 hyphen with ascii hyphen
1 parent 7c6e71f commit 1bed0a3

File tree

1 file changed

+2
-2
lines changed
  • mllib/src/main/scala/org/apache/spark/mllib/optimization

1 file changed

+2
-2
lines changed

mllib/src/main/scala/org/apache/spark/mllib/optimization/Gradient.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class LeastSquaresGradient extends Gradient {
128128
class HingeGradient extends Gradient {
129129
override def compute(data: Vector, label: Double, weights: Vector): (Vector, Double) = {
130130
val dotProduct = dot(data, weights)
131-
// Our loss function with {0, 1} labels is max(0, 1 - (2y 1) (f_w(x)))
131+
// Our loss function with {0, 1} labels is max(0, 1 - (2y - 1) (f_w(x)))
132132
// Therefore the gradient is -(2y - 1)*x
133133
val labelScaled = 2 * label - 1.0
134134
if (1.0 > labelScaled * dotProduct) {
@@ -146,7 +146,7 @@ class HingeGradient extends Gradient {
146146
weights: Vector,
147147
cumGradient: Vector): Double = {
148148
val dotProduct = dot(data, weights)
149-
// Our loss function with {0, 1} labels is max(0, 1 - (2y 1) (f_w(x)))
149+
// Our loss function with {0, 1} labels is max(0, 1 - (2y - 1) (f_w(x)))
150150
// Therefore the gradient is -(2y - 1)*x
151151
val labelScaled = 2 * label - 1.0
152152
if (1.0 > labelScaled * dotProduct) {

0 commit comments

Comments
 (0)