Skip to content

Error in "Handling datetime features with the DatetimeEncoder" Example + Minor Corrections #1282

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
semyonbok opened this issue Apr 5, 2025 · 0 comments

Comments

@semyonbok
Copy link
Contributor

The example juxtaposes the performance of three regression models that use different configurations of DatetimeEncoder. These lines highlight that the one with spline feature pre-processing is better:

print(f"Base transformer - Mean RMSE : {-score_base.mean():.2f}")
print(f"Transformer with weekday - Mean RMSE : {-score_weekday.mean():.2f}")
print(f"Transformer with periodic features - Mean RMSE : {-score_periodic.mean():.2f}")
###############################################################################
# As expected for linear models, introducing the periodic features improved
# the RMSE by a noticeable amount.

Please notice that spline periodic encoding actually yields significantly worse RMSE. Its performance on the first two splits is preposterous, as visualized below. The DataViz also shows RMSE on entire test set, as well as on its last 96 entries: the spline pipeline keeps under-performing.

Image

Also, a couple of minor corrections should be done:

  • just "don't want to" is meant, and resolution is not explicitly set to "hour" in the preceding code example:
    # During the instantiation of the |DatetimeEncoder|, we specify that we want
    # don't want to extract features with a resolution finer than hours. This is
    # because we don't want to extract minutes, seconds and lower units, as they
    # are unimportant here.
  • slight improvements to prediction plotting can be made:
    Image
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

No branches or pull requests

1 participant