Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a profile matching feature using Dynamic Time Warping (DTW) and Cosine similarity, alongside a new Pearson correlation endpoint. The changes include the core algorithm implementation, new API routes for versioned analysis, and unit tests. The review feedback identifies several areas for improvement: potential runtime errors in the Pearson correlation endpoint due to missing data or NaN results, performance inefficiencies caused by redundant data validation and large sliding window generation, and a logic issue where sequences are incorrectly truncated during cosine similarity calculations.
There was a problem hiding this comment.
Pull request overview
Adds new analytics capabilities to TDgpt/taosanalytics by introducing a profile-matching algorithm (DTW/cosine) and exposing it via a new REST endpoint, alongside a new Pearson correlation endpoint and accompanying unit tests.
Changes:
- Added
do_profile_match_impl(DTW/cosine similarity, normalization, windowing, top-N/threshold filtering). - Exposed new endpoints:
/api/v1/analysis/profile-matchand/api/v1/analysis/pearsonr; added a versioned batch route alias. - Added unit tests covering profile matching behavior and validation.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| tools/tdgpt/taosanalytics/algo/tool/profile_match.py | Implements profile matching core logic with validation, normalization, and DTW/cosine scoring. |
| tools/tdgpt/taosanalytics/app.py | Adds new v1 endpoints for pearson correlation and profile matching; adds versioned batch route alias. |
| tools/tdgpt/taosanalytics/test/unit_test.py | Adds unit tests for do_profile_match_impl covering key scenarios and validation errors. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…oints Agent-Logs-Url: https://github.com/taosdata/TDengine/sessions/e3b99e61-a3e6-449e-9fac-b026b52497d7 Co-authored-by: hjxilinx <8252296+hjxilinx@users.noreply.github.com>
Agent-Logs-Url: https://github.com/taosdata/TDengine/sessions/e3b99e61-a3e6-449e-9fac-b026b52497d7 Co-authored-by: hjxilinx <8252296+hjxilinx@users.noreply.github.com>
Agent-Logs-Url: https://github.com/taosdata/TDengine/sessions/e3b99e61-a3e6-449e-9fac-b026b52497d7 Co-authored-by: hjxilinx <8252296+hjxilinx@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot extract method for validating min_window/max_widow, method for prifle_list formation, method for vaildating |
…ta, _validate_and_parse_window_params Agent-Logs-Url: https://github.com/taosdata/TDengine/sessions/af600a70-f5ff-48a4-bfc5-b2315b0b4cd3 Co-authored-by: hjxilinx <8252296+hjxilinx@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Agent-Logs-Url: https://github.com/taosdata/TDengine/sessions/56c8da00-8c4f-48c6-9e33-19a6271b57af Co-authored-by: hjxilinx <8252296+hjxilinx@users.noreply.github.com>
…g matching Agent-Logs-Url: https://github.com/taosdata/TDengine/sessions/56c8da00-8c4f-48c6-9e33-19a6271b57af Co-authored-by: hjxilinx <8252296+hjxilinx@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…calar extraction; restore pearsonr error mapping Agent-Logs-Url: https://github.com/taosdata/TDengine/sessions/631a084a-29b9-4456-b381-b16572369e6f Co-authored-by: hjxilinx <8252296+hjxilinx@users.noreply.github.com>
Already done in commit |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Code ReviewCritical Issue: Misleading API docstring in The docstring example shows // ❌ Shown in docstring (invalid)
"target_data": {
"ts": [1, 2, 3, 4, 5, 6],
"data": [ [1, 2, 3, 4, 5] ]
}When // ✅ Correct format
"target_data": {
"ts": [[1, 5]],
"data": [ [1, 2, 3, 4, 5] ]
}Please fix the docstring example before merging. |
Misunderstood, approve all. |
This pull request introduces a new profile searching algorithm to the analytics toolkit, providing a robust implementation for searching time series profiles using DTW (Dynamic Time Warping) and cosine similarity. It also adds a new API endpoint for profile searching , comprehensive input validation, and a suite of unit tests to ensure correctness. Additional improvements include a new Pearson correlation endpoint and enhancements to existing batch processing routes.
New profile searching algorithm and API:
do_profile_search_implinprofile_search.pyimplementing core logic for searching a source time series against multiple target profiles using DTW or cosine similarity, with support for normalization, sliding window, and flexible result filtering./api/v1/analysis/profile-searchinapp.pythat exposes the profile searching functionality, including input validation, error handling, and logging.Testing and validation:
Added comprehensive unit tests for the profile searching logic in
unit_test.py, covering DTW and cosine similarity, normalization options, windowing, thresholding, error cases, and input validation.API and batch processing enhancements:
Added a new
/api/v1/analysis/pearsonrendpoint for Pearson correlation, with robust input and error handling.Updated batch processing to support both legacy and versioned endpoints, improving backward compatibility.
These changes significantly enhance the toolkit's analytical capabilities, robustness, and test coverage.# Description
Issue(s)
Checklist
Please check the items in the checklist if applicable.