tensortrade.features.scalers.min_max_normalizer module

class tensortrade.features.scalers.min_max_normalizer.MinMaxNormalizer(columns=None, feature_min=0, feature_max=1, inplace=True)[source]

Bases: tensortrade.features.feature_transformer.FeatureTransformer

A transformer for normalizing values within a feature pipeline by the column-wise extrema.

__init__(columns=None, feature_min=0, feature_max=1, inplace=True)[source]
Parameters
  • columns (optional) – A list of column names to normalize.

  • feature_min (optional) – The minimum float in the range to scale to. Defaults to 0.

  • feature_max (optional) – The maximum float in the range to scale to. Defaults to 1.

  • inplace (optional) – If False, a new column will be added to the output for each input column.

transform(X, input_space)[source]

Transform the data set and return a new data frame.

Parameters
  • X (DataFrame) – The set of data to transform.

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

Return type

DataFrame

Returns

A transformed data frame.

transform_space(input_space, column_names)[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.

  • column_names (List[str]) – A list of all column names in the input data frame.

Return type

Space

Returns

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