Time Related Feature Set
Usage
Features Generated
| Feature | Description |
|---|---|
| AVG_DAYS_BETWEEN_ORDERS | Provides the average amount of time between all orders in the specified date range, will return NONE if an average can not be calculated. |
| TIME_SINCE_FIRST_ORDER | Provides the number of days that have passed since the outlet placed it's first order in the dataset, measured to the calculation date (Tenure). |
| TIME_SINCE_LAST_ORDER | Provides the number of days that have passed since the last order the outlet placed in the dataset, measured to the calculation date (Recency). |
Feature Configuration
TimeFeaturesConfig Class
TimeFeaturesConfig is a configuration class for generating features based on relative dates within a dataset.
Attributes
months_for_avg: Number of months to include from the calculation date when calculating averages.
Feature Generation
TimeFeatureSet Class
TimeFeatureSet is a feature set that generates features based on relative dates within a dataset.
Methods
calculate(df, dataset_config, feature_config, calculation_date): Calculate the features for the given DataFrame,DatasetConfig, andFeatureConfiggiven a specificcalculation_date.
Feature Functions
time_btwn_orders(df, date_col, keys): Calculate the average time between orders by key columns.tenure(df, date_col, keys, calc_date): Calculate the length of time of relationship to the run date by key columns.time_since_last_order(df, date_col, keys, calc_date): Calculate the time since the last order placed to the run date by key columns.