Add simple DatetimeEncoder example with periodic encoding (#1629)#1834
Add simple DatetimeEncoder example with periodic encoding (#1629)#1834TaobaOuathrani wants to merge 1 commit intoskrub-data:mainfrom
Conversation
rcap107
left a comment
There was a problem hiding this comment.
Hi @TaobaOuathrani, thanks for this PR. It's a good start, but there is still some work to be done.
To begin with, this example should be in its own file, and the content of the current file (0030_datetime_encoder.py) should be moved to the FIXME folder in examples: we might want to revisit the forecasting example in the future, possibly by using the Data Ops.
Another general comment is that there should be more narrative, i.e., more text describing what are the steps that are being executed and the reasoning for it. Something like "we want to add periodic features because we are using a linear model and they are useful" etc.
I am not too keen on using synthetic data as the example, but I am aware that finding a dataset that is suitable for the example (something that has a timeseries but isn't forecasting-based) is hard, so we might be stuck with this for now.
In any case, thanks for the PR. We can keep on iterating on this.
| ------------------------------------------------------------ | ||
|
|
||
| This example demonstrates what the DatetimeEncoder does on a simple, | ||
| non-forecasting regression task. |
There was a problem hiding this comment.
Please expand a bit this section explaining that for the sake of the example we are using a synthetic dataset, and a plot of what the target looks like.
| y_pred_baseline = model_baseline.predict(X_baseline) | ||
| print("R² with naive timestamp:", r2_score(y, y_pred_baseline)) | ||
|
|
||
| # --------------------------------------------------------------------- |
There was a problem hiding this comment.
There should also be a section with a DatetimeEncoder that does not include periodic features for the sake of the comparison.
There was a problem hiding this comment.
Also please add a few lines explaining in words what is happening here as part of the narrative of the example.
| encoder = next(iter(apply.transformers_.values())) | ||
|
|
||
| print("Generated features:") | ||
| print(encoder.get_feature_names_out()) |
There was a problem hiding this comment.
Please add a conclusion summarizing briefly what is being done here
|
Oh, and pre-commit checks can be addressed by running either |
|
Hi @TaobaOuathrani, are you still working on this PR? |
This PR adds a self-contained example showcasing how
DatetimeEncoder extracts meaningful time-based features in a
regression setting.
Closes #1629