Package elki.similarity
Class FractionalSharedNearestNeighborSimilarity.Instance<T>
- java.lang.Object
-
- elki.similarity.AbstractIndexBasedSimilarity.Instance<T,SharedNearestNeighborIndex<T>>
-
- elki.similarity.FractionalSharedNearestNeighborSimilarity.Instance<T>
-
- Type Parameters:
T
- Object type
- All Implemented Interfaces:
DatabaseSimilarityQuery<T>
,SimilarityQuery<T>
,IndexBasedSimilarity.Instance<T,SharedNearestNeighborIndex<T>>
- Enclosing class:
- FractionalSharedNearestNeighborSimilarity<O>
public static class FractionalSharedNearestNeighborSimilarity.Instance<T> extends AbstractIndexBasedSimilarity.Instance<T,SharedNearestNeighborIndex<T>>
Actual instance for a dataset.- Author:
- Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description private FractionalSharedNearestNeighborSimilarity<? super T>
similarityFunction
Similarity function.-
Fields inherited from class elki.similarity.AbstractIndexBasedSimilarity.Instance
index, relation
-
-
Constructor Summary
Constructors Constructor Description Instance(Relation<T> database, SharedNearestNeighborIndex<T> preprocessor, FractionalSharedNearestNeighborSimilarity<? super T> similarityFunction)
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.Similarity<? super T>
getSimilarity()
Get the inner similarity function.double
similarity(DBIDRef id1, DBIDRef id2)
Returns the similarity between the two objects specified by their object ids.-
Methods inherited from class elki.similarity.AbstractIndexBasedSimilarity.Instance
getIndex, getRelation
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface elki.database.query.similarity.DatabaseSimilarityQuery
similarity, similarity, similarity
-
-
-
-
Field Detail
-
similarityFunction
private FractionalSharedNearestNeighborSimilarity<? super T> similarityFunction
Similarity function.
-
-
Constructor Detail
-
Instance
public Instance(Relation<T> database, SharedNearestNeighborIndex<T> preprocessor, FractionalSharedNearestNeighborSimilarity<? super T> similarityFunction)
Constructor.- Parameters:
database
- Databasepreprocessor
- Preprocessor
-
-
Method Detail
-
countSharedNeighbors
protected static int countSharedNeighbors(DBIDs neighbors1, DBIDs neighbors2)
Compute the intersection size.- Parameters:
neighbors1
- SORTED neighbor ids of firstneighbors2
- SORTED neighbor ids of second- Returns:
- Intersection size
-
similarity
public double similarity(DBIDRef id1, DBIDRef id2)
Description copied from interface:SimilarityQuery
Returns the similarity between the two objects specified by their object ids.- Parameters:
id1
- first object idid2
- second object id- Returns:
- the similarity between the two objects specified by their object ids
-
getSimilarity
public Similarity<? super T> getSimilarity()
Description copied from interface:SimilarityQuery
Get the inner similarity function.- Returns:
- Similarity function
-
-