tensortrade.features.feature_pipeline module

class tensortrade.features.feature_pipeline.FeaturePipeline(steps, **kwargs)[source]

Bases: object

An pipeline for transforming observation data frames into features for learning.

__init__(steps, **kwargs)[source]
Parameters

dtype – The dtype elements in the pipeline should be cast to.

property dtype

The dtype that elements in the pipeline should be input and output as.

Return type

Union[type, str]

reset()[source]

Reset all transformers within the feature pipeline.

property steps

A list of feature transformations to apply to observations.

Return type

List[FeatureTransformer]

transform(observation)[source]

Apply the pipeline of feature transformations to an observation frame.

Parameters

observation (DataFrame) – A pandas.DataFrame corresponding to an observation within a TradingEnvironment.

Return type

DataFrame

Returns

A pandas.DataFrame of features corresponding to an input oversvation.

Raises

ValueError – In the case that an invalid observation frame has been input.

transform_space(input_space)[source]

Get the transformed output space for a given input space.

Parameters

input_space (Space) – A gym.Space matching the shape of the pipeline’s input.

Return type

Space

Returns

A gym.Space matching the shape of the pipeline’s output.