Skip to content

Commit

Permalink
time_feature_is_universal
Browse files Browse the repository at this point in the history
  • Loading branch information
cademack committed Jan 9, 2024
1 parent f2ac444 commit f438b17
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,12 @@ def infer_feature_attributes(data: Union[pd.DataFrame, SQLRelationalDatastorePro
This will cause the bounds for the start and end times set
to the same bounds as observed in the original data.
time_feature_is_universal : bool, optional
If True, the time feature will be treated as universal and future data
is excluded while making predictions. If False, the time feature will
not be treated as universal and only future data within the same series
is excluded while making predictions.
time_series_type_default : str, default 'rate'
(Optional) Type specifying how time series is generated.
One of 'rate' or 'delta', default is 'rate'. If 'rate',
Expand Down
11 changes: 11 additions & 0 deletions howso/utilities/feature_attributes/time_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ def _process( # noqa: C901
attempt_infer_extended_nominals: bool = False,
nominal_substitution_config: Optional[Dict[str, Dict]] = None,
include_extended_nominal_probabilities: Optional[bool] = False,
time_feature_is_universal: bool = None,
time_series_type_default: Optional[str] = 'rate',
time_series_types_override: Optional[Dict] = None,
orders_of_derivatives: Optional[Dict] = None,
Expand Down Expand Up @@ -423,6 +424,12 @@ def _process( # noqa: C901
(Optional) If true, extended nominal probabilities will be appended
as metadata into the feature object.
time_feature_is_universal : bool, optional
If True, the time feature will be treated as universal and future data
is excluded while making predictions. If False, the time feature will
not be treated as universal and only future data within the same series
is excluded while making predictions.
time_series_type_default : str, default 'rate'
(Optional) Type specifying how time series is generated.
One of 'rate' or 'delta', default is 'rate'. If 'rate',
Expand Down Expand Up @@ -616,6 +623,10 @@ def _process( # noqa: C901

if self.time_feature_name in features:
features[self.time_feature_name]['time_series']['time_feature'] = True

# Assign universal value if specified
if time_feature_is_universal is not None:
features[self.time_feature_name]['time_series']['universal'] = time_feature_is_universal
# Force time_feature to be `continuous`
features[self.time_feature_name]['type'] = "continuous"
# Set time_series as 'delta' so that lag and delta are computed
Expand Down

0 comments on commit f438b17

Please sign in to comment.