Skip to content

feature

Represent a feature object.

Classes:

Name Description
BaseFeature

Base Feature used if no convenient available feature.

NumericalFeature

Numerical feature.

CategoricalFeature

Categorical feature.

MultivariateNumericalFeature

MultivariateNumericalFeature feature.

UnivariateSynchronousTimeSerie

UnivariateSynchronousTimeSerie feature.

UnivariateAsynchronousTimeSerie

UnivariateAsynchronousTimeSerie feature.

MultivariateSynchronousTimeSerie

MultivariateSynchronousTimeSerie feature.

MultivariateAsynchronousTimeSerie

MultivariateAsynchronousTimeSerie feature.

Metadata

Metadata.

Attributes:

Name Type Description
ExposedFeature
Feature

__all__ = ['BaseFeature', 'CategoricalFeature', 'ExposedFeature', 'Feature', 'Metadata', 'MultivariateAsynchronousTimeSerie', 'MultivariateNumericalFeature', 'MultivariateSynchronousTimeSerie', 'NumericalFeature', 'UnivariateAsynchronousTimeSerie', 'UnivariateSynchronousTimeSerie'] #

ExposedFeature = ExposedCategoricalFeature | ExposedCategoricalFeatureList | ExposedNumericalFeature | ExposedMultivariateNumericalFeature | ExposedUnivariateSynchronousTimeSerie | ExposedUnivariateAsynchronousTimeSerie | ExposedMultivariateSynchronousTimeSerie | ExposedMultivariateAsynchronousTimeSerie | ExposedMetadata #

EXPOSED_FEATURE_TYPE = TypeVar('EXPOSED_FEATURE_TYPE', bound=ExposedFeature) #

Feature = NumericalFeature | CategoricalFeature | MultivariateNumericalFeature | UnivariateSynchronousTimeSerie | UnivariateAsynchronousTimeSerie | MultivariateSynchronousTimeSerie | MultivariateAsynchronousTimeSerie | Metadata #

AbstractDataElement #

Represent a schema column, with a name.

Parameters:

Name Type Description Default

name #

str
required

Attributes:

Name Type Description
name str

name: str #

TargetableFeature #

A feature that can be a target.

Parameters:

Name Type Description Default

is_target #

bool
False

Attributes:

Name Type Description
is_target bool

is_target: bool = False #

BaseFeature #

Base Feature used if no convenient available feature.

Methods:

Name Description
from_exposed

BaseFeature from ExposedBaseFeature.

Attributes:

Name Type Description
as_exposed ExposedBaseFeature

NumericalFeature as ExposedNumericalFeature.

as_exposed: ExposedBaseFeature #

NumericalFeature as ExposedNumericalFeature.

from_exposed(exposed_feature: ExposedBaseFeature) -> Self #

BaseFeature from ExposedBaseFeature.

Source code in src/xpdeep/dataset/schema/feature/feature.py
@classmethod
def from_exposed(cls, exposed_feature: ExposedBaseFeature) -> Self:
    """BaseFeature from ExposedBaseFeature."""
    return cls(**msgspec_asdict(exposed_feature))

ExplainableFeature #

Define a feature object.

Parameters:

Name Type Description Default

preprocessor #

SklearnPreprocessor | IdentityPreprocessor

feature preprocessor function used to preprocess the data.

required

Methods:

Name Description
from_exposed

Feature from exposed feature.

Attributes:

Name Type Description
preprocessor TorchPreprocessor | SklearnPreprocessor | IdentityPreprocessor
as_exposed EXPOSED_FEATURE_TYPE

Feature as exposed feature.

preprocessor: TorchPreprocessor | SklearnPreprocessor | IdentityPreprocessor = field(kw_only=True) #

as_exposed: EXPOSED_FEATURE_TYPE #

Feature as exposed feature.

from_exposed(exposed_feature: EXPOSED_FEATURE_TYPE) -> Self #

Feature from exposed feature.

Source code in src/xpdeep/dataset/schema/feature/feature.py
@classmethod
def from_exposed(cls, exposed_feature: EXPOSED_FEATURE_TYPE) -> Self:
    """Feature from exposed feature."""
    raise NotImplementedError

NumericalFeature #

Numerical feature.

It represents quantifiable values that can be measured and ordered. Its values may be continuous (e.g., real numbers) or discrete (e.g., integers). For instance, "age" or "price" could be set as numerical features.

Methods:

Name Description
from_exposed

NumericalFeature from ExposedNumericalFeature.

Attributes:

Name Type Description
as_exposed ExposedNumericalFeature

NumericalFeature as ExposedNumericalFeature.

as_exposed: ExposedNumericalFeature #

NumericalFeature as ExposedNumericalFeature.

from_exposed(exposed_feature: ExposedNumericalFeature) -> Self #

NumericalFeature from ExposedNumericalFeature.

Source code in src/xpdeep/dataset/schema/feature/feature.py
@classmethod
def from_exposed(cls, exposed_feature: ExposedNumericalFeature) -> Self:
    """NumericalFeature from ExposedNumericalFeature."""
    return cast(Self, cls._from_exposed(exposed_feature))

CategoricalFeature #

Categorical feature.

It represents data that can be divided into distinct groups or categories.

It may be nominal or ordinal. For instance, "Education level" or "gender" could be set as categorical features.

Parameters:

Name Type Description Default

categories #

list[Union[str, int, bool]]
required

Methods:

Name Description
from_exposed

CategoricalFeature from ExposedCategoricalFeature.

Attributes:

Name Type Description
categories list[str | int | bool]
as_exposed ExposedCategoricalFeature

CategoricalFeature as ExposedCategoricalFeature.

categories: list[str | int | bool] = field(kw_only=True) #

as_exposed: ExposedCategoricalFeature #

CategoricalFeature as ExposedCategoricalFeature.

from_exposed(exposed_feature: ExposedCategoricalFeature) -> Self #

CategoricalFeature from ExposedCategoricalFeature.

Source code in src/xpdeep/dataset/schema/feature/feature.py
@classmethod
def from_exposed(cls, exposed_feature: ExposedCategoricalFeature) -> Self:
    """CategoricalFeature from ExposedCategoricalFeature."""
    return cast(Self, cls._from_exposed(exposed_feature))

MultivariateNumericalFeature #

MultivariateNumericalFeature feature.

It represents numerical data points divided into several channels. Oppositely as time serie features, there is no time relationship between points here.

Parameters:

Name Type Description Default

size #

int

Number of channels

required

channel_names #

List[str] | None

List of channel names, optional.

None.

Methods:

Name Description
from_exposed

MultivariateNumericalFeature from ExposedMultivariateNumericalFeature.

Attributes:

Name Type Description
size int
channel_names list[str] | None
as_exposed ExposedMultivariateNumericalFeature

MultivariateNumericalFeature as ExposedMultivariateNumericalFeature.

size: int = field(kw_only=True) #

channel_names: list[str] | None = field(default=None, kw_only=True) #

as_exposed: ExposedMultivariateNumericalFeature #

MultivariateNumericalFeature as ExposedMultivariateNumericalFeature.

from_exposed(exposed_feature: ExposedMultivariateNumericalFeature) -> Self #

MultivariateNumericalFeature from ExposedMultivariateNumericalFeature.

Source code in src/xpdeep/dataset/schema/feature/feature.py
@classmethod
def from_exposed(cls, exposed_feature: ExposedMultivariateNumericalFeature) -> Self:
    """MultivariateNumericalFeature from ExposedMultivariateNumericalFeature."""
    return cast(Self, cls._from_exposed(exposed_feature))

UnivariateSynchronousTimeSerie #

UnivariateSynchronousTimeSerie feature.

It represents a time serie with a single channel, already synchronized (no dynamic time warping required).

Parameters:

Name Type Description Default

size #

int

The size of the time series. This typically refers to the number of time points or observations in the time series.

required

mirrored_channel #

str | None

Used in XpViz. Indeed, if the same channel is used for both input (as a lookback, under a first feature object) and target (as a horizon to predict, under a second feature object), this parameter may be specified to visualize on the same curve both features, (the lookback and its corresponding horizon).

None.

Methods:

Name Description
from_exposed

UnivariateSynchronousTimeSerie from ExposedUnivariateSynchronousTimeSerie.

Attributes:

Name Type Description
size int
mirrored_channel str | None
as_exposed ExposedUnivariateSynchronousTimeSerie

UnivariateSynchronousTimeSerie as ExposedUnivariateSynchronousTimeSerie.

size: int = field(kw_only=True) #

mirrored_channel: str | None = field(default=None, kw_only=True) #

as_exposed: ExposedUnivariateSynchronousTimeSerie #

UnivariateSynchronousTimeSerie as ExposedUnivariateSynchronousTimeSerie.

from_exposed(exposed_feature: ExposedUnivariateSynchronousTimeSerie) -> Self #

UnivariateSynchronousTimeSerie from ExposedUnivariateSynchronousTimeSerie.

Source code in src/xpdeep/dataset/schema/feature/feature.py
@classmethod
def from_exposed(cls, exposed_feature: ExposedUnivariateSynchronousTimeSerie) -> Self:
    """UnivariateSynchronousTimeSerie from ExposedUnivariateSynchronousTimeSerie."""
    return cast(Self, cls._from_exposed(exposed_feature))

UnivariateAsynchronousTimeSerie #

UnivariateAsynchronousTimeSerie feature.

This class represents a univariate time series that is not synchronized, meaning that it does require Dynamic Time Warping (DTW). The DTW will be applied automatically if this feature is chosen.

Parameters:

Name Type Description Default

size #

int

The size of the time series. This typically refers to the number of time points or observations in the time series.

required

mirrored_channel #

str | None

Used in XpViz. Indeed, if the same channel is used for both input (as a lookback, under a first feature object) and target (as a horizon to predict, under a second feature object), this parameter may be specified to visualize on the same curve both features, (the lookback and its corresponding horizon).

None.

Methods:

Name Description
from_exposed

UnivariateAsynchronousTimeSerie from ExposedUnivariateAsynchronousTimeSerie.

Attributes:

Name Type Description
size int
mirrored_channel str | None
as_exposed ExposedUnivariateAsynchronousTimeSerie

UnivariateAsynchronousTimeSerie as ExposedUnivariateAsynchronousTimeSerie.

size: int = field(kw_only=True) #

mirrored_channel: str | None = field(default=None, kw_only=True) #

as_exposed: ExposedUnivariateAsynchronousTimeSerie #

UnivariateAsynchronousTimeSerie as ExposedUnivariateAsynchronousTimeSerie.

from_exposed(exposed_feature: ExposedUnivariateAsynchronousTimeSerie) -> Self #

UnivariateAsynchronousTimeSerie from ExposedUnivariateAsynchronousTimeSerie.

Source code in src/xpdeep/dataset/schema/feature/feature.py
@classmethod
def from_exposed(cls, exposed_feature: ExposedUnivariateAsynchronousTimeSerie) -> Self:
    """UnivariateAsynchronousTimeSerie from ExposedUnivariateAsynchronousTimeSerie."""
    return cast(Self, cls._from_exposed(exposed_feature))

MultivariateSynchronousTimeSerie #

MultivariateSynchronousTimeSerie feature.

This class represents a multivariate time series (multiple channels), already synchronized (no dynamic time warping required).

Parameters:

Name Type Description Default

size #

tuple

Sequence_length x Number of channels

required

channel_names #

List[str] | None

List of channel names, optional.

None.

Methods:

Name Description
from_exposed

MultivariateSynchronousTimeSerie from ExposedMultivariateSynchronousTimeSerie.

Attributes:

Name Type Description
size list[int]
channel_names str | None
as_exposed ExposedMultivariateSynchronousTimeSerie

MultivariateSynchronousTimeSerie as ExposedMultivariateSynchronousTimeSerie.

size: list[int] = field(kw_only=True) #

channel_names: str | None = field(default=None, kw_only=True) #

as_exposed: ExposedMultivariateSynchronousTimeSerie #

MultivariateSynchronousTimeSerie as ExposedMultivariateSynchronousTimeSerie.

from_exposed(exposed_feature: ExposedMultivariateSynchronousTimeSerie) -> Self #

MultivariateSynchronousTimeSerie from ExposedMultivariateSynchronousTimeSerie.

Source code in src/xpdeep/dataset/schema/feature/feature.py
@classmethod
def from_exposed(cls, exposed_feature: ExposedMultivariateSynchronousTimeSerie) -> Self:
    """MultivariateSynchronousTimeSerie from ExposedMultivariateSynchronousTimeSerie."""
    return cast(Self, cls._from_exposed(exposed_feature))

MultivariateAsynchronousTimeSerie #

MultivariateAsynchronousTimeSerie feature.

This class represents a multivariate time series (multiple channels), that is not synchronized, meaning that it does require Dynamic Time Warping (DTW). The DTW will be applied automatically if this feature is chosen.

Parameters:

Name Type Description Default

size #

tuple

Sequence_length x Number of channels

required

channel_names #

List[str] | None

List of channel names, optional.

None.

Methods:

Name Description
from_exposed

MultivariateAsynchronousTimeSerie from ExposedMultivariateAsynchronousTimeSerie.

Attributes:

Name Type Description
size list[int]
channel_names list[str] | None
as_exposed ExposedMultivariateAsynchronousTimeSerie

MultivariateAsynchronousTimeSerie as ExposedMultivariateAsynchronousTimeSerie.

size: list[int] = field(kw_only=True) #

channel_names: list[str] | None = field(default=None, kw_only=True) #

as_exposed: ExposedMultivariateAsynchronousTimeSerie #

MultivariateAsynchronousTimeSerie as ExposedMultivariateAsynchronousTimeSerie.

from_exposed(exposed_feature: ExposedMultivariateAsynchronousTimeSerie) -> Self #

MultivariateAsynchronousTimeSerie from ExposedMultivariateAsynchronousTimeSerie.

Source code in src/xpdeep/dataset/schema/feature/feature.py
@classmethod
def from_exposed(cls, exposed_feature: ExposedMultivariateAsynchronousTimeSerie) -> Self:
    """MultivariateAsynchronousTimeSerie from ExposedMultivariateAsynchronousTimeSerie."""
    return cast(Self, cls._from_exposed(exposed_feature))

Metadata #

Metadata.

Represents a metadata, for instance the "index_xp_deep" metadata, cf doc dataset/concept.

Methods:

Name Description
from_exposed

Create Metadata from exposed metadata.

Attributes:

Name Type Description
as_exposed ExposedMetadata

Generate the corresponding exposed feature.

as_exposed: ExposedMetadata #

Generate the corresponding exposed feature.

from_exposed(exposed_metadata: ExposedMetadata) -> Self #

Create Metadata from exposed metadata.

Source code in src/xpdeep/dataset/schema/feature/feature.py
@classmethod
def from_exposed(cls, exposed_metadata: ExposedMetadata) -> Self:
    """Create Metadata from exposed metadata."""
    return cls(name=exposed_metadata.name)