Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 08f1c26

Browse files
authored
MAINT: remove from numpy.math cimport statements (#26143)
1 parent f89af36 commit 08f1c26

File tree

5 files changed

+5
-8
lines changed

5 files changed

+5
-8
lines changed

sklearn/decomposition/_online_lda_fast.pyx

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import numpy as np
66
cnp.import_array()
77

88
from libc.math cimport exp, fabs, log
9-
from numpy.math cimport EULER
109

1110

1211
def mean_change(const floating[:] arr_1, const floating[:] arr_2):
@@ -91,6 +90,7 @@ def _dirichlet_expectation_2d(const floating[:, :] arr):
9190
# After: J. Bernardo (1976). Algorithm AS 103: Psi (Digamma) Function.
9291
# https://www.uv.es/~bernardo/1976AppStatist.pdf
9392
cdef floating psi(floating x) noexcept nogil:
93+
cdef double EULER = 0.577215664901532860606512090082402431
9494
if x <= 1e-6:
9595
# psi(x) = -EULER - 1/x + O(x)
9696
return -EULER - 1. / x

sklearn/ensemble/_hist_gradient_boosting/splitting.pyx

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
cimport cython
1111
from cython.parallel import prange
1212
import numpy as np
13+
from libc.math cimport INFINITY
1314
from libc.stdlib cimport malloc, free, qsort
1415
from libc.string cimport memcpy
15-
from numpy.math cimport INFINITY
1616

1717
from .common cimport X_BINNED_DTYPE_C
1818
from .common cimport Y_DTYPE_C

sklearn/linear_model/_sgd_fast.pyx.tp

+1-2
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@ from cython cimport floating
3030
import numpy as np
3131
from time import time
3232

33-
from libc.math cimport exp, log, pow, fabs
33+
from libc.math cimport exp, log, pow, fabs, INFINITY
3434
cimport numpy as cnp
35-
from numpy.math cimport INFINITY
3635
cdef extern from "_sgd_fast_helpers.h":
3736
bint skl_isfinite32(float) nogil
3837
bint skl_isfinite64(double) nogil

sklearn/tree/_criterion.pyx

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@
1414

1515
from libc.string cimport memcpy
1616
from libc.string cimport memset
17-
from libc.math cimport fabs
17+
from libc.math cimport fabs, INFINITY
1818

1919
import numpy as np
2020
cimport numpy as cnp
2121
cnp.import_array()
2222

23-
from numpy.math cimport INFINITY
2423
from scipy.special.cython_special cimport xlogy
2524

2625
from ._utils cimport log

sklearn/utils/sparsefuncs_fast.pyx

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@
88

99
#!python
1010

11-
from libc.math cimport fabs, sqrt
11+
from libc.math cimport fabs, sqrt, isnan
1212
cimport numpy as cnp
1313
import numpy as np
1414
from cython cimport floating
1515
from cython.parallel cimport prange
16-
from numpy.math cimport isnan
1716

1817
from sklearn.utils._openmp_helpers import _openmp_effective_n_threads
1918

0 commit comments

Comments
 (0)