Skip to content

Commit

Permalink
rename lambda parameter of SIFT
Browse files Browse the repository at this point in the history
  • Loading branch information
jonhue committed Oct 5, 2024
1 parent 27efef1 commit 4d0fe47
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions activeft/sift.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def __init__(
self,
index: faiss.Index,
acquisition_function: AcquisitionFunction | None = None,
llambda: float = 0.01,
lambda_: float = 0.01,
fast: bool = False,
also_query_opposite: bool = True,
only_faiss: bool = False,
Expand All @@ -62,7 +62,7 @@ def __init__(
"""
:param index: Faiss index object.
:param acquisition_function: Acquisition function object.
:param llambda: Value of the lambda parameter of SIFT. Ignored if `acquisition_function` is set.
:param lambda_: Value of the lambda parameter of SIFT. Ignored if `acquisition_function` is set.
:param fast: Whether to use the SIFT-Fast. Ignored if `acquisition_function` is set.
:param also_query_opposite: If using an inner product index, setting this to `True` will also query the opposite of the query embeddings, pre-selecting points with high *absolute* inner product.
:param only_faiss: Whether to only use Faiss for search.
Expand All @@ -85,21 +85,19 @@ def __init__(
UserWarning,
)
elif fast:
assert llambda is not None
self.acquisition_function = LazyVTL(
target=torch.Tensor(),
num_workers=1,
subsample=False,
noise_std=np.sqrt(llambda),
noise_std=np.sqrt(lambda_),
)
else:
assert llambda is not None
self.acquisition_function = VTL(
target=torch.Tensor(),
num_workers=1,
subsample=False,
force_nonsequential=False,
noise_std=np.sqrt(llambda),
noise_std=np.sqrt(lambda_),
)

def search(
Expand Down

0 comments on commit 4d0fe47

Please sign in to comment.