jsonvectorizer.vectorizers.BoolVectorizer

class jsonvectorizer.vectorizers.BoolVectorizer

Vectorizer for booleans

Simply creates one feature, i.e., the binarized version of the provided array.

Attributes:
feature_names_ : list of str

Array mapping from feature integer indices to feature names.

Methods

fit(self, values, \*\*kwargs) Fit vectorizer to the provided data
fit_transform(self, values, \*\*fit_params) Fit vectorizer to the provided data, then transform it
get_params(self[, deep]) Get parameters for this estimator.
set_params(self, \*\*params) Set the parameters of this estimator.
transform(self, values) Transform booleans to feature matrix
fit(self, values, **kwargs)

Fit vectorizer to the provided data

Parameters:
values : array-like, [n_samples]

Booleans for fitting the vectorizer.

**kwargs

Ignored keyword arguments.

Returns:
self or None

Returns None if values only includes one unique boolean item, otherwise returns self.

Raises:
ValueError

If values is not a one-dimensional array.

fit_transform(self, values, **fit_params)

Fit vectorizer to the provided data, then transform it

Parameters:
values : array-like, [n_samples]
**fit_params

Keyword arguments, passed to the fit() method.

Returns:
X : ndarray, [n_samples, n_features]
get_params(self, deep=True)

Get parameters for this estimator.

Parameters:
deep : bool, default=True

If True, will return the parameters for this estimator and contained subobjects that are estimators.

Returns:
params : mapping of string to any

Parameter names mapped to their values.

set_params(self, **params)

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Parameters:
**params : dict

Estimator parameters.

Returns:
self : object

Estimator instance.

transform(self, values)

Transform booleans to feature matrix

Parameters:
values : array-like, [n_samples]

Booleans for transforming.

Returns:
X : ndarray, [n_samples, 1]

Feature matrix.

Raises:
NotFittedError

If the vectorizer has not yet been fitted.

ValueError

If values is not a one-dimensional array.