@@ -81,11 +81,11 @@ class GradientDescentSuite extends FunSuite with LocalSparkContext with ShouldMa
8181 // Add a extra variable consisting of all 1.0's for the intercept.
8282 val testData = GradientDescentSuite .generateGDInput(A , B , nPoints, 42 )
8383 val data = testData.map { case LabeledPoint (label, features) =>
84- label -> Vectors .dense (1.0 , features.toArray : _* )
84+ label -> (1.0 +: features )
8585 }
8686
8787 val dataRDD = sc.parallelize(data, 2 ).cache()
88- val initialWeightsWithIntercept = Vectors .dense( 1.0 , initialWeights : _* )
88+ val initialWeightsWithIntercept = 1.0 +: initialWeights
8989
9090 val (_, loss) = GradientDescent .runMiniBatchSGD(
9191 dataRDD,
@@ -111,7 +111,7 @@ class GradientDescentSuite extends FunSuite with LocalSparkContext with ShouldMa
111111 // Add a extra variable consisting of all 1.0's for the intercept.
112112 val testData = GradientDescentSuite .generateGDInput(2.0 , - 1.5 , 10000 , 42 )
113113 val data = testData.map { case LabeledPoint (label, features) =>
114- label -> Vectors .dense (1.0 , features.toArray : _* )
114+ label -> (1.0 +: features )
115115 }
116116
117117 val dataRDD = sc.parallelize(data, 2 ).cache()
0 commit comments