apache/spark — pull request #1941 by chouqin (2014-08-14 08:12:38+00:00)
Title: [SPARK-3022] [mllib] FindBinsForLevel in decision tree should call findBin only once for each feature

`findbinsForLevel` is applied to every `LabeledPoint` to find bins for all nodes at a given level. Given a specific `LabeledPoint` and a specific feature, the bin to put this labeled point should always be same.But in current implementation, `findBin` on a (labeledpoint, feature) pair is called for all nodes and all levels, which is a waste of computation.

In my implementation, `findBin` for each (labeledpoint, feature) pair is executed only once before the start of level-wise training of decision tree. Then, at each level, this `feature2bin` array can be reused.

What's more, `findbinsForLevel` now return a array of smaller size, all the nodes on which this labeledPoint is valid share the same `feature2bin` array, instead of each node having a copy of it.

CC: @mengxr @manishamde @jkbradley, Please have a look at this, thanks.