From 3a04f65f5d62a7ed8eedc8b8c6d6ebaebe76d10c Mon Sep 17 00:00:00 2001 From: Frans Larsson Date: Tue, 28 Jul 2020 23:11:59 +0200 Subject: [PATCH 1/9] docstring improvements --- sklearn/utils/sparsefuncs.py | 70 ++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/sklearn/utils/sparsefuncs.py b/sklearn/utils/sparsefuncs.py index 17d1f51e5ca23..c50ae42362def 100644 --- a/sklearn/utils/sparsefuncs.py +++ b/sklearn/utils/sparsefuncs.py @@ -34,10 +34,10 @@ def inplace_csr_column_scale(X, scale): Parameters ---------- - X : CSR matrix with shape (n_samples, n_features) + X : CSR sparse matrix of shape (n_samples, n_features) Matrix to normalize using the variance of the features. - scale : float array with shape (n_features,) + scale : ndarray of float of shape (n_features,) Array of precomputed feature-wise values to use for scaling. """ assert scale.shape[0] == X.shape[1] @@ -52,10 +52,10 @@ def inplace_csr_row_scale(X, scale): Parameters ---------- - X : CSR sparse matrix, shape (n_samples, n_features) + X : CSR sparse matrix of shape (n_samples, n_features) Matrix to be scaled. - scale : float array with shape (n_samples,) + scale : ndarray of float of shape (n_samples,) Array of precomputed sample-wise values to use for scaling. """ assert scale.shape[0] == X.shape[0] @@ -63,11 +63,11 @@ def inplace_csr_row_scale(X, scale): def mean_variance_axis(X, axis): - """Compute mean and variance along an axix on a CSR or CSC matrix + """Compute mean and variance along an axis on a CSR or CSC matrix Parameters ---------- - X : CSR or CSC sparse matrix, shape (n_samples, n_features) + X : CSR or CSC sparse matrix of shape (n_samples, n_features) Input data. axis : int (either 0 or 1) @@ -76,11 +76,11 @@ def mean_variance_axis(X, axis): Returns ------- - means : float array with shape (n_features,) - Feature-wise means + means : ndarray of float of shape (n_features,) + Feature-wise means. - variances : float array with shape (n_features,) - Feature-wise variances + variances : ndarray of float of shape (n_features,) + Feature-wise variances. """ _raise_error_wrong_axis(axis) @@ -101,7 +101,7 @@ def mean_variance_axis(X, axis): @_deprecate_positional_args def incr_mean_variance_axis(X, *, axis, last_mean, last_var, last_n): - """Compute incremental mean and variance along an axix on a CSR or + """Compute incremental mean and variance along an axis on a CSR or CSC matrix. last_mean, last_var are the statistics computed at the last step by this @@ -111,28 +111,28 @@ def incr_mean_variance_axis(X, *, axis, last_mean, last_var, last_n): Parameters ---------- - X : CSR or CSC sparse matrix, shape (n_samples, n_features) + X : CSR or CSC sparse matrix of shape (n_samples, n_features) Input data. axis : int (either 0 or 1) Axis along which the axis should be computed. - last_mean : float array with shape (n_features,) + last_mean : ndarray of float of shape (n_features,) Array of feature-wise means to update with the new data X. - last_var : float array with shape (n_features,) + last_var : ndarray of float of shape (n_features,) Array of feature-wise var to update with the new data X. - last_n : int with shape (n_features,) + last_n : ndarray of int of shape (n_features,) Number of samples seen so far, excluded X. Returns ------- - means : float array with shape (n_features,) + means : float array of shape (n_features,) Updated feature-wise means. - variances : float array with shape (n_features,) + variances : float array of shape (n_features,) Updated feature-wise variances. n : int with shape (n_features,) @@ -171,10 +171,10 @@ def inplace_column_scale(X, scale): Parameters ---------- - X : CSC or CSR matrix with shape (n_samples, n_features) + X : CSC or CSR sparse matrix of shape (n_samples, n_features) Matrix to normalize using the variance of the features. - scale : float array with shape (n_features,) + scale : ndarray of float of shape (n_features,) Array of precomputed feature-wise values to use for scaling. """ if isinstance(X, sp.csc_matrix): @@ -193,10 +193,10 @@ def inplace_row_scale(X, scale): Parameters ---------- - X : CSR or CSC sparse matrix, shape (n_samples, n_features) + X : CSR or CSC sparse matrix of shape (n_samples, n_features) Matrix to be scaled. - scale : float array with shape (n_features,) + scale : ndarray of float of shape (n_features,) Array of precomputed sample-wise values to use for scaling. """ if isinstance(X, sp.csc_matrix): @@ -213,7 +213,7 @@ def inplace_swap_row_csc(X, m, n): Parameters ---------- - X : scipy.sparse.csc_matrix, shape=(n_samples, n_features) + X : CSC sparse matrix of shape (n_samples, n_features) Matrix whose two rows are to be swapped. m : int @@ -242,7 +242,7 @@ def inplace_swap_row_csr(X, m, n): Parameters ---------- - X : scipy.sparse.csr_matrix, shape=(n_samples, n_features) + X : CSR sparse matrix of shape (n_samples, n_features) Matrix whose two rows are to be swapped. m : int @@ -297,7 +297,7 @@ def inplace_swap_row(X, m, n): Parameters ---------- - X : CSR or CSC sparse matrix, shape=(n_samples, n_features) + X : CSR or CSC sparse matrix of shape (n_samples, n_features) Matrix whose two rows are to be swapped. m : int @@ -320,7 +320,7 @@ def inplace_swap_column(X, m, n): Parameters ---------- - X : CSR or CSC sparse matrix, shape=(n_samples, n_features) + X : CSR or CSC sparse matrix of shape (n_samples, n_features) Matrix whose two columns are to be swapped. m : int @@ -410,13 +410,13 @@ def min_max_axis(X, axis, ignore_nan=False): Parameters ---------- - X : CSR or CSC sparse matrix, shape (n_samples, n_features) + X : CSR or CSC sparse matrix of shape (n_samples, n_features) Input data. axis : int (either 0 or 1) Axis along which the axis should be computed. - ignore_nan : bool, default is False + ignore_nan : bool, default=False Ignore or passing through NaN values. .. versionadded:: 0.20 @@ -424,11 +424,11 @@ def min_max_axis(X, axis, ignore_nan=False): Returns ------- - mins : float array with shape (n_features,) - Feature-wise minima + mins : ndarray of float of shape (n_features,) + Feature-wise minima. - maxs : float array with shape (n_features,) - Feature-wise maxima + maxs : ndarray of float of shape (n_features,) + Feature-wise maxima. """ if isinstance(X, sp.csr_matrix) or isinstance(X, sp.csc_matrix): if ignore_nan: @@ -449,7 +449,7 @@ def count_nonzero(X, axis=None, sample_weight=None): X : CSR sparse matrix of shape (n_samples, n_labels) Input data. - axis : None, 0 or 1 + axis : 0 or 1, default=None The axis on which the data is aggregated. sample_weight : array-like of shape (n_samples,), default=None @@ -491,7 +491,7 @@ def count_nonzero(X, axis=None, sample_weight=None): def _get_median(data, n_zeros): """Compute the median of data with n_zeros additional zeros. - This function is used to support sparse matrices; it modifies data in-place + This function is used to support sparse matrices; it modifies data in-place. """ n_elems = len(data) + n_zeros if not n_elems: @@ -522,12 +522,12 @@ def csc_median_axis_0(X): Parameters ---------- - X : CSC sparse matrix, shape (n_samples, n_features) + X : CSC sparse matrix of shape (n_samples, n_features) Input data. Returns ------- - median : ndarray, shape (n_features,) + median : ndarray of shape (n_features,) Median. """ From 7d5437dc49b8b4e46dc993627b877cbd2032a11c Mon Sep 17 00:00:00 2001 From: Frans Larsson Date: Wed, 29 Jul 2020 11:05:31 +0200 Subject: [PATCH 2/9] update options for axis --- sklearn/utils/sparsefuncs.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sklearn/utils/sparsefuncs.py b/sklearn/utils/sparsefuncs.py index c50ae42362def..e777572366885 100644 --- a/sklearn/utils/sparsefuncs.py +++ b/sklearn/utils/sparsefuncs.py @@ -70,7 +70,7 @@ def mean_variance_axis(X, axis): X : CSR or CSC sparse matrix of shape (n_samples, n_features) Input data. - axis : int (either 0 or 1) + axis : {0, 1} Axis along which the axis should be computed. Returns @@ -114,7 +114,7 @@ def incr_mean_variance_axis(X, *, axis, last_mean, last_var, last_n): X : CSR or CSC sparse matrix of shape (n_samples, n_features) Input data. - axis : int (either 0 or 1) + axis : {0, 1} Axis along which the axis should be computed. last_mean : ndarray of float of shape (n_features,) @@ -413,7 +413,7 @@ def min_max_axis(X, axis, ignore_nan=False): X : CSR or CSC sparse matrix of shape (n_samples, n_features) Input data. - axis : int (either 0 or 1) + axis : {0, 1} Axis along which the axis should be computed. ignore_nan : bool, default=False @@ -449,7 +449,7 @@ def count_nonzero(X, axis=None, sample_weight=None): X : CSR sparse matrix of shape (n_samples, n_labels) Input data. - axis : 0 or 1, default=None + axis : {0, 1}, default=None The axis on which the data is aggregated. sample_weight : array-like of shape (n_samples,), default=None From 6a605be0068759ee7bdaab1bcf5bb4b2fcf3bf9d Mon Sep 17 00:00:00 2001 From: Frans Larsson Date: Wed, 29 Jul 2020 11:19:29 +0200 Subject: [PATCH 3/9] update type in docstring --- sklearn/utils/sparsefuncs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sklearn/utils/sparsefuncs.py b/sklearn/utils/sparsefuncs.py index e777572366885..4908a6fb84720 100644 --- a/sklearn/utils/sparsefuncs.py +++ b/sklearn/utils/sparsefuncs.py @@ -135,7 +135,7 @@ def incr_mean_variance_axis(X, *, axis, last_mean, last_var, last_n): variances : float array of shape (n_features,) Updated feature-wise variances. - n : int with shape (n_features,) + n : ndarray of int of shape (n_features,) Updated number of seen samples. Notes From 44fedf81d10d0de56e32b110cbc3130870f5076e Mon Sep 17 00:00:00 2001 From: Frans Larsson Date: Thu, 30 Jul 2020 18:08:07 +0200 Subject: [PATCH 4/9] fix too long line --- sklearn/utils/sparsefuncs.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sklearn/utils/sparsefuncs.py b/sklearn/utils/sparsefuncs.py index 4908a6fb84720..afd6f8e92afcc 100644 --- a/sklearn/utils/sparsefuncs.py +++ b/sklearn/utils/sparsefuncs.py @@ -491,7 +491,8 @@ def count_nonzero(X, axis=None, sample_weight=None): def _get_median(data, n_zeros): """Compute the median of data with n_zeros additional zeros. - This function is used to support sparse matrices; it modifies data in-place. + This function is used to support sparse matrices; it modifies data + in-place. """ n_elems = len(data) + n_zeros if not n_elems: From 153a7a9e94de95dee1e252ea6e9db2a62b6bd2ba Mon Sep 17 00:00:00 2001 From: Frans Larsson Date: Fri, 31 Jul 2020 17:57:34 +0200 Subject: [PATCH 5/9] Apply suggestions from code review - added dtype for arrays Co-authored-by: Guillaume Lemaitre --- sklearn/utils/sparsefuncs.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/sklearn/utils/sparsefuncs.py b/sklearn/utils/sparsefuncs.py index afd6f8e92afcc..d8562bccea12d 100644 --- a/sklearn/utils/sparsefuncs.py +++ b/sklearn/utils/sparsefuncs.py @@ -37,7 +37,7 @@ def inplace_csr_column_scale(X, scale): X : CSR sparse matrix of shape (n_samples, n_features) Matrix to normalize using the variance of the features. - scale : ndarray of float of shape (n_features,) + scale : ndarray of shape (n_features,), dtype=float Array of precomputed feature-wise values to use for scaling. """ assert scale.shape[0] == X.shape[1] @@ -76,10 +76,10 @@ def mean_variance_axis(X, axis): Returns ------- - means : ndarray of float of shape (n_features,) + means : ndarray of shape (n_features,), dtype=float Feature-wise means. - variances : ndarray of float of shape (n_features,) + variances : ndarray of shape (n_features,), dtype=float Feature-wise variances. """ @@ -117,25 +117,25 @@ def incr_mean_variance_axis(X, *, axis, last_mean, last_var, last_n): axis : {0, 1} Axis along which the axis should be computed. - last_mean : ndarray of float of shape (n_features,) + last_mean : ndarray of shape (n_features,), dtype=float Array of feature-wise means to update with the new data X. - last_var : ndarray of float of shape (n_features,) + last_var : ndarray of shape (n_features,), dtype=float Array of feature-wise var to update with the new data X. - last_n : ndarray of int of shape (n_features,) + last_n : ndarray of shape (n_features,), dtype=int Number of samples seen so far, excluded X. Returns ------- - means : float array of shape (n_features,) + means : ndarray of shape (n_features,), dtype=float Updated feature-wise means. - variances : float array of shape (n_features,) + variances : ndarray of shape (n_features,), dtype=float Updated feature-wise variances. - n : ndarray of int of shape (n_features,) + n : ndarray of shape (n_features,), dtype=int Updated number of seen samples. Notes @@ -174,7 +174,7 @@ def inplace_column_scale(X, scale): X : CSC or CSR sparse matrix of shape (n_samples, n_features) Matrix to normalize using the variance of the features. - scale : ndarray of float of shape (n_features,) + scale : ndarray of shape (n_features,), dtype=float Array of precomputed feature-wise values to use for scaling. """ if isinstance(X, sp.csc_matrix): @@ -196,7 +196,7 @@ def inplace_row_scale(X, scale): X : CSR or CSC sparse matrix of shape (n_samples, n_features) Matrix to be scaled. - scale : ndarray of float of shape (n_features,) + scale : ndarray of shape (n_features,), dtype=float Array of precomputed sample-wise values to use for scaling. """ if isinstance(X, sp.csc_matrix): @@ -424,10 +424,10 @@ def min_max_axis(X, axis, ignore_nan=False): Returns ------- - mins : ndarray of float of shape (n_features,) + mins : ndarray of shape (n_features,), dtype=float Feature-wise minima. - maxs : ndarray of float of shape (n_features,) + maxs : ndarray of shape (n_features,), dtype=float Feature-wise maxima. """ if isinstance(X, sp.csr_matrix) or isinstance(X, sp.csc_matrix): From 4469a3b51c839a90e2f9f9a44e89cab0cc616453 Mon Sep 17 00:00:00 2001 From: Frans Larsson Date: Fri, 31 Jul 2020 18:04:40 +0200 Subject: [PATCH 6/9] Apply suggestions from code review - specify format of sparse matrix Co-authored-by: Guillaume Lemaitre --- sklearn/utils/sparsefuncs.py | 45 ++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/sklearn/utils/sparsefuncs.py b/sklearn/utils/sparsefuncs.py index d8562bccea12d..2f942a88698e5 100644 --- a/sklearn/utils/sparsefuncs.py +++ b/sklearn/utils/sparsefuncs.py @@ -52,8 +52,8 @@ def inplace_csr_row_scale(X, scale): Parameters ---------- - X : CSR sparse matrix of shape (n_samples, n_features) - Matrix to be scaled. + X : sparse matrix of shape (n_samples, n_features) + Matrix to be scaled. It should of the format CSR. scale : ndarray of float of shape (n_samples,) Array of precomputed sample-wise values to use for scaling. @@ -67,8 +67,8 @@ def mean_variance_axis(X, axis): Parameters ---------- - X : CSR or CSC sparse matrix of shape (n_samples, n_features) - Input data. + X : sparse matrix of shape (n_samples, n_features) + Input data. It can of format CSR or CSC axis : {0, 1} Axis along which the axis should be computed. @@ -171,8 +171,9 @@ def inplace_column_scale(X, scale): Parameters ---------- - X : CSC or CSR sparse matrix of shape (n_samples, n_features) - Matrix to normalize using the variance of the features. + X : sparse matrix of shape (n_samples, n_features) + Matrix to normalize using the variance of the features. It should be + of CSC or CSR format. scale : ndarray of shape (n_features,), dtype=float Array of precomputed feature-wise values to use for scaling. @@ -193,8 +194,8 @@ def inplace_row_scale(X, scale): Parameters ---------- - X : CSR or CSC sparse matrix of shape (n_samples, n_features) - Matrix to be scaled. + X : sparse matrix of shape (n_samples, n_features) + Matrix to be scaled. It should be of CSR or CSC format scale : ndarray of shape (n_features,), dtype=float Array of precomputed sample-wise values to use for scaling. @@ -213,8 +214,9 @@ def inplace_swap_row_csc(X, m, n): Parameters ---------- - X : CSC sparse matrix of shape (n_samples, n_features) - Matrix whose two rows are to be swapped. + X : sparse matrix of shape (n_samples, n_features) + Matrix whose two rows are to be swapped. It should be of + CSC format. m : int Index of the row of X to be swapped. @@ -242,8 +244,9 @@ def inplace_swap_row_csr(X, m, n): Parameters ---------- - X : CSR sparse matrix of shape (n_samples, n_features) - Matrix whose two rows are to be swapped. + X : sparse matrix of shape (n_samples, n_features) + Matrix whose two rows are to be swapped. It should be of + CSR format. m : int Index of the row of X to be swapped. @@ -297,8 +300,9 @@ def inplace_swap_row(X, m, n): Parameters ---------- - X : CSR or CSC sparse matrix of shape (n_samples, n_features) - Matrix whose two rows are to be swapped. + X : sparse matrix of shape (n_samples, n_features) + Matrix whose two rows are to be swapped. It should be of CSR or + CSC format. m : int Index of the row of X to be swapped. @@ -320,8 +324,9 @@ def inplace_swap_column(X, m, n): Parameters ---------- - X : CSR or CSC sparse matrix of shape (n_samples, n_features) - Matrix whose two columns are to be swapped. + X : sparse matrix of shape (n_samples, n_features) + Matrix whose two columns are to be swapped. It should be of + CSR or CSC format. m : int Index of the column of X to be swapped. @@ -410,8 +415,8 @@ def min_max_axis(X, axis, ignore_nan=False): Parameters ---------- - X : CSR or CSC sparse matrix of shape (n_samples, n_features) - Input data. + X : sparse matrix of shape (n_samples, n_features) + Input data. It should be of CSR or CSC format. axis : {0, 1} Axis along which the axis should be computed. @@ -523,8 +528,8 @@ def csc_median_axis_0(X): Parameters ---------- - X : CSC sparse matrix of shape (n_samples, n_features) - Input data. + X : sparse matrix of shape (n_samples, n_features) + Input data. It should be of CSC format. Returns ------- From df0e8a94b28935891fac894724e179cfa77c0c13 Mon Sep 17 00:00:00 2001 From: Frans Larsson Date: Fri, 31 Jul 2020 18:25:31 +0200 Subject: [PATCH 7/9] make doc of CSR and CSC consistent --- sklearn/utils/sparsefuncs.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sklearn/utils/sparsefuncs.py b/sklearn/utils/sparsefuncs.py index 2f942a88698e5..44a4d200e97d1 100644 --- a/sklearn/utils/sparsefuncs.py +++ b/sklearn/utils/sparsefuncs.py @@ -34,8 +34,9 @@ def inplace_csr_column_scale(X, scale): Parameters ---------- - X : CSR sparse matrix of shape (n_samples, n_features) + X : sparse matrix of shape (n_samples, n_features) Matrix to normalize using the variance of the features. + It should be of CSR format. scale : ndarray of shape (n_features,), dtype=float Array of precomputed feature-wise values to use for scaling. @@ -53,7 +54,7 @@ def inplace_csr_row_scale(X, scale): Parameters ---------- X : sparse matrix of shape (n_samples, n_features) - Matrix to be scaled. It should of the format CSR. + Matrix to be scaled. It should be of CSR format. scale : ndarray of float of shape (n_samples,) Array of precomputed sample-wise values to use for scaling. @@ -68,7 +69,7 @@ def mean_variance_axis(X, axis): Parameters ---------- X : sparse matrix of shape (n_samples, n_features) - Input data. It can of format CSR or CSC + Input data. It can be of CSR or CSC format. axis : {0, 1} Axis along which the axis should be computed. @@ -451,8 +452,8 @@ def count_nonzero(X, axis=None, sample_weight=None): Parameters ---------- - X : CSR sparse matrix of shape (n_samples, n_labels) - Input data. + X : sparse matrix of shape (n_samples, n_labels) + Input data. It should be of CSR format. axis : {0, 1}, default=None The axis on which the data is aggregated. From 4af49f1f12dca46272ed47e3bf340b9b6b290888 Mon Sep 17 00:00:00 2001 From: Frans Larsson Date: Fri, 21 Aug 2020 21:58:53 +0200 Subject: [PATCH 8/9] Add dtype --- sklearn/utils/sparsefuncs.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/sklearn/utils/sparsefuncs.py b/sklearn/utils/sparsefuncs.py index 44a4d200e97d1..455bf56775d89 100644 --- a/sklearn/utils/sparsefuncs.py +++ b/sklearn/utils/sparsefuncs.py @@ -38,7 +38,7 @@ def inplace_csr_column_scale(X, scale): Matrix to normalize using the variance of the features. It should be of CSR format. - scale : ndarray of shape (n_features,), dtype=float + scale : ndarray of shape (n_features,), dtype={np.float32, np.float64} Array of precomputed feature-wise values to use for scaling. """ assert scale.shape[0] == X.shape[1] @@ -77,10 +77,10 @@ def mean_variance_axis(X, axis): Returns ------- - means : ndarray of shape (n_features,), dtype=float + means : ndarray of shape (n_features,), dtype={np.float32, np.float64} Feature-wise means. - variances : ndarray of shape (n_features,), dtype=float + variances : ndarray of shape (n_features,), dtype={np.float32, np.float64} Feature-wise variances. """ @@ -118,25 +118,25 @@ def incr_mean_variance_axis(X, *, axis, last_mean, last_var, last_n): axis : {0, 1} Axis along which the axis should be computed. - last_mean : ndarray of shape (n_features,), dtype=float + last_mean : ndarray of shape (n_features,), dtype={np.float32, np.float64} Array of feature-wise means to update with the new data X. - last_var : ndarray of shape (n_features,), dtype=float + last_var : ndarray of shape (n_features,), dtype={np.float32, np.float64} Array of feature-wise var to update with the new data X. - last_n : ndarray of shape (n_features,), dtype=int + last_n : ndarray of shape (n_features,), dtype={np.int32, np.int64} Number of samples seen so far, excluded X. Returns ------- - means : ndarray of shape (n_features,), dtype=float + means : ndarray of shape (n_features,), dtype={np.float32, np.float64} Updated feature-wise means. - variances : ndarray of shape (n_features,), dtype=float + variances : ndarray of shape (n_features,), dtype={np.float32, np.float64} Updated feature-wise variances. - n : ndarray of shape (n_features,), dtype=int + n : ndarray of shape (n_features,), dtype={np.int32, np.int64} Updated number of seen samples. Notes @@ -176,7 +176,7 @@ def inplace_column_scale(X, scale): Matrix to normalize using the variance of the features. It should be of CSC or CSR format. - scale : ndarray of shape (n_features,), dtype=float + scale : ndarray of shape (n_features,), dtype={np.float32, np.float64} Array of precomputed feature-wise values to use for scaling. """ if isinstance(X, sp.csc_matrix): @@ -196,9 +196,9 @@ def inplace_row_scale(X, scale): Parameters ---------- X : sparse matrix of shape (n_samples, n_features) - Matrix to be scaled. It should be of CSR or CSC format + Matrix to be scaled. It should be of CSR or CSC format. - scale : ndarray of shape (n_features,), dtype=float + scale : ndarray of shape (n_features,), dtype={np.float32, np.float64} Array of precomputed sample-wise values to use for scaling. """ if isinstance(X, sp.csc_matrix): @@ -430,10 +430,10 @@ def min_max_axis(X, axis, ignore_nan=False): Returns ------- - mins : ndarray of shape (n_features,), dtype=float + mins : ndarray of shape (n_features,), dtype={np.float32, np.float64} Feature-wise minima. - maxs : ndarray of shape (n_features,), dtype=float + maxs : ndarray of shape (n_features,), dtype={np.float32, np.float64} Feature-wise maxima. """ if isinstance(X, sp.csr_matrix) or isinstance(X, sp.csc_matrix): From 7eca347a462f13ccab5c5a85b946ab5b434a6a55 Mon Sep 17 00:00:00 2001 From: Frans Larsson Date: Mon, 7 Dec 2020 21:27:21 +0100 Subject: [PATCH 9/9] STL: Remove extra blank lines --- sklearn/utils/sparsefuncs.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/sklearn/utils/sparsefuncs.py b/sklearn/utils/sparsefuncs.py index 6a40579f2a86d..fcd7a3f3fe54e 100644 --- a/sklearn/utils/sparsefuncs.py +++ b/sklearn/utils/sparsefuncs.py @@ -139,7 +139,6 @@ def incr_mean_variance_axis(X, *, axis, last_mean, last_var, last_n, axis : {0, 1} Axis along which the axis should be computed. - last_mean : ndarray of shape (n_features,) or (n_samples,), dtype=floating Array of means to update with the new data X. Should be of shape (n_features,) if axis=0 or (n_samples,) if axis=1. @@ -168,7 +167,6 @@ def incr_mean_variance_axis(X, *, axis, last_mean, last_var, last_n, Updated feature-wise means if axis = 0 or sample-wise means if axis = 1. - variances : ndarray of shape (n_features,) or (n_samples,), dtype=floating Updated feature-wise variances if axis = 0 or sample-wise variances if axis = 1.