Skip to content

[ENH] RandomShapeletTransform speed ups#3574

Draft
TonyBagnall wants to merge 2 commits into
mainfrom
ajb/rst
Draft

[ENH] RandomShapeletTransform speed ups#3574
TonyBagnall wants to merge 2 commits into
mainfrom
ajb/rst

Conversation

@TonyBagnall

@TonyBagnall TonyBagnall commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

sequence of computational improvements designed to speed up RST without changing outcome.

Stage 1: _online_shapelet_distance scalar rewrite

Replace traverse, sums, and sums2 list state with scalar left/right state

compute the normalised value on demand, avoid unnecessary slicing
Move unchanging values out of loop

@TonyBagnall TonyBagnall added the transformations Transformations package label Jun 28, 2026
@aeon-actions-bot aeon-actions-bot Bot added the enhancement New feature, improvement request or other non-bug code enhancement label Jun 28, 2026
@aeon-actions-bot

Copy link
Copy Markdown
Contributor

Thank you for contributing to aeon

I have added the following labels to this PR based on the title: [ enhancement ].
I would have added the following labels to this PR based on the changes made: [ transformations ], however some package labels are already present.

The Checks tab will show the status of our automated tests. You can click on individual test runs in the tab or "Details" in the panel below to see more information if there is a failure.

If our pre-commit code quality check fails, please run pre-commit locally and push the fixes to your PR branch.

Don't hesitate to ask questions on the aeon Discord channel if you have any.

PR CI actions

These checkboxes will add labels to enable or disable CI functionality for this PR. This may not take effect immediately, and a new commit may be required to run the new configuration.

  • Run pre-commit checks for all files
  • Run mypy typecheck tests
  • Run all pytest tests and configurations
  • Run all notebook example tests
  • Run numba-disabled codecov tests
  • Disable numba cache loading
  • Regenerate expected results for testing
  • Push an empty commit to re-run CI checks

for i, n in zip(shapelet, subseq):
temp = i - n
for i in range(length):
val = (series[position + i] - mean) / std if use_std else 0.0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this fast? I.e. calling the 'if' on every value?

maybe first do normalization in a different loop if use_std is set ?

or divide by std=1.0 ? and set std = 1 if use_std is set?

use_std = std > AEON_NUMBA_STD_THRESHOLD
for j in range(length):
idx = sorted_indicies[j]
val = (series[pos + idx] - mean) / std if use_std else 0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

maybe more efficient to do this once outside and use the normalized values here?

@patrickzib patrickzib left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not a review, just a comment. Maybe calling if on every value is not super efficient? normalization once outside the loops or using / std=1.0 might be faster?

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

Labels

enhancement New feature, improvement request or other non-bug code enhancement transformations Transformations package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants