Comments (6)
Currently I have no plan to implement a custom distance. But, since I know that a custom distance is important for some applications, I would like to implement a custom distance into C++ API in future. But, I do not think that a custom distance defined by slow python is an effective way, because the distance function largely affects the search time.
from ngt.
Thanks. Just to check, if I want to add a custom distance myself in the C++ without adding all the architecture for it, could I potentially just replace the following lines:
NGT/lib/NGT/PrimitiveComparator.h
Lines 48 to 65 in 79ba11c
and refer to my custom distance as "l2" ? (My distance is similar to L2) Or would there be a lot more I would need to replace?
Cheers,
Miles
from ngt.
You are right. You do not need to update other part of the source code. But you have to care about implementing your function. Objects (vector data) are automatically stored as a 16-byte boundary object with zero padding in the index.
NGT/lib/NGT/PrimitiveComparator.h
Line 48 in 79ba11c
The size above is the byte length of the 16-byte boundary object. You cannot get the original size of the object in the function. For example, when you specify 3-dimensional floating point object to create an empty index, the size of the function’s parameter is 16 and the added forth floating point of the object is always zero.
from ngt.
If you use the default cmake definitions, you have to replace
NGT/lib/NGT/PrimitiveComparator.h
Line 78 in 79ba11c
or
NGT/lib/NGT/PrimitiveComparator.h
Line 118 in 79ba11c
, because AVX must be available.
from ngt.
is there any plan to add support for braycurtis and canberra distances? thanks
from ngt.
We have no plan to implement braycurtis and canberra distances. However, it might not be so difficult to implement the distances by yourself referring to this PR #91.
from ngt.
Related Issues (20)
- Using float16 in C API HOT 4
- PHP Library HOT 2
- Non-similar length vectors? HOT 3
- import ngt ok but import ngtpy show No module named 'ngtpy HOT 3
- RuntimeError: remove: cannot remove from tree. get: Not in-memory or invalid offset of node. HOT 3
- How to reduce grp / objpo / trei / trel files size? HOT 2
- How to create a QBG with Capi ? HOT 7
- Specify num_threads for searching HOT 3
- Linking issue HOT 2
- Add more ngt_insert_index_as_TYPE methods to C API HOT 2
- Feature request: Command line output option that doesn't require intensive deserialization
- Add new QBG methods to C API HOT 7
- Is there any benchmark result for NGT QG/QBG? HOT 4
- file descriptor leak on `index.build_index` HOT 2
- Missing functions and types in the C API HOT 14
- Python bindings for QG/QBG HOT 3
- bugs HOT 3
- Fixed seeds for deterministic results HOT 1
- Building with -DNGT_QBG_DISABLED=ON still trying to link with LAPACK and BLAS HOT 2
- How to update NGT from older version to new one? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ngt.