Skip to content

Distance metrics for boolean array/discrete set data for PostgreSQL pgvector

License

Unknown and 2 other licenses found

Licenses found

Unknown
LICENSE
Unknown
LICENSE-PGVECTOR
Unknown
LICENSE-pgvector_chem
Notifications You must be signed in to change notification settings

Clifford-appliedAI-GmbH/pgvector_set

 
 

Repository files navigation

pgvector_set

Sample set distance metrics for Postgres pgvector. Provides:

  • Jaccard/Tanimoto distance for boolean vectors.

Installation

git clone https://github.com/CliffordWilmot/pgvector_set
cd pgvector_set
make CC=cc && make install

Usage

Setup

In order to use the functionality provided by this extension first install and enable the pgvector extension.

CREATE EXTENSION vector;

Enable the extension (do this once in each database where you want to use it).

CREATE EXTENSION vector_chem;

Querying

We define the operator <^> for computing the Jaccard distance between two vectors of boolean values represented with 0.0 and 1.0.

SELECT '[1., 0., 1.]' <^> '[1., 0., 1.]';
-- ?column?
-- ----------
--       0
-- (1 row)

The function jaccard_distance is also defined and computes the same result as the <^> operator.

SELECT jaccard_distance('[1., 0., 1.]', '[1., 0., 0.]');
--  jaccard_distance
-- -------------------
--                0.5
-- (1 row)

FAQ

Is the provided Jaccard/Tanimoto distance usable for continuous values?

Not at this time.

Is approximate nearest neighbor search supported?

Not at this time.

About

Distance metrics for boolean array/discrete set data for PostgreSQL pgvector

Resources

License

Unknown and 2 other licenses found

Licenses found

Unknown
LICENSE
Unknown
LICENSE-PGVECTOR
Unknown
LICENSE-pgvector_chem

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Makefile 50.5%
  • C 49.5%