I just want to change the log function while calculating entropy, how can I do this in the scikit library?
On Thu, Jan 9, 2020 at 2:41 PM Adrin <adrin.jal...@gmail.com> wrote: > Outside GIL, you can't really work easily with Python objects. You should > instead stick to local C variables and routines. For instance, instead of > numpy routines, you can use cmath routines. > > The cython book ( > https://www.amazon.com/Cython-Programmers-Kurt-W-Smith/dp/1491901551) > and Nicolas's post (http://nicolas-hug.com/blog/cython_notes) may give > you some hints. > > On Thu, Jan 9, 2020 at 7:24 AM aditya aggarwal < > adityaselfeffici...@gmail.com> wrote: > >> Hello >> >> I'm trying to change the entropy function which is used in sklearn for >> DecisionTreeClassification locally on my system. >> when I rerun the pip install --editable . command after updating the >> cython file, I receive the following error message: >> >> Error compiling Cython file: >> ------------------------------------------------------------ >> ... >> for k in range(self.n_outputs): >> for c in range(n_classes[k]): >> count_k = sum_total[c] >> if count_k > 0.0: >> count_k /= self.weighted_n_node_samples >> entropy -= count_k * np.log2(count_k) >> ^ >> ------------------------------------------------------------ >> >> sklearn/tree/_criterion.pyx:537:20: Coercion from Python not allowed >> without the GIL >> >> This error is persisten with other errors as: >> >> Operation not allowed without gil >> Converting to Python object not allowed without gil >> Converting to Python object not allowed without gil >> Calling gil-requiring function not allowed without gil >> Accessing Python attribute not allowed without gil >> Accessing Python global or builtin not allowed without gil >> >> >> I've tried looking up for solution on various sites, but could not >> resolve the issue. >> Any help would be appreciated. >> >> Thanks and regards >> Aditya Aggarwal >> _______________________________________________ >> scikit-learn mailing list >> scikit-learn@python.org >> https://mail.python.org/mailman/listinfo/scikit-learn >> > _______________________________________________ > scikit-learn mailing list > scikit-learn@python.org > https://mail.python.org/mailman/listinfo/scikit-learn >
_______________________________________________ scikit-learn mailing list scikit-learn@python.org https://mail.python.org/mailman/listinfo/scikit-learn