|
jklustor-overlap-0.0.2-20140619012940 (ChemAxon) |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Objectcom.chemaxon.overlap.bruteforce.UnguardedPagedOverlap<T>
T
- Unguarded form of the descriptorspublic final class UnguardedPagedOverlap<T extends Serializable>
Brute force paged similarity search.
This class is an immutable similarity query engine implementation. The query works on unguarded descriptors for storage and computational efficiency.
Licensing: this class can be used with valid LicenseGlobals.OVERLAP
license.
Nested Class Summary | |
---|---|
(package private) static class |
UnguardedPagedOverlap.SearchMostSimilars<T>
Search multiple pages for most n-most similar structures. |
(package private) static class |
UnguardedPagedOverlap.SearchPage<T>
Search one page of descriptors against a set of queries. |
Field Summary | |
---|---|
static int |
PAGES_GROUP_SIZE_FOR_SINGLE_QUERY
Number of pages to group when processing single query. |
Constructor Summary | |
---|---|
UnguardedPagedOverlap(Function<D,T> extractor,
UnguardedDissimilarityCalculator<T> comparator,
List<ImmutableList<D>> pages,
List<D> page)
Construct new immutable reference from pages of Descriptor instances. |
|
UnguardedPagedOverlap(UnguardedDissimilarityCalculator<T> comparator,
ImmutableList<ImmutableList<T>> pages,
int size)
Construct new immutable reference from prepared storage. |
Method Summary | |
---|---|
ImmutableList<double[]> |
calculateFullMatrix(List<T> queries,
com.chemaxon.calculations.common.SubProgressObserver po,
ExecutorService ex,
boolean managed)
Calculate full dissimilarity matrix. |
KnnResults |
calculateSelfKnn(int k,
int queriesGroup,
com.chemaxon.calculations.common.SubProgressObserver po,
ExecutorService ex)
Brute force find kNN among the contents of the represented descriptors. |
ImmutableList<SimilarityResultNode> |
findMostSimilar(List<T> queries,
com.chemaxon.calculations.common.SubProgressObserver po,
ExecutorService ex)
Brute force find most similar structure for a set of structures. |
SimilarityResults |
findMostSimilar(UnguardedPagedOverlap<T> queries,
int queriesGroup,
com.chemaxon.calculations.common.SubProgressObserver po,
ExecutorService ex)
Brute force find most similar structure for a set of structures. |
ImmutableList<SimilarityResultNode> |
findMostSimilarOnSingleThread(List<T> queries,
com.chemaxon.calculations.common.SubProgressObserver po)
Single threaded reference for multi query most similar lookup. |
SimilarityResultNode |
findMostSimilarOnSingleThread(T query,
com.chemaxon.calculations.common.SubProgressObserver po)
Find most similar for a given query structure. |
ImmutableList<SimilarityResultNode> |
findMostSimilars(T query,
int count,
com.chemaxon.calculations.common.SubProgressObserver po,
ExecutorService ex)
Find most similar structures for a single query. |
ImmutableList<SimilarityResultNode> |
findMostSimilarsOnSingleThread(T query,
com.chemaxon.calculations.common.SubProgressObserver po,
int maxCount)
Find most similars for a given query structure. |
String |
getDescriptorAsString(int index,
boolean recognizeArrays)
Retrieve descriptor as String. |
(package private) UnmodifiableIterator<T> |
iterateDescriptors()
Iterate descriptors. |
(package private) UnmodifiableIterator<ImmutableList<T>> |
iterateDescriptors(int pagesize)
Iterate descriptors. |
int |
size()
Total number of descriptors stored. |
void |
traverse(UnguardedVisitor<T> visitor,
com.chemaxon.calculations.common.SubProgressObserver po)
Traverse storage on single thread. |
UnguardedPagedOverlap<T> |
withComparator(UnguardedDissimilarityCalculator<T> comparator)
Construct another BruteForcePagedSimilarity instance representing a different comparator. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int PAGES_GROUP_SIZE_FOR_SINGLE_QUERY
Constructor Detail |
---|
public UnguardedPagedOverlap(UnguardedDissimilarityCalculator<T> comparator, ImmutableList<ImmutableList<T>> pages, int size)
comparator
- Comparator to be usedpages
- List of pagessize
- Total number of descriptors
chemaxon.license.LicenseException
- when appropriate license is not availablepublic UnguardedPagedOverlap(Function<D,T> extractor, UnguardedDissimilarityCalculator<T> comparator, List<ImmutableList<D>> pages, List<D> page)
Descriptor
instances.
D
- Type of descriptors to transformextractor
- Function
to extract unguarded descriptor content for storagecomparator
- Unguarded comparator to be represented by the constructed instancepages
- List of descriptor pages. This parameter can not be null
.page
- Additional descriptor page, considered as last page. Ignored if null
given.
chemaxon.license.LicenseException
- when appropriate license is not availableMethod Detail |
---|
public UnguardedPagedOverlap<T> withComparator(UnguardedDissimilarityCalculator<T> comparator)
BruteForcePagedSimilarity
instance representing a different comparator.
This operation is memory efficient, since page storage is immutable thus reused.
comparator
- Comparator to be used
public int size()
public void traverse(UnguardedVisitor<T> visitor, com.chemaxon.calculations.common.SubProgressObserver po)
Note that the callback must not modify passed descriptors.
visitor
- Callback to invokepo
- ProgressObserver to track progress. Upon completion SubProgressObserver.done()
will be invoked.UnmodifiableIterator<T> iterateDescriptors()
UnmodifiableIterator<ImmutableList<T>> iterateDescriptors(int pagesize)
pagesize
- Number of descriptors to page together
public String getDescriptorAsString(int index, boolean recognizeArrays)
This operation is recommended for debug only. Execution might be slow.
index
- Index of descriptorrecognizeArrays
- Recognize arrays and traverse its elements
public ImmutableList<SimilarityResultNode> findMostSimilars(T query, int count, com.chemaxon.calculations.common.SubProgressObserver po, ExecutorService ex)
This method utilizes concurrent execution and blocks until completion. ProgressObserver callback is invoked from the calling thread only.
\
query
- Query descriptorcount
- Number of expected most similar structurespo
- ProgressObserver to track progress. Upon completion SubProgressObserver.done()
will be invoked.ex
- ExecutorService to run workers
CancellationException
- when cancelled through supplied progress observerpublic ImmutableList<double[]> calculateFullMatrix(List<T> queries, com.chemaxon.calculations.common.SubProgressObserver po, ExecutorService ex, boolean managed)
Calculate full dissimilarity matrix between the represented targets and the given queries. Note that the resulting matrix might have be excessively large size.
The resulting structure is allocated upon startup.
queries
- Query descriptorspo
- ProgressObserver to track progress. Upon completion SubProgressObserver.done()
will be invoked.ex
- ExecutorService to run workersmanaged
- if true, use JMX for monitoring
i
will contain the dissimilarity vector
for query i
. The dissimilarity vector contains the dissimilarities of targets. *
CancellationException
- when cancelled through supplied progress observer
IllegalStateException
- possible exceptions due to JMX connection are wrapped to
IllegalStateException
public KnnResults calculateSelfKnn(int k, int queriesGroup, com.chemaxon.calculations.common.SubProgressObserver po, ExecutorService ex) throws ExecutionException
k
- Number of nearest neighbors to findqueriesGroup
- Number of queries to grouppo
- ProgressObserver to track progress.ex
- ExecutorService to run workers. Upon completion SubProgressObserver.done()
will be invoked.
ExecutionException
- Re-theownpublic SimilarityResults findMostSimilar(UnguardedPagedOverlap<T> queries, int queriesGroup, com.chemaxon.calculations.common.SubProgressObserver po, ExecutorService ex)
For each query index the most similar target index is recorded.
queries
- Query descriptorsqueriesGroup
- Number of queries to grouppo
- ProgressObserver to track progress. Upon completion SubProgressObserver.done()
will be invoked.ex
- ExecutorService to run workers
public ImmutableList<SimilarityResultNode> findMostSimilar(List<T> queries, com.chemaxon.calculations.common.SubProgressObserver po, ExecutorService ex)
This method utilizes concurrent execution and blocks until completion. ProgressObserver callback is invoked from the calling thread only.
Note that when the best dissimiliraty score is associated for multiple queries one of them is picked. The selection in this case is non deterministic.
queries
- Query descriptors (in the unguarded form)po
- ProgressObserver to track progress. Upon completion SubProgressObserver.done()
will be invoked.ex
- ExecutorService to run workers
CancellationException
- when cancelled through supplied progress observerpublic ImmutableList<SimilarityResultNode> findMostSimilarOnSingleThread(List<T> queries, com.chemaxon.calculations.common.SubProgressObserver po) throws CancellationException
queries
- Queries to searchpo
- Observer; will be closed upon finish/abort/error. One work unit is assigned to one comparison.
CancellationException
- When cancelled through supplied progress observerpublic SimilarityResultNode findMostSimilarOnSingleThread(T query, com.chemaxon.calculations.common.SubProgressObserver po) throws CancellationException
This method is intended only for test/diagnostincs. Users of this API usually need to invoke
findMostSimilar(java.util.List, com.chemaxon.calculations.common.SubProgressObserver, java.util.concurrent.ExecutorService)
instead.
This method blocks until ready and uses a single (the calling) thread to do the calculation.
query
- Query descriptorpo
- Progress observer to track progress. Completion is reported by invoking
SubProgressObserver.done()
upon completion, cancellation or error
CancellationException
- upon cancellation through the given progress observerpublic ImmutableList<SimilarityResultNode> findMostSimilarsOnSingleThread(T query, com.chemaxon.calculations.common.SubProgressObserver po, int maxCount) throws CancellationException
This method is intended only for test/diagnostincs. Users of this API usually need to invoke
findMostSimilar(java.util.List, com.chemaxon.calculations.common.SubProgressObserver, java.util.concurrent.ExecutorService)
instead.
This method blocks until ready and uses a single (the calling) thread to do the calculation.
query
- Query descriptorpo
- Progress observer to track progress. Completion is reported by invoking
SubProgressObserver.done()
upon completion, cancellation or errormaxCount
- Max results count
CancellationException
- upon cancellation through the given progress observer
|
jklustor-overlap-0.0.2-20140619012940 (ChemAxon) |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |