paddlets.transform.time_feature

class TimeFeatureGenerator(feature_cols: Optional[List[str]] = ['year', 'month', 'day', 'weekday', 'hour', 'quarter', 'dayofyear', 'weekofyear', 'is_holiday', 'is_workday'], extend_points: int = 0)[source]

Bases: BaseTransform

Transform time index into specific time features

Parameters
  • feature_cols (str) – Name of feature columns to transform. Currently supported arg values are: year, month, day, weekday, hour, quarter, dayofyear, weekofyear, is_holiday, and is_workday. These time features will be generated by default

  • extend_points (int) – Extra time points need to be appended to the tail of the existing target time series. Only used when two scenarios are matched simultaneously: 1.the known covariates is None 2.the predict() method is called. The reason is that the predict() method usually requires the tail index of the future target; this index can be calculated from the known cov time series. If known cov is None, this future target tail index needs to be manually extended in this transform and appended to the target.

Returns

None

fit_one(dataset: TSDataset)[source]

This transformer does not need to be fitted.

Parameters

dataset (TSDataset) – Dataset to be fitted.

Returns

TimeFeatureGenerator

transform_one(dataset: TSDataset, inplace: bool = False) TSDataset[source]

Transform time column to time features.

Parameters
  • dataset (TSDataset) – Dataset to be transformed.

  • inplace (bool) – Whether to perform the transformation inplace. default=False

Returns

TSDataset