[DOC] Add example notebook for using aeon distances with sklearn clusterers#2511
[DOC] Add example notebook for using aeon distances with sklearn clusterers#2511SalmanDeveloperz wants to merge 30 commits intoaeon-toolkit:mainfrom
Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Thank you for contributing to
|
|
Dear maintainers, Clustering Overview |
hi, thanks for this, we will take a look |
Please refer to the links in my comment of the corresponding issue. |
- Removed "metric=..." details from TOC and introduction. - Renamed "Loading Data" to "Example Dataset." - Deleted redundant Introduction section.
"For a comprehensive overview of all available distance metrics in aeon, see the aeon distances API reference."
"AgglomerativeClustering is, as the name suggests, an agglomerative approach that works by merging clusters bottom-up." Clarified Supported Linkage Methods: Included the supported linkage methods (single, complete, average, weighted) for precomputed distance matrices.
…subtract from 1, ensuring proper preservation of distance distribution.
…istances.ipynb) in the Clustering Overview under Clustering Notebooks.
Thank you for the guidance! I have added a reference in the Please let me know if there are additional updates or adjustments required! |
|
this is failing the tests currently, please click on details to see why and resolve. |
|
Could you add a link to your new notebook from the Clustering-with-sklearn.cluster section of the |
…version consistency.
… and avoid confusion.
…cluster section of sklearn_distances.ipynb.
Inserted the required reference in the Clustering-with-sklearn.cluster section of sklearn_distances.ipynb. Please advise if any further refinements are necessary. |
|
Hi @SebastianSchmidl, |
SebastianSchmidl
left a comment
There was a problem hiding this comment.
Nice work 👍
The example plots (matplotlib) are not included in the notebook output, yet. I do not know if this should happen automatically or not.
@MatthewMiddlehurst Are the notebooks built and committed back by our nightly CI builds?
|
No this is not done automatically, but may be a good idea for those with no output. It would be good to run the notebook so the outputs are displayed here i agree. |
|
Hi, |
|
I see no changes since my comment. You should run the notebook so it has output visible on the website. Make sure you check the readthedocs output under checks. |
- Added outputs for Spectral and Hierarchical Clustering plots. - Fixed oversight per @MatthewMiddlehurst's feedback. - Refined code for more accurate clustering results.
…almanDeveloperz/aeon into add-sklearn-clustering-example
|
Dear @MatthewMiddlehurst, I sincerely apologize for the oversight in my previous updates. I have now resolved the issues by fixing the merge conflict and correcting the indentation in the notebook. All GitHub Actions checks have passed successfully, and the notebook outputs for both Spectral and Hierarchical Clustering are now visible as requested. I’ve also verified the readthedocs output under checks. Kindly review the changes, and please let me know if any further adjustments are needed. Thank you for your guidance and patience throughout this process :) |
|
None of these plots look informative to me, unfortunately. What is it you want to show with these figures? Maybe look into how others visualise clustering results (this may be a bit different for time series). There may be some useful functions in |
| @@ -0,0 +1,342 @@ | |||
| { | |||
There was a problem hiding this comment.
X = np.vstack( ( np.random.normal(loc=[2, 2], scale=0.5, size=(50, 2)), np.random.normal(loc=[5, 5], scale=0.5, size=(50, 2)), ) )
Use time series data like you did previously. As mentioned there are unique challenges when it comes to visualising time series, we are not that interested in regular clustering here.
Reply via ReviewNB
There was a problem hiding this comment.
Thanks for the feedback. I have updated the example to use time series data instead of the randomly generated clusters. Please check.
|
Hi, Before proceeding with further changes, I’d like to seek your guidance. My intention was to demonstrate the separation of time series clusters using Hierarchical Clustering with DTW distance, but the mean-based plots (and my recent shift to time series data) haven’t effectively shown this :(. I noticed the previous 2D data code produced unexpected results locally (in Jupyter and VS Code), though it initially satisfied the output requirement. I’m unsure how to best proceed to align with aeon’s focus on time series clustering. |
|
Look at the plotting functions in aeon currently and you may find some ideas. If nothing works, perhaps look at how others plot clustered time series. |
91562a7 to
bc8d54b
Compare
|
Hello, is this still being worked on? |
|
Hello, It required some time I am working in GSoC rn, will take into it shortly |
…series per cluster
|
Updated the DBSCAN visualization to show representative time series for each cluster, Along with a brief explanation to clarify the relevance of the plot. |
This comment was marked as off-topic.
This comment was marked as off-topic.
|
I'm sorry for the delay, it has been a busy period. IMO the plots are still nonsense. I can only assume you are not checking them yourself. Please have a think about what would actually be useful to display to users considering the time series data type if you want to use such plots. Again, we have plotting functions which may be better. The image used for the notebook is also probably not relevant taking another look. |
Reference Issues/PRs
Fixes #1241
What does this implement/fix? Explain your changes.
This pull request introduces a new Jupyter Notebook: sklearn_clustering_with_aeon_distances.ipynb. The notebook demonstrates how to integrate aeon's distance metrics with scikit-learn clustering algorithms. It includes:
Hierarchical Clustering: Using AgglomerativeClustering with metric="precomputed".
Density-Based Clustering: Using DBSCAN and OPTICS with metric="precomputed".
Spectral Clustering: Using SpectralClustering with affinity="precomputed" and the inverse of the distance matrix as the similarity matrix.
This addition enhances the clustering documentation, showing how to combine aeon’s distance metrics with widely-used scikit-learn clusterers.
Does your contribution introduce a new dependency? If yes, which one?
No new dependencies introduced.
Any other comments?
The notebook has been tested locally, and all cells execute without errors.
A reference to this notebook has been added to the clustering section of the documentation.
PR checklist
For all contributions
For new estimators and functions
__maintainer__at the top of relevant files and want to be contacted regarding its maintenance. Unmaintained files may be removed. This is for the full file, and you should not add yourself if you are just making minor changes or do not want to help maintain its contents.For developers with write access