Skip to content
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

[BUG] QuerySearch Value error even though the shape of inputs is correct #2538

Open
PavelRechkalov opened this issue Feb 15, 2025 · 5 comments · May be fixed by #2473
Open

[BUG] QuerySearch Value error even though the shape of inputs is correct #2538

PavelRechkalov opened this issue Feb 15, 2025 · 5 comments · May be fixed by #2473

Comments

@PavelRechkalov
Copy link

PavelRechkalov commented Feb 15, 2025

  1. I fit the QuerySearch on a tensor of shape (561,1,4)
  2. Then I provide it a query of shape (1,4)
  3. I get the following error message:
      """
      ValueError: The length of the query should be inferior or equal to the length of data (X_)
      provided during fit, but got 4 for X and 4 for X_
      """

I use the latest aeon version in python 3.12.3 env

Kind regards

@PavelRechkalov
Copy link
Author

PavelRechkalov commented Feb 15, 2025

You can reproduce this error even using the datasets provided by the library:

from aeon.datasets import load_classification
X, y = load_classification("GunPoint")
X_train, q =  X[:-1,:,:],  X[-1,:,:]

querySearcher = QuerySearch(
    k = 3
   ,distance = 'euclidean'
   ,normalise = False
   ,speed_up = 'fastest'
   ,n_jobs = 1 #os.cpu_count() - 1
) 
querySearcher.fit(X = X_train)
querySearcher.predict(q)

@PavelRechkalov
Copy link
Author

I believe the issue might be the marked in red IF condition:

Image

Should not it be ">" instead of ">="?

@baraline
Copy link
Member

baraline commented Feb 15, 2025

Hi, thanks for raising the issue, FYI most of this code is getting reworked in #2473, and will contain breaking changes.

Concerning the current issue you are facing, you are right, the if condition here should be if query_length > self.min_timepoints_. I'll check in #2473, but I don't think the issue appears in the new code.
For fixing it on your side, I would recommend editing the source file for now.

Note that having query_length == self.min_timepoints_ is equivalent to doing a whole series KNN, rather than working on subsequence similarity, and hence the computational optimisations will not help much !

@baraline baraline changed the title QuerySearch Value error even though the shape of inputs is correct [BUG] QuerySearch Value error even though the shape of inputs is correct Feb 15, 2025
@PavelRechkalov
Copy link
Author

Greetings sir, thank you for replying.

Indeed, I updated the code on my end, now it works as intended.

When the #2743 is expected to be released? I'm asking to adjust my development process

Thank you in advance

@baraline
Copy link
Member

When another maintainer have time to review it, it's quite a big one. Furthermore, for now, some functionalities have been removed (for example, query search on a collection of series) I would need to make some wrappers to make that happens, but this is simple. If you need any assistance once the PR is in to adapt your code, don't hesitate to create a discussion!

@baraline baraline reopened this Feb 18, 2025
@baraline baraline linked a pull request Feb 18, 2025 that will close this issue
8 tasks
@baraline baraline linked a pull request Feb 18, 2025 that will close this issue
8 tasks
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 a pull request may close this issue.

2 participants