glouppe/scikit-learn — pull request #12 by pprett (2013-07-19 19:20:38+00:00)
Title: Treev2 memoryview

Hi Gilles,

while I was reviewing your PR I noticed that some parts require X to be a C-style array. So I tried to use memory views instead. You can find the result in this PR - now DecisionTree and BaseForest support both c and fortran style input arrays. For my first benchmark I got the following result

pr/2131

class | train | test | score
------------|---------------|--------------|------------
CART(f) |72.1078s | 0.0363s | 0.0426
CART(c)| 72.4446s | 0.0255s | 0.0426

memview

class | train | test | score
------------|---------------|--------------|------------
CART(f) |**41.9233s**| 0.0357s | 0.0426
CART(c) |72.2346s | 0.0318s | 0.0426

I thought that's neat :-)

but then I checked master...

master

class | train | test | score
------------|---------------|--------------|------------
CART(f) | 32.2938s | 0.0305s | 0.0426
CART(c)| 33.2729s | 0.0455s | 0.0426

and then I checked random forests

class | train | test | score
------------|---------------|--------------|------------
RF(f) mv |201.6754s | 0.4962s | 0.0286
RF(f) v2 |188.8439s | 0.4888s | 0.0286

a bit disappointing... when I look at the generated c code it looks much "smaller" with memory views...

lets discuss this in Paris