neuroglia.trace.Binarizer

class neuroglia.trace.Binarizer(threshold=0.0, copy=True)[source]

Binarize data (set feature values to 0 or 1) according to a threshold

This transformer is a DataFram-friendly alternative to sklearn.preprocessing.Binarizer

Values greater than the threshold map to 1, while values less than or equal to the threshold map to 0. With the default threshold of 0, only positive values map to 1.

Parameters:
  • threshold (float, optional (0.0 by default)) – Feature values below or equal to this are replaced by 0, above it by 1. Threshold may not be less than 0 for operations on sparse matrices.
  • copy (boolean, optional, default True) – set to False to perform inplace binarization and avoid a copy (if the input is already a numpy array or a scipy.sparse CSR matrix).

Notes

This estimator is stateless (besides constructor parameters), the fit method does nothing but is useful when used in a pipeline.

__init__(threshold=0.0, copy=True)[source]

x.__init__(…) initializes x; see help(type(x)) for signature

Methods

__init__([threshold, copy]) x.__init__(…) initializes x; see help(type(x)) for signature
fit(X[, y]) Do nothing and return the estimator unchanged
fit_transform(X[, y]) Fit to data, then transform it.
get_params([deep]) Get parameters for this estimator.
set_params(**params) Set the parameters of this estimator.
transform(X) Binarize each element of X