Package elki.similarity
Class SharedNearestNeighborSimilarity<O>
- java.lang.Object
-
- elki.similarity.AbstractIndexBasedSimilarity<O,SharedNearestNeighborIndex.Factory<O>>
-
- elki.similarity.SharedNearestNeighborSimilarity<O>
-
- Type Parameters:
O
- object type
- All Implemented Interfaces:
IndexBasedSimilarity<O>
,Similarity<O>
public class SharedNearestNeighborSimilarity<O> extends AbstractIndexBasedSimilarity<O,SharedNearestNeighborIndex.Factory<O>>
SharedNearestNeighborSimilarity with a pattern defined to accept Strings that define a non-negative Integer.- Since:
- 0.1
- Author:
- Arthur Zimek
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SharedNearestNeighborSimilarity.Instance<O>
Instance for a particular database.
-
Field Summary
-
Fields inherited from class elki.similarity.AbstractIndexBasedSimilarity
indexFactory
-
-
Constructor Summary
Constructors Constructor Description SharedNearestNeighborSimilarity(SharedNearestNeighborIndex.Factory<O> indexFactory)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static int
countSharedNeighbors(DBIDs neighbors1, DBIDs neighbors2)
Compute the intersection size<T extends O>
SharedNearestNeighborSimilarity.Instance<T>instantiate(Relation<T> database)
Preprocess the database to get the actual distance function.-
Methods inherited from class elki.similarity.AbstractIndexBasedSimilarity
getInputTypeRestriction, isSymmetric
-
-
-
-
Constructor Detail
-
SharedNearestNeighborSimilarity
public SharedNearestNeighborSimilarity(SharedNearestNeighborIndex.Factory<O> indexFactory)
Constructor.- Parameters:
indexFactory
- Index factory.
-
-
Method Detail
-
countSharedNeighbors
protected static int countSharedNeighbors(DBIDs neighbors1, DBIDs neighbors2)
Compute the intersection size- Parameters:
neighbors1
- SORTED neighbors of firstneighbors2
- SORTED neighbors of second- Returns:
- Intersection size
-
instantiate
public <T extends O> SharedNearestNeighborSimilarity.Instance<T> instantiate(Relation<T> database)
Description copied from interface:IndexBasedSimilarity
Preprocess the database to get the actual distance function.- Specified by:
instantiate
in interfaceIndexBasedSimilarity<O>
- Specified by:
instantiate
in interfaceSimilarity<O>
- Specified by:
instantiate
in classAbstractIndexBasedSimilarity<O,SharedNearestNeighborIndex.Factory<O>>
- Parameters:
database
- Representation to use- Returns:
- Actual distance query.
-
-