Commit 03c4020
[SPARK-14610][ML] Remove superfluous split for continuous features in decision tree training
## What changes were proposed in this pull request?
A nonsensical split is produced from method `findSplitsForContinuousFeature` for decision trees. This PR removes the superfluous split and updates unit tests accordingly. Additionally, an assertion to check that the number of found splits is `> 0` is removed, and instead features with zero possible splits are ignored.
## How was this patch tested?
A unit test was added to check that finding splits for a constant feature produces an empty array.
Author: sethah <[email protected]>
Closes #12374 from sethah/SPARK-14610.1 parent 29f186b commit 03c4020
File tree
2 files changed
+52
-23
lines changed- mllib/src
- main/scala/org/apache/spark/ml/tree/impl
- test/scala/org/apache/spark/ml/tree/impl
2 files changed
+52
-23
lines changedLines changed: 15 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
705 | 705 | | |
706 | 706 | | |
707 | 707 | | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
708 | 716 | | |
709 | 717 | | |
710 | | - | |
711 | | - | |
712 | | - | |
713 | | - | |
714 | | - | |
715 | | - | |
| 718 | + | |
716 | 719 | | |
717 | 720 | | |
718 | 721 | | |
| |||
966 | 969 | | |
967 | 970 | | |
968 | 971 | | |
969 | | - | |
| 972 | + | |
970 | 973 | | |
971 | 974 | | |
972 | 975 | | |
| |||
975 | 978 | | |
976 | 979 | | |
977 | 980 | | |
978 | | - | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
979 | 984 | | |
980 | 985 | | |
981 | 986 | | |
| |||
987 | 992 | | |
988 | 993 | | |
989 | 994 | | |
990 | | - | |
| 995 | + | |
991 | 996 | | |
992 | | - | |
| 997 | + | |
993 | 998 | | |
994 | 999 | | |
995 | 1000 | | |
| |||
1023 | 1028 | | |
1024 | 1029 | | |
1025 | 1030 | | |
1026 | | - | |
1027 | | - | |
1028 | | - | |
1029 | | - | |
1030 | | - | |
1031 | | - | |
1032 | 1031 | | |
1033 | 1032 | | |
1034 | 1033 | | |
| |||
Lines changed: 37 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
| 118 | + | |
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
132 | | - | |
133 | | - | |
134 | | - | |
| 132 | + | |
135 | 133 | | |
136 | 134 | | |
137 | 135 | | |
138 | 136 | | |
139 | 137 | | |
140 | 138 | | |
141 | | - | |
| 139 | + | |
142 | 140 | | |
143 | 141 | | |
144 | 142 | | |
145 | 143 | | |
146 | | - | |
147 | | - | |
| 144 | + | |
148 | 145 | | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
149 | 179 | | |
150 | 180 | | |
151 | 181 | | |
| |||
0 commit comments