Skip to content

Commit 2303c89

Browse files
authored
MNT Use cimport numpy as cnp in _isotonic.pyx (#23303)
1 parent fff9e18 commit 2303c89

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

sklearn/_isotonic.pyx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
# pool at each step.
66

77
import numpy as np
8-
cimport numpy as np
8+
cimport numpy as cnp
99
cimport cython
1010
from cython cimport floating
1111

12-
np.import_array()
12+
cnp.import_array()
1313

1414

1515
def _inplace_contiguous_isotonic_regression(floating[::1] y, floating[::1] w):
@@ -63,9 +63,9 @@ def _inplace_contiguous_isotonic_regression(floating[::1] y, floating[::1] w):
6363
i = k
6464

6565

66-
def _make_unique(np.ndarray[dtype=floating] X,
67-
np.ndarray[dtype=floating] y,
68-
np.ndarray[dtype=floating] sample_weights):
66+
def _make_unique(cnp.ndarray[dtype=floating] X,
67+
cnp.ndarray[dtype=floating] y,
68+
cnp.ndarray[dtype=floating] sample_weights):
6969
"""Average targets for duplicate X, drop duplicates.
7070
7171
Aggregates duplicate X values into a single X value where
@@ -76,10 +76,10 @@ def _make_unique(np.ndarray[dtype=floating] X,
7676
"""
7777
unique_values = len(np.unique(X))
7878

79-
cdef np.ndarray[dtype=floating] y_out = np.empty(unique_values,
79+
cdef cnp.ndarray[dtype=floating] y_out = np.empty(unique_values,
8080
dtype=X.dtype)
81-
cdef np.ndarray[dtype=floating] x_out = np.empty_like(y_out)
82-
cdef np.ndarray[dtype=floating] weights_out = np.empty_like(y_out)
81+
cdef cnp.ndarray[dtype=floating] x_out = np.empty_like(y_out)
82+
cdef cnp.ndarray[dtype=floating] weights_out = np.empty_like(y_out)
8383

8484
cdef floating current_x = X[0]
8585
cdef floating current_y = 0

0 commit comments

Comments
 (0)