
O - the type of database objects the preprocessor can be applied toD - the type of distance the used distance function will return@Title(value="Shared nearest neighbor Preprocessor") @Description(value="Computes the k nearest neighbors of objects of a certain database.") public class SharedNearestNeighborPreprocessor<O,D extends Distance<D>> extends AbstractPreprocessorIndex<O,ArrayDBIDs> implements SharedNearestNeighborIndex<O>
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.| Modifier and Type | Class and Description | 
|---|---|
| static class  | SharedNearestNeighborPreprocessor.Factory<O,D extends Distance<D>>Factory class | 
| Modifier and Type | Field and Description | 
|---|---|
| protected DistanceFunction<O,D> | distanceFunctionHold the distance function to be used. | 
| private static Logging | LOGGet a logger for this class. | 
| protected int | numberOfNeighborsHolds the number of nearest neighbors to be used. | 
storagerelation| Constructor and Description | 
|---|
| SharedNearestNeighborPreprocessor(Relation<O> relation,
                                 int numberOfNeighbors,
                                 DistanceFunction<O,D> distanceFunction)Constructor. | 
| Modifier and Type | Method and Description | 
|---|---|
| protected Logging | getLogger()Get the classes static logger. | 
| String | getLongName()A "pretty" name for the result, for use in titles, captions and menus. | 
| ArrayDBIDs | getNearestNeighborSet(DBIDRef objid)Get the precomputed nearest neighbors | 
| int | getNumberOfNeighbors()Get the number of neighbors | 
| String | getShortName()A short name for the result, useful for file names. | 
| protected void | preprocess()Preprocessing step. | 
delete, deleteAll, getPageFileStatistics, insert, insertAllprivate static final Logging LOG
protected int numberOfNeighbors
protected DistanceFunction<O,D extends Distance<D>> distanceFunction
public SharedNearestNeighborPreprocessor(Relation<O> relation, int numberOfNeighbors, DistanceFunction<O,D> distanceFunction)
relation - Database to usenumberOfNeighbors - Number of neighborsdistanceFunction - Distance functionprotected void preprocess()
public ArrayDBIDs getNearestNeighborSet(DBIDRef objid)
SharedNearestNeighborIndexgetNearestNeighborSet in interface SharedNearestNeighborIndex<O>objid - Object IDprotected Logging getLogger()
AbstractPreprocessorIndexgetLogger in class AbstractPreprocessorIndex<O,ArrayDBIDs>public String getLongName()
ResultgetLongName in interface ResultgetLongName in class AbstractIndex<O>public String getShortName()
ResultgetShortName in interface ResultgetShortName in class AbstractIndex<O>public int getNumberOfNeighbors()
getNumberOfNeighbors in interface SharedNearestNeighborIndex<O>