@@ -38,9 +38,8 @@ class IsotonicRegressionSuite
3838 val alg = new IsotonicRegression
3939 val model = alg.run(trainRDD, true )
4040
41- model.predictions should be(
42- generateIsotonicInput(
43- 1 , 2 , 7d / 3 , 7d / 3 , 7d / 3 , 6 , 7 , 8 , 10 , 10 , 10 , 12 , 14 , 15 , 16.5 , 16.5 , 17 , 18 , 19 , 20 ))
41+ model.labels should be(
42+ Array (1 , 2 , 7d / 3 , 7d / 3 , 7d / 3 , 6 , 7 , 8 , 10 , 10 , 10 , 12 , 14 , 15 , 16.5 , 16.5 , 17 , 18 , 19 , 20 ))
4443 }
4544
4645 test(" increasing isotonic regression using api" ) {
@@ -50,9 +49,8 @@ class IsotonicRegressionSuite
5049
5150 val model = IsotonicRegression .train(trainRDD, true )
5251
53- model.predictions should be(
54- generateIsotonicInput(
55- 1 , 2 , 7d / 3 , 7d / 3 , 7d / 3 , 6 , 7 , 8 , 10 , 10 , 10 , 12 , 14 , 15 , 16.5 , 16.5 , 17 , 18 , 19 , 20 ))
52+ model.labels should be(
53+ Array (1 , 2 , 7d / 3 , 7d / 3 , 7d / 3 , 6 , 7 , 8 , 10 , 10 , 10 , 12 , 14 , 15 , 16.5 , 16.5 , 17 , 18 , 19 , 20 ))
5654 }
5755
5856 test(" isotonic regression with size 0" ) {
@@ -61,7 +59,7 @@ class IsotonicRegressionSuite
6159 val alg = new IsotonicRegression
6260 val model = alg.run(trainRDD, true )
6361
64- model.predictions should be(List ())
62+ model.labels should be(Array ())
6563 }
6664
6765 test(" isotonic regression with size 1" ) {
@@ -70,7 +68,7 @@ class IsotonicRegressionSuite
7068 val alg = new IsotonicRegression
7169 val model = alg.run(trainRDD, true )
7270
73- model.predictions should be(generateIsotonicInput( 1 ))
71+ model.labels should be(Array ( 1.0 ))
7472 }
7573
7674 test(" isotonic regression strictly increasing sequence" ) {
@@ -79,7 +77,7 @@ class IsotonicRegressionSuite
7977 val alg = new IsotonicRegression
8078 val model = alg.run(trainRDD, true )
8179
82- model.predictions should be(generateIsotonicInput (1 , 2 , 3 , 4 , 5 ))
80+ model.labels should be(Array (1 , 2 , 3 , 4 , 5 ))
8381 }
8482
8583 test(" isotonic regression strictly decreasing sequence" ) {
@@ -88,7 +86,7 @@ class IsotonicRegressionSuite
8886 val alg = new IsotonicRegression
8987 val model = alg.run(trainRDD, true )
9088
91- model.predictions should be(generateIsotonicInput (3 , 3 , 3 , 3 , 3 ))
89+ model.labels should be(Array (3 , 3 , 3 , 3 , 3 ))
9290 }
9391
9492 test(" isotonic regression with last element violating monotonicity" ) {
@@ -97,7 +95,7 @@ class IsotonicRegressionSuite
9795 val alg = new IsotonicRegression
9896 val model = alg.run(trainRDD, true )
9997
100- model.predictions should be(generateIsotonicInput (1 , 2 , 3 , 3 , 3 ))
98+ model.labels should be(Array (1 , 2 , 3 , 3 , 3 ))
10199 }
102100
103101 test(" isotonic regression with first element violating monotonicity" ) {
@@ -106,7 +104,7 @@ class IsotonicRegressionSuite
106104 val alg = new IsotonicRegression
107105 val model = alg.run(trainRDD, true )
108106
109- model.predictions should be(generateIsotonicInput (3 , 3 , 3 , 4 , 5 ))
107+ model.labels should be(Array (3 , 3 , 3 , 4 , 5 ))
110108 }
111109
112110 test(" isotonic regression with negative labels" ) {
@@ -115,7 +113,7 @@ class IsotonicRegressionSuite
115113 val alg = new IsotonicRegression
116114 val model = alg.run(trainRDD, true )
117115
118- model.predictions should be(generateIsotonicInput (- 1.5 , - 1.5 , 0 , 0 , 0 ))
116+ model.labels should be(Array (- 1.5 , - 1.5 , 0 , 0 , 0 ))
119117 }
120118
121119 test(" isotonic regression with unordered input" ) {
@@ -124,7 +122,7 @@ class IsotonicRegressionSuite
124122 val alg = new IsotonicRegression
125123 val model = alg.run(trainRDD, true )
126124
127- model.predictions should be(generateIsotonicInput (1 , 2 , 3 , 4 , 5 ))
125+ model.labels should be(Array (1 , 2 , 3 , 4 , 5 ))
128126 }
129127
130128 test(" weighted isotonic regression" ) {
@@ -134,8 +132,7 @@ class IsotonicRegressionSuite
134132 val alg = new IsotonicRegression
135133 val model = alg.run(trainRDD, true )
136134
137- model.predictions should be(
138- generateWeightedIsotonicInput(Seq (1 , 2 , 2.75 , 2.75 ,2.75 ), Seq (1 , 1 , 1 , 1 , 2 )))
135+ model.labels should be(Array (1 , 2 , 2.75 , 2.75 ,2.75 ))
139136 }
140137
141138 test(" weighted isotonic regression with weights lower than 1" ) {
@@ -145,8 +142,7 @@ class IsotonicRegressionSuite
145142 val alg = new IsotonicRegression
146143 val model = alg.run(trainRDD, true )
147144
148- model.predictions.map(p => p.copy(_1 = round(p._1))) should be(
149- generateWeightedIsotonicInput(Seq (1 , 2 , 3.3 / 1.2 , 3.3 / 1.2 , 3.3 / 1.2 ), Seq (1 , 1 , 1 , 0.1 , 0.1 )))
145+ model.labels.map(round) should be(Array (1 , 2 , 3.3 / 1.2 , 3.3 / 1.2 , 3.3 / 1.2 ))
150146 }
151147
152148 test(" weighted isotonic regression with negative weights" ) {
@@ -155,8 +151,7 @@ class IsotonicRegressionSuite
155151 val alg = new IsotonicRegression
156152 val model = alg.run(trainRDD, true )
157153
158- model.predictions should be(
159- generateWeightedIsotonicInput(Seq (1.0 , 10.0 / 6 , 10.0 / 6 , 10.0 / 6 , 10.0 / 6 ), Seq (- 1 , 1 , - 3 , 1 , - 5 )))
154+ model.labels should be(Array (1.0 , 10.0 / 6 , 10.0 / 6 , 10.0 / 6 , 10.0 / 6 ))
160155 }
161156
162157 test(" weighted isotonic regression with zero weights" ) {
@@ -165,7 +160,7 @@ class IsotonicRegressionSuite
165160 val alg = new IsotonicRegression
166161 val model = alg.run(trainRDD, true )
167162
168- model.predictions should be(generateWeightedIsotonicInput( Seq ( 1 , 2 , 2 , 2 , 2 ), Seq ( 0 , 0 , 0 , 1 , 0 ) ))
163+ model.labels should be(Array ( 1 , 2 , 2 , 2 , 2 ))
169164 }
170165
171166 test(" isotonic regression prediction" ) {
0 commit comments