|
|
# Fast Max-Kernel Search
|
|
|
|
|
|
An implementation of the single-tree and dual-tree fast max-kernel search (FastMKS) algorithm. Given a set of reference points and a set of query points, this can find the reference point with maximum kernel value for each query point
|
|
|
|
|
|
# Available Predicates
|
|
|
|
|
|
* [initModel/11](https://gitlab.cs.uni-duesseldorf.de/stups/abschlussarbeiten/prolog-mlpack-libary/-/wikis/PrologMethods/Geometry/fastmks#initmodel11)
|
|
|
* [searchWithQuery/11](https://gitlab.cs.uni-duesseldorf.de/stups/abschlussarbeiten/prolog-mlpack-libary/-/wikis/PrologMethods/Geometry/fastmks#searchwithquery11)
|
|
|
* [searchNoQuery/7](https://gitlab.cs.uni-duesseldorf.de/stups/abschlussarbeiten/prolog-mlpack-libary/-/wikis/PrologMethods/Geometry/fastmks#searchnoquery7)
|
|
|
|
|
|
---
|
|
|
|
|
|
[links/resources](https://gitlab.cs.uni-duesseldorf.de/stups/abschlussarbeiten/prolog-mlpack-libary/-/wikis/PrologMethods/Geometry/fastmks#connected-linksresources)
|
|
|
|
|
|
## **_initModel/11_**
|
|
|
|
|
|
Initializes the model on the given reference set.
|
|
|
|
|
|
```prolog
|
|
|
%% part of the predicate definition
|
|
|
initModel( +pointer(float_array), +integer, +integer,
|
|
|
+string,
|
|
|
+float32, +float32, +float32, +float32,
|
|
|
+integer, +integer,
|
|
|
+float32).
|
|
|
```
|
|
|
|
|
|
### Parameters
|
|
|
| Name | Type | Description | Default |
|
|
|
|------|------|-------------|---------|
|
|
|
| referenceData | +matrix | The reference dataset. | - |
|
|
|
| kernel | +string | Kernel type to use: "linear", "polynomial", "cosine", "gaussian", "epanechnikov", "triangular", "hyptan". | linear |
|
|
|
| degree | +float | Degree of polynomial kernel. | 2.0 |
|
|
|
| offset | +float | Offset of kernel (for polynomial and hyptan kernels). | 0.0 |
|
|
|
| bandwidth | +float | Bandwidth (for Gaussian, Epanechnikov, and triangular kernels). | 1 |
|
|
|
| scale | +float | Scale of kernel (for hyptan kernel). | 1 |
|
|
|
| singleMode | +integer(bool) | If true, single-tree search is used (as opposed to dual-tree search. | (0)false |
|
|
|
| naive | +integer(bool) | If true, O(n^2) naive mode is used for computation. | (0)false |
|
|
|
| base | +float | Base to use during cover tree construction. | 2 |
|
|
|
|
|
|
---
|
|
|
|
|
|
## **_searchWithQuery/11_**
|
|
|
|
|
|
Search with a different query set.
|
|
|
|
|
|
```prolog
|
|
|
%% part of the predicate definition
|
|
|
searchWithQuery( +pointer(float_array), +integer, +integer,
|
|
|
+integer,
|
|
|
-pointer(float_array), -integer, -integer,
|
|
|
-pointer(float_array), -integer, -integer,
|
|
|
+float32).
|
|
|
```
|
|
|
|
|
|
### Parameters
|
|
|
| Name | Type | Description | Default |
|
|
|
|------|------|-------------|---------|
|
|
|
| querySet | +matrix | Set to search with. | - |
|
|
|
| k | +integer | Number of maximum kernels to find. | 0 |
|
|
|
| indices | -matrix | Output matrix of indices. | - |
|
|
|
| kernels | -matrix | Output matrix of kernels. | - |
|
|
|
| base | +float | Base to use during cover tree construction. | 2 |
|
|
|
|
|
|
---
|
|
|
|
|
|
## **_searchNoQuery/7_**
|
|
|
|
|
|
Search with the reference set as the query set.
|
|
|
|
|
|
```prolog
|
|
|
%% part of the predicate definition
|
|
|
searchNoQuery( +integer,
|
|
|
-pointer(float_array), -integer, -integer,
|
|
|
-pointer(float_array), -integer, -integer)
|
|
|
```
|
|
|
|
|
|
### Parameters
|
|
|
| Name | Type | Description | Default |
|
|
|
|------|------|-------------|---------|
|
|
|
| k | +integer | Number of maximum kernels to find. | 0 |
|
|
|
| indices | -matrix | Output matrix of indices. | - |
|
|
|
| kernels | -matrix | Output matrix of kernels. | - |
|
|
|
|
|
|
---
|
|
|
|
|
|
# Connected Links/Resources
|
|
|
|
|
|
If you want a more detailed explanation, then go to the python documentation. There is most of the time a good explanation on how the methods work and what the parameters do.
|
|
|
|
|
|
* [MLpack::fastmks_C++\_documentation](https://www.mlpack.org/doc/stable/doxygen/classmlpack_1_1fastmks_1_1FastMKS.html)
|
|
|
* [MLpack::fastmks_Python_documentation](https://www.mlpack.org/doc/stable/python_documentation.html#fastmks)
|
|
|
|
|
|
added some of the links from the python documentation
|
|
|
|
|
|
* Fast max-kernel search tutorial (fastmks)
|
|
|
* k-nearest-neighbor search
|
|
|
* [Dual-tree Fast Exact Max-Kernel Search (pdf)](http://mlpack.org/papers/fmks.pdf) |
|
|
\ No newline at end of file |