Commit 594a2cf
[SPARK-17792][ML] L-BFGS solver for linear regression does not accept general numeric label column types
## What changes were proposed in this pull request?
Before, we computed `instances` in LinearRegression in two spots, even though they did the same thing. One of them did not cast the label column to `DoubleType`. This patch consolidates the computation and always casts the label column to `DoubleType`.
## How was this patch tested?
Added a unit test to check all solvers. This test failed before this patch.
Author: sethah <[email protected]>
Closes #15364 from sethah/linreg_numeric_type.
(cherry picked from commit 3713bb1)
Signed-off-by: Yanbo Liang <[email protected]>1 parent b1a9c41 commit 594a2cf
File tree
2 files changed
+11
-14
lines changed- mllib/src
- main/scala/org/apache/spark/ml/regression
- test/scala/org/apache/spark/ml/regression
2 files changed
+11
-14
lines changedLines changed: 6 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
166 | 172 | | |
167 | 173 | | |
168 | 174 | | |
169 | 175 | | |
170 | 176 | | |
171 | 177 | | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | 178 | | |
178 | 179 | | |
179 | 180 | | |
| |||
196 | 197 | | |
197 | 198 | | |
198 | 199 | | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | 200 | | |
206 | 201 | | |
207 | 202 | | |
| |||
Lines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1019 | 1019 | | |
1020 | 1020 | | |
1021 | 1021 | | |
1022 | | - | |
1023 | | - | |
1024 | | - | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
1025 | 1026 | | |
1026 | 1027 | | |
1027 | 1028 | | |
| 1029 | + | |
1028 | 1030 | | |
1029 | 1031 | | |
1030 | 1032 | | |
| |||
0 commit comments