package sklearn

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
val count_nonzero : ?axis:[ `None | `PyObject of Py.Object.t ] -> ?sample_weight:Ndarray.t -> x:Py.Object.t -> unit -> Py.Object.t

A variant of X.getnnz() with extension to weighting on axis 0

Useful in efficiently calculating multilabel metrics.

Parameters ---------- X : CSR sparse matrix of shape (n_samples, n_labels) Input data.

axis : None, 0 or 1 The axis on which the data is aggregated.

sample_weight : array-like of shape (n_samples,), default=None Weight for each row of X.

val csc_median_axis_0 : x:Py.Object.t -> unit -> Ndarray.t

Find the median across axis 0 of a CSC matrix. It is equivalent to doing np.median(X, axis=0).

Parameters ---------- X : CSC sparse matrix, shape (n_samples, n_features) Input data.

Returns ------- median : ndarray, shape (n_features,) Median.

val incr_mean_variance_axis : x:Py.Object.t -> axis:Py.Object.t -> last_mean:Py.Object.t -> last_var:Py.Object.t -> last_n:Py.Object.t -> unit -> Py.Object.t * Py.Object.t * Py.Object.t

Compute incremental mean and variance along an axix on a CSR or CSC matrix.

last_mean, last_var are the statistics computed at the last step by this function. Both must be initialized to 0-arrays of the proper size, i.e. the number of features in X. last_n is the number of samples encountered until now.

Parameters ---------- X : CSR or CSC sparse matrix, 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,) Array of feature-wise means to update with the new data X.

last_var : float array with shape (n_features,) Array of feature-wise var to update with the new data X.

last_n : int with shape (n_features,) Number of samples seen so far, excluded X.

Returns -------

means : float array with shape (n_features,) Updated feature-wise means.

variances : float array with shape (n_features,) Updated feature-wise variances.

n : int with shape (n_features,) Updated number of seen samples.

Notes ----- NaNs are ignored in the algorithm.

val inplace_column_scale : x:Py.Object.t -> scale:Py.Object.t -> unit -> Py.Object.t

Inplace column scaling of a CSC/CSR matrix.

Scale each feature of the data matrix by multiplying with specific scale provided by the caller assuming a (n_samples, n_features) shape.

Parameters ---------- X : CSC or CSR matrix with shape (n_samples, n_features) Matrix to normalize using the variance of the features.

scale : float array with shape (n_features,) Array of precomputed feature-wise values to use for scaling.

val inplace_csr_column_scale : x:Py.Object.t -> scale:Py.Object.t -> unit -> Py.Object.t

Inplace column scaling of a CSR matrix.

Scale each feature of the data matrix by multiplying with specific scale provided by the caller assuming a (n_samples, n_features) shape.

Parameters ---------- X : CSR matrix with shape (n_samples, n_features) Matrix to normalize using the variance of the features.

scale : float array with shape (n_features,) Array of precomputed feature-wise values to use for scaling.

val inplace_csr_row_scale : x:Py.Object.t -> scale:Py.Object.t -> unit -> Py.Object.t

Inplace row scaling of a CSR matrix.

Scale each sample of the data matrix by multiplying with specific scale provided by the caller assuming a (n_samples, n_features) shape.

Parameters ---------- X : CSR sparse matrix, shape (n_samples, n_features) Matrix to be scaled.

scale : float array with shape (n_samples,) Array of precomputed sample-wise values to use for scaling.

val inplace_row_scale : x:Py.Object.t -> scale:Py.Object.t -> unit -> Py.Object.t

Inplace row scaling of a CSR or CSC matrix.

Scale each row of the data matrix by multiplying with specific scale provided by the caller assuming a (n_samples, n_features) shape.

Parameters ---------- X : CSR or CSC sparse matrix, shape (n_samples, n_features) Matrix to be scaled.

scale : float array with shape (n_features,) Array of precomputed sample-wise values to use for scaling.

val inplace_swap_column : x:Py.Object.t -> m:int -> n:int -> unit -> Py.Object.t

Swaps two columns of a CSC/CSR matrix in-place.

Parameters ---------- X : CSR or CSC sparse matrix, shape=(n_samples, n_features) Matrix whose two columns are to be swapped.

m : int Index of the column of X to be swapped.

n : int Index of the column of X to be swapped.

val inplace_swap_row : x:Py.Object.t -> m:int -> n:int -> unit -> Py.Object.t

Swaps two rows of a CSC/CSR matrix in-place.

Parameters ---------- X : CSR or CSC sparse matrix, shape=(n_samples, n_features) Matrix whose two rows are to be swapped.

m : int Index of the row of X to be swapped.

n : int Index of the row of X to be swapped.

val inplace_swap_row_csc : x:Py.Object.t -> m:int -> n:int -> unit -> Py.Object.t

Swaps two rows of a CSC matrix in-place.

Parameters ---------- X : scipy.sparse.csc_matrix, shape=(n_samples, n_features) Matrix whose two rows are to be swapped.

m : int Index of the row of X to be swapped.

n : int Index of the row of X to be swapped.

val inplace_swap_row_csr : x:Py.Object.t -> m:int -> n:int -> unit -> Py.Object.t

Swaps two rows of a CSR matrix in-place.

Parameters ---------- X : scipy.sparse.csr_matrix, shape=(n_samples, n_features) Matrix whose two rows are to be swapped.

m : int Index of the row of X to be swapped.

n : int Index of the row of X to be swapped.

val mean_variance_axis : x:Py.Object.t -> axis:Py.Object.t -> unit -> Py.Object.t * Py.Object.t

Compute mean and variance along an axix on a CSR or CSC matrix

Parameters ---------- X : CSR or CSC sparse matrix, shape (n_samples, n_features) Input data.

axis : int (either 0 or 1) Axis along which the axis should be computed.

Returns -------

means : float array with shape (n_features,) Feature-wise means

variances : float array with shape (n_features,) Feature-wise variances

val min_max_axis : ?ignore_nan:bool -> x:Py.Object.t -> axis:Py.Object.t -> unit -> Py.Object.t * Py.Object.t

Compute minimum and maximum along an axis on a CSR or CSC matrix and optionally ignore NaN values.

Parameters ---------- X : CSR or CSC sparse matrix, 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 or passing through NaN values.

.. versionadded:: 0.20

Returns -------

mins : float array with shape (n_features,) Feature-wise minima

maxs : float array with shape (n_features,) Feature-wise maxima

OCaml

Innovation. Community. Security.