Class SharedNearestNeighborPreprocessor<O>

  • Type Parameters:
    O - the type of database objects the preprocessor can be applied to
    All Implemented Interfaces:
    Index, SharedNearestNeighborIndex<O>

    @Title("Shared Nearest Neighbor Preprocessor")
    @Description("Computes the k nearest neighbors of objects of a certain database.")
    public class SharedNearestNeighborPreprocessor<O>
    extends java.lang.Object
    implements SharedNearestNeighborIndex<O>
    A preprocessor for annotation of the ids of nearest neighbors to each database object.

    The k nearest neighbors are assigned based on an arbitrary distance function.

    This functionality is similar but not identical to MaterializeKNNPreprocessor: While it also computes the k nearest neighbors, it does not keep the actual distances, but organizes the NN set in a TreeSet for fast set operations.

    Since:
    0.1
    Author:
    Arthur Zimek, Erich Schubert
    • Field Detail

      • LOG

        private static final Logging LOG
        Get a logger for this class.
      • numberOfNeighbors

        protected int numberOfNeighbors
        Holds the number of nearest neighbors to be used.
      • distance

        protected Distance<O> distance
        Hold the distance function to be used.
      • relation

        protected Relation<O> relation
        Relation to use.
    • Constructor Detail

      • SharedNearestNeighborPreprocessor

        public SharedNearestNeighborPreprocessor​(Relation<O> relation,
                                                 int numberOfNeighbors,
                                                 Distance<O> distance)
        Constructor.
        Parameters:
        relation - Database to use
        numberOfNeighbors - Number of neighbors
        distance - Distance function