Object/Class

com.github.jelmerk.knn.scalalike.hnsw

HnswIndex

Related Docs: class HnswIndex | package hnsw

Permalink

object HnswIndex extends Serializable

Linear Supertypes
Serializable, Serializable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. HnswIndex
  2. Serializable
  3. Serializable
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def apply[TId, TVector, TItem <: Item[TId, TVector], TDistance](dimensions: Int, distanceFunction: DistanceFunction[TVector, TDistance], maxItemCount: Int, m: Int = JHnswIndex.BuilderBase.DEFAULT_M, ef: Int = JHnswIndex.BuilderBase.DEFAULT_EF, efConstruction: Int = ..., removeEnabled: Boolean = ..., itemIdSerializer: ObjectSerializer[TId] = new JavaObjectSerializer[TId], itemSerializer: ObjectSerializer[TItem] = new JavaObjectSerializer[TItem])(implicit distanceOrdering: Ordering[TDistance]): HnswIndex[TId, TVector, TItem, TDistance]

    Permalink

    Construct a new HnswIndex.

    Construct a new HnswIndex.

    TId

    Type of the external identifier of an item

    TVector

    Type of the vector to perform distance calculation on

    TItem

    Type of items stored in the index

    TDistance

    Type of distance between items (expect any numeric type: float, double, int, ..)

    dimensions

    dimensionality of the items stored in the index

    distanceFunction

    the distance function

    maxItemCount

    the maximum number of elements in the index

    m

    Sets the number of bi-directional links created for every new element during construction. Reasonable range for m is 2-100. Higher m work better on datasets with high intrinsic dimensionality and/or high recall, while low m work better for datasets with low intrinsic dimensionality and/or low recalls. The parameter also determines the algorithm's memory consumption. As an example for d = 4 random vectors optimal m for search is somewhere around 6, while for high dimensional datasets (word embeddings, good face descriptors), higher M are required (e.g. m = 48, 64) for optimal performance at high recall. The range mM = 12-48 is ok for the most of the use cases. When m is changed one has to update the other parameters. Nonetheless, ef and efConstruction parameters can be roughly estimated by assuming that m * efConstruction is a constant.

    ef

    The size of the dynamic list for the nearest neighbors (used during the search). Higher ef leads to more accurate but slower search. The value ef of can be anything between k and the size of the dataset.

    efConstruction

    The parameter has the same meaning as ef, but controls the index time / index precision. Bigger efConstruction leads to longer construction, but better index quality. At some point, increasing efConstruction does not improve the quality of the index. One way to check if the selection of ef_construction was ok is to measure a recall for M nearest neighbor search when ef = efConstruction: if the recall is lower than 0.9, then there is room for improvement

    removeEnabled

    enable or disable the experimental remove operation. Indices that support removes will consume more memory

    itemIdSerializer

    used to serialize the item key during saving of the index. when unspecified java serialization will be used. for the fastest possible save time and smallest indices you will want to provide this

    itemSerializer

    used to serialize the item during saving of the index. when unspecified java serialization will be used. for the fastest possible save time and smallest indices you will want to provide this

    distanceOrdering

    used to compare the distances returned by the distance function

    returns

    the index

  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  8. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  9. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  10. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  11. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  12. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  13. def loadFromFile[TId, TVector, TItem <: Item[TId, TVector], TDistance](file: File, classLoader: ClassLoader = ...): HnswIndex[TId, TVector, TItem, TDistance]

    Permalink

    Restores a HnswIndex from a File.

    Restores a HnswIndex from a File.

    TId

    Type of the external identifier of an item

    TVector

    Type of the vector to perform distance calculation on

    TItem

    Type of items stored in the index

    TDistance

    Type of distance between items (expect any numeric type: float, double, int, ..)

    file

    File to read from

    classLoader

    the classloader to use

    returns

    The restored index

  14. def loadFromInputStream[TId, TVector, TItem <: Item[TId, TVector], TDistance](inputStream: InputStream, classLoader: ClassLoader = ...): HnswIndex[TId, TVector, TItem, TDistance]

    Permalink

    Restores a HnswIndex from an InputStream.

    Restores a HnswIndex from an InputStream.

    TId

    Type of the external identifier of an item

    TVector

    Type of the vector to perform distance calculation on

    TItem

    Type of items stored in the index

    TDistance

    Type of distance between items (expect any numeric type: float, double, int, ..)

    inputStream

    InputStream to restore the index from

    classLoader

    the classloader to use

    returns

    The restored index

  15. def loadFromPath[TId, TVector, TItem <: Item[TId, TVector], TDistance](path: Path, classLoader: ClassLoader = ...): HnswIndex[TId, TVector, TItem, TDistance]

    Permalink

    Restores a HnswIndex from a Path.

    Restores a HnswIndex from a Path.

    TId

    Type of the external identifier of an item

    TVector

    Type of the vector to perform distance calculation on

    TItem

    Type of items stored in the index

    TDistance

    Type of distance between items (expect any numeric type: float, double, int, ..)

    path

    Path to read from

    returns

    The restored index

  16. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  17. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  18. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  19. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  20. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  21. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  22. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  23. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped