glassbox.models.neighbors.index._brute¶
BruteForceIndex — exhaustive distance search.
BruteForceIndex
¶
Bases: BaseIndex
Initialize the BruteForceIndex.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
metric
|
DistanceMetric
|
The distance metric to use for querying. |
required |
Source code in glassbox/models/neighbors/index/_brute.py
build
¶
Build the brute-force index by storing the training data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
ndarray
|
Training data, shape (n_samples, n_features). |
required |
Source code in glassbox/models/neighbors/index/_brute.py
query
¶
Query the index for the k nearest neighbors using exhaustive search.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
ndarray
|
Query point(s), shape (n_features,) or (n_queries, n_features). |
required |
k
|
int
|
Number of nearest neighbors to retrieve. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Indices of the k nearest neighbors. |