Trait

com.github.jelmerk.knn.scalalike

ReadOnlyIndex

Related Doc: package scalalike

Permalink

trait ReadOnlyIndex[TId, TVector, TItem <: Item[TId, TVector], TDistance] extends Serializable

K-nearest neighbours search index.

TId

type of the external identifier of an item

TVector

The type of the vector to perform distance calculation on

TItem

Type of items stored in the index

TDistance

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

See also

See https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm for more information.

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

Abstract Value Members

  1. abstract def apply(id: TId): TItem

    Permalink

    Returns an item by its identifier.

    Returns an item by its identifier. If the item does not exist in the index a NoSuchElementException is thrown

    id

    unique identifier of the item to return

    returns

    the item

  2. abstract def findNearest(vector: TVector, k: Int): Seq[SearchResult[TItem, TDistance]]

    Permalink

    Find the items closest to the passed in vector.

    Find the items closest to the passed in vector.

    vector

    the vector

    k

    number of items to return

    returns

    the items closest to the passed in vector

  3. abstract def findNeighbours(id: TId, k: Int): Seq[SearchResult[TItem, TDistance]]

    Permalink

    Find the items closest to the item identified by the passed in id.

    Find the items closest to the item identified by the passed in id. If the id does not match an item an empty list is returned. the element itself is not included in the response.

    id

    of the item to find the neighbours of

    k

    number of neighbours to return

    returns

    the items closest to the item

  4. abstract def get(id: TId): Option[TItem]

    Permalink

    Optionally return an item by its identifier

    Optionally return an item by its identifier

    id

    unique identifier of the item to return

    returns

    the item

  5. abstract def save(path: Path): Unit

    Permalink

    Saves the index to a path.

    Saves the index to a path.

    path

    path to write the index to

  6. abstract def save(file: File): Unit

    Permalink

    Saves the index to a file.

    Saves the index to a file.

    file

    file to write the index to

  7. abstract def save(out: OutputStream): Unit

    Permalink

    Saves the index to an OutputStream.

    Saves the index to an OutputStream.

    out

    the output stream to write the index to

  8. abstract def size: Int

    Permalink

    Returns the size of the index.

    Returns the size of the index.

    returns

    size of the index

Concrete 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. final def asInstanceOf[T0]: T0

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

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

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

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

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

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

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

    Permalink
    Definition Classes
    Any
  12. final def ne(arg0: AnyRef): Boolean

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

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

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  17. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  18. final def wait(arg0: Long, arg1: Int): Unit

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

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

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped