Skip to content

Conversation

@TaobaOuathrani
Copy link

This PR adds a self-contained example showcasing how
DatetimeEncoder extracts meaningful time-based features in a
regression setting.

Closes #1629

Copy link
Member

@rcap107 rcap107 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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))

# ---------------------------------------------------------------------
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should also be a section with a DatetimeEncoder that does not include periodic features for the sake of the comparison.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a conclusion summarizing briefly what is being done here

@rcap107
Copy link
Member

rcap107 commented Jan 14, 2026

Oh, and pre-commit checks can be addressed by running either pixi run lint or pre-commit run --all-files in the project's folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DOC - Write a new example with the DatetimeEncoder

2 participants