@@ -38,9 +38,8 @@ class IsotonicRegressionSuite
38
38
val alg = new IsotonicRegression
39
39
val model = alg.run(trainRDD, true )
40
40
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 ))
44
43
}
45
44
46
45
test(" increasing isotonic regression using api" ) {
@@ -50,9 +49,8 @@ class IsotonicRegressionSuite
50
49
51
50
val model = IsotonicRegression .train(trainRDD, true )
52
51
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 ))
56
54
}
57
55
58
56
test(" isotonic regression with size 0" ) {
@@ -61,7 +59,7 @@ class IsotonicRegressionSuite
61
59
val alg = new IsotonicRegression
62
60
val model = alg.run(trainRDD, true )
63
61
64
- model.predictions should be(List ())
62
+ model.labels should be(Array ())
65
63
}
66
64
67
65
test(" isotonic regression with size 1" ) {
@@ -70,7 +68,7 @@ class IsotonicRegressionSuite
70
68
val alg = new IsotonicRegression
71
69
val model = alg.run(trainRDD, true )
72
70
73
- model.predictions should be(generateIsotonicInput( 1 ))
71
+ model.labels should be(Array ( 1.0 ))
74
72
}
75
73
76
74
test(" isotonic regression strictly increasing sequence" ) {
@@ -79,7 +77,7 @@ class IsotonicRegressionSuite
79
77
val alg = new IsotonicRegression
80
78
val model = alg.run(trainRDD, true )
81
79
82
- model.predictions should be(generateIsotonicInput (1 , 2 , 3 , 4 , 5 ))
80
+ model.labels should be(Array (1 , 2 , 3 , 4 , 5 ))
83
81
}
84
82
85
83
test(" isotonic regression strictly decreasing sequence" ) {
@@ -88,7 +86,7 @@ class IsotonicRegressionSuite
88
86
val alg = new IsotonicRegression
89
87
val model = alg.run(trainRDD, true )
90
88
91
- model.predictions should be(generateIsotonicInput (3 , 3 , 3 , 3 , 3 ))
89
+ model.labels should be(Array (3 , 3 , 3 , 3 , 3 ))
92
90
}
93
91
94
92
test(" isotonic regression with last element violating monotonicity" ) {
@@ -97,7 +95,7 @@ class IsotonicRegressionSuite
97
95
val alg = new IsotonicRegression
98
96
val model = alg.run(trainRDD, true )
99
97
100
- model.predictions should be(generateIsotonicInput (1 , 2 , 3 , 3 , 3 ))
98
+ model.labels should be(Array (1 , 2 , 3 , 3 , 3 ))
101
99
}
102
100
103
101
test(" isotonic regression with first element violating monotonicity" ) {
@@ -106,7 +104,7 @@ class IsotonicRegressionSuite
106
104
val alg = new IsotonicRegression
107
105
val model = alg.run(trainRDD, true )
108
106
109
- model.predictions should be(generateIsotonicInput (3 , 3 , 3 , 4 , 5 ))
107
+ model.labels should be(Array (3 , 3 , 3 , 4 , 5 ))
110
108
}
111
109
112
110
test(" isotonic regression with negative labels" ) {
@@ -115,7 +113,7 @@ class IsotonicRegressionSuite
115
113
val alg = new IsotonicRegression
116
114
val model = alg.run(trainRDD, true )
117
115
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 ))
119
117
}
120
118
121
119
test(" isotonic regression with unordered input" ) {
@@ -124,7 +122,7 @@ class IsotonicRegressionSuite
124
122
val alg = new IsotonicRegression
125
123
val model = alg.run(trainRDD, true )
126
124
127
- model.predictions should be(generateIsotonicInput (1 , 2 , 3 , 4 , 5 ))
125
+ model.labels should be(Array (1 , 2 , 3 , 4 , 5 ))
128
126
}
129
127
130
128
test(" weighted isotonic regression" ) {
@@ -134,8 +132,7 @@ class IsotonicRegressionSuite
134
132
val alg = new IsotonicRegression
135
133
val model = alg.run(trainRDD, true )
136
134
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 ))
139
136
}
140
137
141
138
test(" weighted isotonic regression with weights lower than 1" ) {
@@ -145,8 +142,7 @@ class IsotonicRegressionSuite
145
142
val alg = new IsotonicRegression
146
143
val model = alg.run(trainRDD, true )
147
144
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 ))
150
146
}
151
147
152
148
test(" weighted isotonic regression with negative weights" ) {
@@ -155,8 +151,7 @@ class IsotonicRegressionSuite
155
151
val alg = new IsotonicRegression
156
152
val model = alg.run(trainRDD, true )
157
153
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 ))
160
155
}
161
156
162
157
test(" weighted isotonic regression with zero weights" ) {
@@ -165,7 +160,7 @@ class IsotonicRegressionSuite
165
160
val alg = new IsotonicRegression
166
161
val model = alg.run(trainRDD, true )
167
162
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 ))
169
164
}
170
165
171
166
test(" isotonic regression prediction" ) {
0 commit comments