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

Skip to content

Commit 9cc76c7

Browse files
authored
Merge branch 'main' into samples
2 parents ea1e624 + a7698a8 commit 9cc76c7

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
USE_NEWEST_NUMPY_C_API = (
7171
"sklearn.__check_build._check_build",
7272
"sklearn._loss._loss",
73+
"sklearn.cluster._dbscan_inner",
7374
"sklearn.cluster._k_means_common",
7475
"sklearn.cluster._k_means_lloyd",
7576
"sklearn.cluster._k_means_elkan",

sklearn/cluster/_dbscan_inner.pyx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@ cimport numpy as cnp
77

88
cnp.import_array()
99

10-
11-
def dbscan_inner(cnp.ndarray[cnp.uint8_t, ndim=1, mode='c'] is_core,
12-
cnp.ndarray[object, ndim=1] neighborhoods,
13-
cnp.ndarray[cnp.npy_intp, ndim=1, mode='c'] labels):
10+
def dbscan_inner(const cnp.uint8_t[::1] is_core,
11+
object[:] neighborhoods,
12+
cnp.npy_intp[::1] labels):
1413
cdef cnp.npy_intp i, label_num = 0, v
15-
cdef cnp.ndarray[cnp.npy_intp, ndim=1] neighb
14+
cdef cnp.npy_intp[:] neighb
1615
cdef vector[cnp.npy_intp] stack
1716

1817
for i in range(labels.shape[0]):

sklearn/metrics/_classification.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
from ..utils.multiclass import type_of_target
4141
from ..utils.validation import _num_samples
4242
from ..utils.sparsefuncs import count_nonzero
43+
from ..utils._param_validation import validate_params
4344
from ..exceptions import UndefinedMetricWarning
4445

4546
from ._base import _check_pos_label_consistency
@@ -142,6 +143,14 @@ def _weighted_sum(sample_score, sample_weight, normalize=False):
142143
return sample_score.sum()
143144

144145

146+
@validate_params(
147+
{
148+
"y_true": ["array-like", "sparse matrix"],
149+
"y_pred": ["array-like", "sparse matrix"],
150+
"normalize": ["boolean"],
151+
"sample_weight": ["array-like", None],
152+
}
153+
)
145154
def accuracy_score(y_true, y_pred, *, normalize=True, sample_weight=None):
146155
"""Accuracy classification score.
147156

sklearn/tests/test_public_functions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
PARAM_VALIDATION_FUNCTION_LIST = [
1212
"sklearn.cluster.kmeans_plusplus",
1313
"sklearn.svm.l1_min_c",
14+
"sklearn.metrics.accuracy_score",
1415
]
1516

1617

0 commit comments

Comments
 (0)