mirror of
https://github.com/pgvector/pgvector.git
synced 2026-06-06 14:01:31 +08:00
Improved precision for cosine distance [skip ci]
This commit is contained in:
@@ -911,8 +911,7 @@ CREATE OPERATOR CLASS minivec_ip_ops
|
||||
CREATE OPERATOR CLASS minivec_cosine_ops
|
||||
FOR TYPE minivec USING ivfflat AS
|
||||
OPERATOR 1 <=> (minivec, minivec) FOR ORDER BY float_ops,
|
||||
FUNCTION 1 minivec_negative_inner_product(minivec, minivec),
|
||||
FUNCTION 2 l2_norm(minivec),
|
||||
FUNCTION 1 cosine_distance(minivec, minivec),
|
||||
FUNCTION 3 minivec_spherical_distance(minivec, minivec),
|
||||
FUNCTION 4 l2_norm(minivec),
|
||||
FUNCTION 5 ivfflat_minivec_support(internal);
|
||||
|
||||
@@ -102,7 +102,7 @@ for my $i (0 .. $#operators)
|
||||
));
|
||||
|
||||
# Test approximate results
|
||||
if ($operator eq "<->")
|
||||
if ($operator ne "<#>")
|
||||
{
|
||||
# TODO Fix test (uniform random vectors all have similar inner product)
|
||||
test_recall(1, 0.33, $operator);
|
||||
@@ -112,7 +112,7 @@ for my $i (0 .. $#operators)
|
||||
# Test probes equals lists
|
||||
if ($operator eq "<=>")
|
||||
{
|
||||
test_recall(100, 0.30, $operator);
|
||||
test_recall(100, 0.98, $operator);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -131,7 +131,7 @@ for my $i (0 .. $#operators)
|
||||
like($stderr, qr/using \d+ parallel workers/);
|
||||
|
||||
# Test approximate results
|
||||
if ($operator eq "<->")
|
||||
if ($operator ne "<#>")
|
||||
{
|
||||
# TODO Fix test (uniform random vectors all have similar inner product)
|
||||
test_recall(1, 0.33, $operator);
|
||||
@@ -141,7 +141,7 @@ for my $i (0 .. $#operators)
|
||||
# Test probes equals lists
|
||||
if ($operator eq "<=>")
|
||||
{
|
||||
test_recall(100, 0.30, $operator);
|
||||
test_recall(100, 0.98, $operator);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user