scikit learn - Build splitter.pyx (and splitter.pxd, from tree folder) using Cython on Sklearn -
its simple question, i'm having trouble on building _splitter.pyx _splitter.so (so can try changes made). right i'm trying build original file command:
cython -a _splitter.pyx
and generates following error:
error compiling cython file:
... self.index_to_samples, self.feature_values, end_negative, start_positive)
cdef int compare_size_t(const void* a, const void* b) nogil:
^
_splitter.pyx:1008:34: expected ')', found '*'
i tried changes like:
cython -3 _splitter.pyx
or
cython -a _splitter.pyx _splitter.pxd
but generated more errors. doing wrong?
when fixed, plan use command:
gcc -shared -pthread -fpic -fwrapv -o2 -wall -fno-strict-aliasing -i/usr/include/python2.7 -o _splitter.so _splitter.c
is correct approach?
thanks lot help
edit: upgraded cython 0.24 version. following error in several lines:
error compiling cython file:
... features[f_i], features[f_j] = features[f_j], features[f_i]
# draw random threshold current.threshold = rand_uniform(min_feature_value, max_feature_value, random_state)
^
_splitter.pyx:1547:65: converting python object not allowed without gil
try upgrading cython installation. old versions (< 0.18) not support const keyword.
see how use const
answer: since cython 0.18, can use in code , in declarations.
earlier versions of cython did not support const directly , required following hack compile c source code:
Comments
Post a Comment