[MRG+1] split tree module into several packages#5230
[MRG+1] split tree module into several packages#5230arjoly merged 1 commit intoscikit-learn:masterfrom
Conversation
|
In all files using Numpy, make sure that the C-API is properly initialized using See https://github.com/cython/cython/wiki/tutorials-numpy#c-api-initalization This should fix the segfault I believe. I'll check the structure tomorrow. |
|
Solved. You're a genius. :) |
I got bit by this very obscure error several times and learned from it :) |
There was a problem hiding this comment.
I will remove this with the first round of comments.
|
As a double check, could you quickly make sure that there is no regression in terms of speed? (Should be all the same, but we are never too sure) (I am saying this because these changes add 12000 new lines of C code) |
|
For |
|
Other than my comments, I am happy with the code structure. I hope it will make our lives easier for the next PRs :) |
sklearn/tree/export.py
Outdated
There was a problem hiding this comment.
Can you have one import per line?
There was a problem hiding this comment.
This is better to have one import per line as it's easier to see changes whenever you use a software like git.
The culprit is cython and this is well known. Cython adds a lot of functions to handle all sort of situations without letting you know. |
|
Looks good, thanks @jmschrei |
|
All changes incorporated, and all unit tests pass on my computer. Lets see if travis/appveyor build. |
|
A last nitpick if you agree, can you sort import alphabetically? Thanks a lot for this pr. |
|
Times seem to be the same as well. All estimators use default settings and I'll alphabetize imports now. |
|
Could you run |
|
Thanks for the checks. +1 on my side |
|
Windows is not happy. I think maybe I'm not allowed to import inline functions? |
034a187 to
5978c0b
Compare
|
Everything looks good, commits have been squashed. @arjoly do you give your +1? |
|
|
I was thinking to this benchmark. Overall it looks good. I am merging. |
[MRG+1] split tree module into several packages
This pull request handles splitting
_tree.pyxinto_tree.pyxwith Tree and TreeBuilders,_splitter.pyxwith all splitters and split records,_criterion.pyxwith all criteria, and moves some functions into_utils.pyx. No code is changed, simply moved, in this PR. I almost have this working, with all unit tests passing except those which trigger a specific segfault. The segfault relates to the following function:specifically, this call:
In the test case,
shape = 1,data = [ 2 ], and it triggers a segfault. I have been reading aboutPyArray_SimpleNewFromDatabut figured that it might be easier to ask. So, (1) do you agree with this layout, and (2) do you know why this segfault is being triggered? Thanks!cc @glouppe @arjoly @ogrisel