From 98eb1d59d15a41369d174138e92d1b6b4f4792ad Mon Sep 17 00:00:00 2001 From: Christian Lorentzen Date: Mon, 1 May 2023 20:21:05 +0200 Subject: [PATCH 1/2] MNT remove unused args in _predict_regression_tree_inplace_fast_dense --- sklearn/ensemble/_gradient_boosting.pyx | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/sklearn/ensemble/_gradient_boosting.pyx b/sklearn/ensemble/_gradient_boosting.pyx index f310f2f25f7b1..834e3baee5fc4 100644 --- a/sklearn/ensemble/_gradient_boosting.pyx +++ b/sklearn/ensemble/_gradient_boosting.pyx @@ -33,7 +33,6 @@ cdef void _predict_regression_tree_inplace_fast_dense( double scale, Py_ssize_t k, Py_ssize_t n_samples, - Py_ssize_t n_features, cnp.float64_t[:, :] out ) noexcept nogil: """Predicts output for regression tree and stores it in ``out[i, k]``. @@ -60,16 +59,12 @@ cdef void _predict_regression_tree_inplace_fast_dense( k : int The index of the tree output to be predicted. Must satisfy 0 <= ``k`` < ``K``. - n_samples : int - The number of samples in the input array ``X``; - ``n_samples == X.shape[0]``. - n_features : int - The number of features; ``n_samples == X.shape[1]``. out : memory view on array of type np.float64_t The data array where the predictions are stored. ``out`` is assumed to be a two-dimensional array of shape ``(n_samples, K)``. """ + cdef SIZE_t n_samples = X.shape[0] cdef Py_ssize_t i cdef Node *node for i in range(n_samples): @@ -212,8 +207,6 @@ def predict_stages( value=tree.value, scale=scale, k=k, - n_samples=X.shape[0], - n_features=X.shape[1], out=out ) # out[:, k] += scale * tree.predict(X).ravel() From c121c8e435104191acf7784e951dc1ab1a4f457c Mon Sep 17 00:00:00 2001 From: Christian Lorentzen Date: Tue, 2 May 2023 20:32:07 +0200 Subject: [PATCH 2/2] CLN remove n_samples arg --- sklearn/ensemble/_gradient_boosting.pyx | 1 - 1 file changed, 1 deletion(-) diff --git a/sklearn/ensemble/_gradient_boosting.pyx b/sklearn/ensemble/_gradient_boosting.pyx index 834e3baee5fc4..b7846cc38f4af 100644 --- a/sklearn/ensemble/_gradient_boosting.pyx +++ b/sklearn/ensemble/_gradient_boosting.pyx @@ -32,7 +32,6 @@ cdef void _predict_regression_tree_inplace_fast_dense( double *value, double scale, Py_ssize_t k, - Py_ssize_t n_samples, cnp.float64_t[:, :] out ) noexcept nogil: """Predicts output for regression tree and stores it in ``out[i, k]``.