sparse vectors increase tree creation speed by 400x

This is a tiny change to allow the usage of sparse vectors (http://en.wikipedia.org/wiki/Sparse_vector) and it has huge speed implications. To demonstrate these I've created SparseVectorTest.java if you run it you will get something like:

Training with sparse vectors took: 4 milliseconds
true=0.503 false=0.497 
Training with dense vectors took: 1650 milliseconds
true=0.503 false=0.497 
Correct that's all that there is to it. That is the meaning of a sparse
vector. A vector where the default value is not specified. Yet the speed
increase to your project should be quite dramatical. I use my branch every
day without any issue.


On Mon, Jun 23, 2014 at 3:23 PM, Chris Reeves <notifications@github.com>
wrote:

> In src/main/java/quickdt/data/HashMapAttributes.java:
>
> > @@ -39,7 +39,10 @@ public boolean isEmpty() {
> >
> >      @Override
> >      public Serializable get(final Object key) {
> > -        return delegatedHashMap.get(key);
> > +        if(delegatedHashMap.containsKey(key))
> > +            return delegatedHashMap.get(key);
> > +        else
> > +            return 0;
>
> This change hides the difference between a missing attribute and an
> attribute with value 0
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/sanity/quickdt/pull/35/files#r14094556>.
>