Skip to content

[MNT, ENH, DOC] Rework similarity search #2473

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
wants to merge 52 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
1646895
WIP remake module structure
baraline Dec 4, 2024
52b0692
Update _brute_force.py
baraline Dec 5, 2024
7973a30
Update test__commons.py
baraline Dec 5, 2024
7abe221
Merge remote-tracking branch 'origin/main' into 2341-enh-indexsearch-…
baraline Dec 14, 2024
ad02b84
WIP mock and test
baraline Dec 27, 2024
bb2aa33
Add test for base subsequence
baraline Jan 1, 2025
c5c9c28
Merge remote-tracking branch 'origin/main' into 2341-enh-indexsearch-…
baraline Jan 2, 2025
f23c720
Fix subsequence_search tests
baraline Jan 2, 2025
c372969
debug brute force mp
baraline Jan 2, 2025
d7da68b
more debug of subsequence tests
baraline Jan 2, 2025
da2758c
more debug of subsequence tests
baraline Jan 2, 2025
2191ac2
Add functional LSH neighbors
baraline Jan 10, 2025
cd33d0a
add notebook for sim search tasks
baraline Jan 13, 2025
b841b79
Updated series similarity search
baraline Jan 16, 2025
dbe9494
Merge remote-tracking branch 'origin/main' into 2341-enh-indexsearch-…
baraline Jan 16, 2025
57e5e7b
Fix mistake addition in transformers and fix base classes
baraline Jan 16, 2025
2078086
Fix registry and api reference
baraline Jan 16, 2025
9effbd9
Update documentation and fix some leftover bugs
baraline Jan 17, 2025
f51d66a
Update documentation and add default test params
baraline Jan 19, 2025
763bdcf
Fix identifiers and test data shape for all_estimators tests
baraline Jan 19, 2025
85c7174
Fix missing params
baraline Jan 20, 2025
038f844
Merge remote-tracking branch 'origin/main' into 2341-enh-indexsearch-…
baraline Feb 1, 2025
fd7caad
Fix n_jobs params and tags, add some docs
baraline Feb 1, 2025
6e3157b
Fix numba test bug and update testing data for sim search
baraline Feb 2, 2025
e3ccb3f
Fix imports, testing data tests, and impose predict/_predict interfac…
baraline Feb 2, 2025
ee7aa58
Fix args
baraline Feb 2, 2025
bf0c5e8
Fix extract test
baraline Feb 2, 2025
0c2d763
update docs api and notebooks
baraline Feb 2, 2025
db10499
remove notes
baraline Feb 2, 2025
3587de1
Merge branch 'main' into 2341-enh-indexsearch-class-with-attimo-algor…
baraline Feb 2, 2025
9c671f6
Merge branch 'main' into 2341-enh-indexsearch-class-with-attimo-algor…
baraline Feb 14, 2025
1e21767
Merge branch 'main' into 2341-enh-indexsearch-class-with-attimo-algor…
patrickzib Mar 4, 2025
f328779
Patrick comments
baraline Mar 15, 2025
6d8541a
Merge branch 'main' into 2341-enh-indexsearch-class-with-attimo-algor…
baraline Mar 15, 2025
617a927
Merge branch 'main' into 2341-enh-indexsearch-class-with-attimo-algor…
baraline Mar 16, 2025
a34d58c
Merge branch 'main' into 2341-enh-indexsearch-class-with-attimo-algor…
MatthewMiddlehurst Mar 23, 2025
680e8b0
Merge remote-tracking branch 'origin/main' into 2341-enh-indexsearch-…
baraline Mar 27, 2025
0a9434f
Adress comments and clean index code
baraline Mar 27, 2025
537caab
Adress comments and clean index code
baraline Mar 27, 2025
75ae978
Fix Patrick comments
baraline Mar 31, 2025
fa43a10
Fix variable suppression mistake
baraline Mar 31, 2025
68d817f
Merge branch 'main' into 2341-enh-indexsearch-class-with-attimo-algor…
baraline Mar 31, 2025
69eaed2
Fix Base class comments
baraline Apr 16, 2025
f4a6414
Divide base class into task specific
baraline Apr 19, 2025
5c08b43
Fix typo in imports
baraline Apr 19, 2025
40c7e1a
Empty commit for CI
baraline Apr 19, 2025
58dd7b4
Fix typo again
baraline Apr 19, 2025
38e7b55
Merge branch '2341-enh-indexsearch-class-with-attimo-algorithm' of ht…
baraline Apr 19, 2025
6911bd9
Add check_inheritance exception for similarity search
baraline Apr 19, 2025
7fd9899
Revert back to non per type base classes
baraline Apr 19, 2025
470dcf9
Factor check index and typo in test
baraline Apr 19, 2025
d4fc858
Merge branch 'main' into 2341-enh-indexsearch-class-with-attimo-algor…
baraline May 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions aeon/similarity_search/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Similarity search module."""

__all__ = ["BaseSimilaritySearch", "QuerySearch", "SeriesSearch"]
__all__ = ["BaseSimilaritySearch"]

from aeon.similarity_search.base import BaseSimilaritySearch
from aeon.similarity_search.query_search import QuerySearch
from aeon.similarity_search.series_search import SeriesSearch
from aeon.similarity_search._base import BaseSimilaritySearch
81 changes: 81 additions & 0 deletions aeon/similarity_search/_base.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
"""Base class for similarity search."""

__maintainer__ = ["baraline"]
__all__ = [
"BaseSimilaritySearch",
]


from abc import abstractmethod
from typing import Union

import numpy as np
from numba.typed import List

from aeon.base import BaseAeonEstimator


class BaseSimilaritySearch(BaseAeonEstimator):
"""Base class for similarity search applications."""

_tags = {
"requires_y": False,
"fit_is_empty": False,
}

@abstractmethod
def __init__(self):
super().__init__()

@abstractmethod
def fit(
self,
X: Union[np.ndarray, List],
y=None,
):
"""
Fit estimator to X.

State change:
Changes state to "fitted".

Writes to self:
_is_fitted : flag is set to True.

Parameters
----------
X : Series or Collection, any supported type
Data to fit transform to, of python type as follows:
Series: 2D np.ndarray shape (n_channels, n_timepoints)
Collection: 3D np.ndarray shape (n_cases, n_channels, n_timepoints)
or list of 2D np.ndarray, case i has shape (n_channels, n_timepoints_i)
y: ignored, exists for API consistency reasons.

Returns
-------
self : a fitted instance of the estimator
"""
...

@abstractmethod
def predict(
self,
X: Union[np.ndarray, None] = None,
):
"""
Predict method.

Can either work with new series or with None (for case when predict can be made
using the data given in fit against itself) depending on the estimator.

Parameters
----------
X : Series or Collection, any supported type
Data to fit transform to, of python type as follows:
Series: 2D np.ndarray shape (n_channels, n_timepoints)
Collection: 3D np.ndarray shape (n_cases, n_channels, n_timepoints)
or list of 2D np.ndarray, case i has shape (n_channels, n_timepoints_i
None : If None type is accepted, it means that the predict function will
work only with the data given in fit. (e.g. self matrix profile instead)
"""
...
Loading