FeatureReference#

class scikitplot.feature_selection.FeatureReference(name, kind, method, cuts=(), categories=(), proportions=(), truncated=False, n_reference=0, note='', family='')[source]#

Frozen reference buckets of one feature.

Parameters:
namestr

Column name.

kindstr

Feature kind at fit time.

method{“numeric”, “categorical”, “skipped”}

Bucketing method.

cutstuple of float

Interior cut points (numeric).

categoriestuple of str

Kept category keys (categorical).

proportionstuple of float

Training proportion of each bucket; the last bucket is “missing”, and for categorical features the one before it is “other”.

truncatedbool

More training categories existed than were kept.

n_referenceint

Training rows.

notestr

Why a feature is skipped.

familystr

Dtype family of the training column; later data of another family is reported as type_changed (integer and float are one numeric family, string and categorical one text family).

Parameters:
bucket_counts(series)[source]#

Count the values of series per reference bucket.

Parameters:
seriespandas.Series

Values to bucket.

Returns:
numpy.ndarray of int

One count per bucket (missing last).

Raises:
TypeError

If a numeric reference receives values that are not numeric.

Parameters:

series (Series)

Return type:

ndarray

categories: tuple[str, ...] = ()#
cuts: tuple[float, ...] = ()#
family: str = ''#
classmethod from_dict(data)[source]#

Rebuild from to_dict output, checking every field.

Parameters:
datamapping

Stored form.

Returns:
FeatureReference

The reference.

Parameters:

data (Mapping[str, Any])

Return type:

FeatureReference

kind: str[source]#
method: str[source]#
n_reference: int = 0#
name: str[source]#
note: str = ''#
proportions: tuple[float, ...] = ()#
to_dict()[source]#

Return the shared-data-model form.

Return type:

dict[str, Any]

truncated: bool = False#
unseen_ratio(series)[source]#

Return the share of non-missing values never seen in training.

Parameters:
seriespandas.Series

Current values.

Returns:
float or None

None for numeric or truncated references, or no current values.

Parameters:

series (Series)

Return type:

float | None