package sklearn

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
val get_py : string -> Py.Object.t

Get an attribute of this module as a Py.Object.t. This is useful to pass a Python function to another function.

val count_nonzero : ?axis:[ `Zero | `One ] -> ?sample_weight:[> `ArrayLike ] Np.Obj.t -> x:[> `Csr_matrix ] Np.Obj.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 : [> `Csc_matrix ] Np.Obj.t -> [> `ArrayLike ] Np.Obj.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: [ `Csc_matrix of [> `Csc_matrix ] Np.Obj.t | `Csr_matrix of [> `Csr_matrix ] Np.Obj.t ] -> axis:int -> last_mean:Py.Object.t -> last_var:Py.Object.t -> last_n:int -> unit -> Py.Object.t * Py.Object.t * int

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: [ `Csc_matrix of [> `Csc_matrix ] Np.Obj.t | `Csr_matrix of [> `Csr_matrix ] Np.Obj.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:[> `Csr_matrix ] Np.Obj.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:[> `Csr_matrix ] Np.Obj.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: [ `Csc_matrix of [> `Csc_matrix ] Np.Obj.t | `Csr_matrix of [> `Csr_matrix ] Np.Obj.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: [ `Csc_matrix of [> `Csc_matrix ] Np.Obj.t | `Csr_matrix of [> `Csr_matrix ] Np.Obj.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: [ `Csc_matrix of [> `Csc_matrix ] Np.Obj.t | `Csr_matrix of [> `Csr_matrix ] Np.Obj.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: [ `Csc_matrix of [> `Csc_matrix ] Np.Obj.t | `Csr_matrix of [> `Csr_matrix ] Np.Obj.t ] -> axis:int -> 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: [ `Csc_matrix of [> `Csc_matrix ] Np.Obj.t | `Csr_matrix of [> `Csr_matrix ] Np.Obj.t ] -> axis:int -> 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.