Class AbstractMaterializeKNNPreprocessor<O>

    • Field Detail

      • relation

        protected final Relation<O> relation
        The relation we are bound to.
      • k

        protected final int k
        The query k value.
      • distance

        protected final Distance<? super O> distance
        The distance function to be used.
      • distanceQuery

        protected final DistanceQuery<O> distanceQuery
        The distance query we used.
    • Constructor Detail

      • AbstractMaterializeKNNPreprocessor

        public AbstractMaterializeKNNPreprocessor​(Relation<O> relation,
                                                  Distance<? super O> distance,
                                                  int k)
        Constructor.
        Parameters:
        relation - Relation
        distance - Distance function
        k - k
      • AbstractMaterializeKNNPreprocessor

        public AbstractMaterializeKNNPreprocessor​(Relation<O> relation,
                                                  DistanceQuery<O> distanceQuery,
                                                  int k)
        Constructor.
        Parameters:
        relation - Relation
        distanceQuery - Distance query
        k - k
    • Method Detail

      • getDistanceQuery

        public DistanceQuery<O> getDistanceQuery()
        The distance query we used.
        Returns:
        Distance query
      • getK

        public int getK()
        Get the value of 'k' supported by this preprocessor.
        Returns:
        k
      • preprocess

        protected abstract void preprocess()
        Perform the preprocessing step.
      • get

        public KNNList get​(DBIDRef id)
        Get the k nearest neighbors.
        Parameters:
        id - Object ID
        Returns:
        Neighbors
      • createStorage

        void createStorage()
        Create the default storage.
      • initialize

        public void initialize()
        Description copied from interface: Index
        Initialize the index. For static indexes, this is the moment the index is bulk loaded.
        Specified by:
        initialize in interface Index
      • kNNByObject

        @Deprecated
        public KNNSearcher<O> kNNByObject​(DistanceQuery<O> distanceQuery,
                                          int maxk,
                                          int flags)
        Deprecated.
        not possible
        Description copied from interface: KNNIndex
        Get a KNN query object for the given distance query and k.

        This function MAY return null, when the given distance is not supported!

        Specified by:
        kNNByObject in interface KNNIndex<O>
        Parameters:
        distanceQuery - Distance query
        maxk - Maximum value of k
        flags - Hints for the optimizer
        Returns:
        KNN Query object or null
      • kNNByDBID

        public PreprocessorKNNQuery kNNByDBID​(DistanceQuery<O> distQ,
                                              int maxk,
                                              int flags)
        Description copied from interface: KNNIndex
        Get a KNN query object for the given distance query and k.

        This function MAY return null, when the given distance is not supported!

        Specified by:
        kNNByDBID in interface KNNIndex<O>
        Parameters:
        distQ - Distance query
        maxk - Maximum value of k
        flags - Hints for the optimizer
        Returns:
        KNN Query object or null
      • getLogger

        protected abstract Logging getLogger()
        Get the classes static logger.
        Returns:
        Logger