[scikit-learn] Changes in the classifier
Adrin
adrin.jalali at gmail.com
Thu Jan 9 04:09:22 EST 2020
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 <
adityaselfefficient at 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 at python.org
> https://mail.python.org/mailman/listinfo/scikit-learn
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-learn/attachments/20200109/b1919e8b/attachment.html>
More information about the scikit-learn
mailing list