[MRG] Factor out split data as struct in Tree splitters and builders

This uses a struct to store 6 C variables that get passed by tree builders into splitters, where they are duplicated for the current and best candidate. Copying `current` to `best` is now a one-liner. The refactor hence saves >300 lines of C code (or 18% of `_tree.c`!).

This changes the not-quite-public `Splitter.node_split` interface, so we may want to be conservative about it.

I originally made part of this patch as a contribution to #3173, where the code was duplicated another two times, but this version is a bit more ambitious in modifying the `node_split` interface and the tree builder, and I thought that might warrant separate review. If this interface is considered somewhat public, we might choose to include the change in 0.15 to minimise future API volatility.
I could only approximate documentation, as I don't have a strong enough
understanding of the algorithm. If you would like to document it, that
would be a great help.


On 19 June 2014 07:47, Arnaud Joly <notifications@github.com> wrote:

>  In sklearn/tree/_tree.pxd:
>
> > @@ -64,6 +64,16 @@ cdef class Criterion:
> >  # Splitter
> >  # =============================================================================
> >
> > +cdef struct SplitRecord:
> > +    # Data to track current and best split point
> > +    SIZE_t pos       # Set to >= end if the node is a leaf
> > +    SIZE_t feature
> > +    double threshold
> > +    double improvement
> > +    double impurity_left
> > +    double impurity_right
>
> Can you document the data structure?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/scikit-learn/scikit-learn/pull/3293/files#r13971518>.
>