# gluonts.transform.feature module¶

class gluonts.transform.feature.AddAgeFeature(target_field: str, output_field: str, pred_length: int, log_scale: bool = True, dtype: gluonts.core.component.DType = <class 'numpy.float32'>)[source]

Bases: gluonts.transform._base.MapTransformation

Adds an ‘age’ feature to the data_entry.

The age feature starts with a small value at the start of the time series and grows over time.

If is_train=True the age feature has the same length as the target field. If is_train=False the age feature has length len(target) + pred_length

Parameters
• target_field – Field with target values (array) of time series

• output_field – Field name to use for the output.

• pred_length – Prediction length

• log_scale – If set to true the age feature grows logarithmically otherwise linearly over time.

map_transform(data: Dict[str, Any], is_train: bool) → Dict[str, Any][source]
class gluonts.transform.feature.AddConstFeature(output_field: str, target_field: str, pred_length: int, const: float = 1.0, dtype: gluonts.core.component.DType = <class 'numpy.float32'>)[source]

Bases: gluonts.transform._base.MapTransformation

Expands a const value along the time axis as a dynamic feature, where the T-dimension is defined as the sum of the pred_length parameter and the length of a time series specified by the target_field.

If is_train=True the feature matrix has the same length as the target field. If is_train=False the feature matrix has length len(target) + pred_length

Parameters
• output_field – Field name for output.

• target_field – Field containing the target array. The length of this array will be used.

• pred_length – Prediction length (this is necessary since features have to be available in the future)

• const – Constant value to use.

• dtype – Numpy dtype to use for resulting array.

map_transform(data: Dict[str, Any], is_train: bool) → Dict[str, Any][source]
class gluonts.transform.feature.AddObservedValuesIndicator(target_field: str, output_field: str, dummy_value: float = 0.0, convert_nans: bool = True, dtype: gluonts.core.component.DType = <class 'numpy.float32'>)[source]

Bases: gluonts.transform._base.SimpleTransformation

Replaces missing values in a numpy array (NaNs) with a dummy value and adds an “observed”-indicator that is 1 when values are observed and 0 when values are missing.

Parameters
• target_field – Field for which missing values will be replaced

• output_field – Field name to use for the indicator

• dummy_value – Value to use for replacing missing values.

• convert_nans – If set to true (default) missing values will be replaced. Otherwise they will not be replaced. In any case the indicator is included in the result.

transform(data: Dict[str, Any]) → Dict[str, Any][source]
class gluonts.transform.feature.AddTimeFeatures(start_field: str, target_field: str, output_field: str, time_features: List[gluonts.time_feature._base.TimeFeature], pred_length: int)[source]

Bases: gluonts.transform._base.MapTransformation

Adds a set of time features.

If is_train=True the feature matrix has the same length as the target field. If is_train=False the feature matrix has length len(target) + pred_length

Parameters
• start_field – Field with the start time stamp of the time series

• target_field – Field with the array containing the time series values

• output_field – Field name for result.

• time_features – list of time features to use.

• pred_length – Prediction length

map_transform(data: Dict[str, Any], is_train: bool) → Dict[str, Any][source]
gluonts.transform.feature.target_transformation_length(target: numpy.array, pred_length: int, is_train: bool) → int[source]