Skip to content

MAINT: remove from numpy.math cimport statements #26143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sklearn/decomposition/_online_lda_fast.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import numpy as np
cnp.import_array()

from libc.math cimport exp, fabs, log
from numpy.math cimport EULER


def mean_change(const floating[:] arr_1, const floating[:] arr_2):
Expand Down Expand Up @@ -91,6 +90,7 @@ def _dirichlet_expectation_2d(const floating[:, :] arr):
# After: J. Bernardo (1976). Algorithm AS 103: Psi (Digamma) Function.
# https://www.uv.es/~bernardo/1976AppStatist.pdf
cdef floating psi(floating x) noexcept nogil:
cdef double EULER = 0.577215664901532860606512090082402431
if x <= 1e-6:
# psi(x) = -EULER - 1/x + O(x)
return -EULER - 1. / x
Expand Down
2 changes: 1 addition & 1 deletion sklearn/ensemble/_hist_gradient_boosting/splitting.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
cimport cython
from cython.parallel import prange
import numpy as np
from libc.math cimport INFINITY
from libc.stdlib cimport malloc, free, qsort
from libc.string cimport memcpy
from numpy.math cimport INFINITY

from .common cimport X_BINNED_DTYPE_C
from .common cimport Y_DTYPE_C
Expand Down
3 changes: 1 addition & 2 deletions sklearn/linear_model/_sgd_fast.pyx.tp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ from cython cimport floating
import numpy as np
from time import time

from libc.math cimport exp, log, pow, fabs
from libc.math cimport exp, log, pow, fabs, INFINITY
cimport numpy as cnp
from numpy.math cimport INFINITY
cdef extern from "_sgd_fast_helpers.h":
bint skl_isfinite32(float) nogil
bint skl_isfinite64(double) nogil
Expand Down
3 changes: 1 addition & 2 deletions sklearn/tree/_criterion.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@

from libc.string cimport memcpy
from libc.string cimport memset
from libc.math cimport fabs
from libc.math cimport fabs, INFINITY

import numpy as np
cimport numpy as cnp
cnp.import_array()

from numpy.math cimport INFINITY
from scipy.special.cython_special cimport xlogy

from ._utils cimport log
Expand Down
3 changes: 1 addition & 2 deletions sklearn/utils/sparsefuncs_fast.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@

#!python

from libc.math cimport fabs, sqrt
from libc.math cimport fabs, sqrt, isnan
cimport numpy as cnp
import numpy as np
from cython cimport floating
from cython.parallel cimport prange
from numpy.math cimport isnan

from sklearn.utils._openmp_helpers import _openmp_effective_n_threads

Expand Down