|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.obsearch.index.AbstractOBIndex<O>
net.obsearch.index.pivot.AbstractPivotOBIndex<O>
net.obsearch.index.bucket.AbstractBucketIndex<O,B,Q,BC>
net.obsearch.index.sorter.AbstractBucketSorter<O,B,Q,BC,P,CP>
public abstract class AbstractBucketSorter<O extends OB,B extends BucketObject<O>,Q,BC extends BucketContainer<O,B,Q>,P extends Projection<P,CP>,CP>
Nested Class Summary |
---|
Nested classes/interfaces inherited from class net.obsearch.index.bucket.AbstractBucketIndex |
---|
AbstractBucketIndex.BucketIterator |
Field Summary | |
---|---|
protected OBCacheByteArray<BC> |
bucketCache
Cache used for storing buckets |
protected int |
bucketPivotCount
Pivot count for each bucket. |
protected hep.aida.bin.StaticBin1D[] |
kEstimators
Estimators for k ranges. |
protected List<CP> |
projections
We keep here the projections. |
protected OBStoreLong |
projectionStorage
We keep the projection list |
protected int[] |
userK
K configuration that will be used by the user. |
Fields inherited from class net.obsearch.index.bucket.AbstractBucketIndex |
---|
Buckets |
Fields inherited from class net.obsearch.index.pivot.AbstractPivotOBIndex |
---|
intrinsicDimensionalityPairs, pivots, pivotSelector |
Fields inherited from class net.obsearch.index.AbstractOBIndex |
---|
A, fact, isFrozen, stats, type |
Fields inherited from interface net.obsearch.Index |
---|
ID_SIZE |
Constructor Summary | |
---|---|
AbstractBucketSorter()
|
|
AbstractBucketSorter(Class type,
IncrementalPivotSelector pivotSelector,
int pivotCount,
int bucketPivotCount)
|
Method Summary | |
---|---|
void |
bucketStats()
|
protected abstract CP |
bytesToCompactRepresentation(byte[] data)
|
protected void |
calculateEstimators()
Calculate the estimators. |
void |
close()
Closes the database. |
protected abstract byte[] |
compactRepresentationToBytes(CP cp)
|
int |
estimateK(int queryK)
Estimate the k needed for a k-nn query. |
protected void |
freezeDefault()
|
byte[] |
getAddress(B bucket)
Gets the byte address of the given object |
List<O> |
getAllObjects()
Returns a list of all the objects of this index. |
protected BC |
getBucketContainer(byte[] id)
|
int |
getBucketPivotCount()
|
protected abstract int |
getCPSize()
Return the compact representation size |
double |
getExpectedEP()
|
protected abstract AbstractOBQuery<O> |
getKQuery(O object,
int k)
Returns a k query for the given object. |
int[] |
getMaxK()
|
protected abstract Class<CP> |
getPInstance()
|
protected abstract P |
getProjection(B b)
|
void |
init(OBStoreFactory fact)
Initialize the index. |
protected void |
initByteArrayBuckets()
Initializes the bucket byte array storage. |
protected void |
initCache()
Initializes the object cache AbstractOBIndex.aCache . |
protected OperationStatus |
insertBucket(B b,
O object)
Stores the given bucket b into the AbstractBucketIndex.Buckets storage device. |
protected OperationStatus |
insertBucketBulk(B b,
O object)
Stores the given bucket b into the AbstractBucketIndex.Buckets storage device. |
protected void |
loadMasks()
Load the masks from the storage device into memory. |
protected void |
maxKEstimation()
Sort all masks, and then start the search until the CompoundError is less than some threshold. |
protected abstract void |
maxKEstimationAux(O object)
Estimate ks for the given query object and the given list of objects. |
protected String |
printEstimation(int i)
|
protected List<P> |
searchBuckets(P query,
int maxF)
Search the f closest buckets to the given query. |
void |
setExpectedError(double ep)
Set the expected NN error |
void |
setKAlpha(float kAlpha)
For a query k we take the kEstimators[k] estimation and return the value kEstimators[k].mean() + (kEstimators[k].stdDev() * kAlpha) This method sets kAlpha. |
void |
setMaxK(int[] maxK)
Set the k values used by this index. |
void |
setSampleSize(int size)
Set the sample size of the estimation |
protected abstract void |
updateDistance(P query,
CP proj,
FixedPriorityQueue<P> queue)
Calculates the distance between a query and some projection |
Methods inherited from class net.obsearch.index.bucket.AbstractBucketIndex |
---|
debug, deleteAux, exists, getBucket, getBuckets, getObjectFreeze, idMap, insertAux, insertAuxBulk, instantiateBucketContainer, iterateBuckets, primitiveDataTypeSize |
Methods inherited from class net.obsearch.index.pivot.AbstractPivotOBIndex |
---|
calculateIntrinsicDimensionality, createPivotsArray, freeze, getObjects, getPivotCount, selectPivots |
Methods inherited from class net.obsearch.index.AbstractOBIndex |
---|
assertFrozen, bytesToObject, bytesToObject, clearACache, databaseSize, delete, distance, emptyPivotsArray, findAux, getBox, getObject, getStats, getType, initStorageDevices, insert, insert, insertBulk, insertBulk, intrinsicDimensionality, isFrozen, isPreFreeze, isPreFreezeCheck, loadObject, loadPivots, objectToByteBuffer, objectToBytes, resetStats, serializePivots, setFixedRecord, setFixedRecord, setIdAutoGeneration, setPreFreeze, setPreFreezeCheck, totalBoxes |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected hep.aida.bin.StaticBin1D[] kEstimators
protected int[] userK
protected transient OBStoreLong projectionStorage
protected transient List<CP> projections
protected transient OBCacheByteArray<BC extends BucketContainer<O,B,Q>> bucketCache
protected int bucketPivotCount
Constructor Detail |
---|
public AbstractBucketSorter(Class type, IncrementalPivotSelector pivotSelector, int pivotCount, int bucketPivotCount) throws OBStorageException, OBException
OBStorageException
OBException
public AbstractBucketSorter()
Method Detail |
---|
public void setKAlpha(float kAlpha)
kAlpha
- new kAlpha to set.public void setMaxK(int[] maxK)
userK
- public void setSampleSize(int size)
size
- the new sizepublic byte[] getAddress(B bucket) throws OBException
AbstractBucketIndex
getAddress
in class AbstractBucketIndex<O extends OB,B extends BucketObject<O>,Q,BC extends BucketContainer<O,B,Q>>
OBException
protected abstract P getProjection(B b) throws OBException
OBException
protected abstract byte[] compactRepresentationToBytes(CP cp)
protected abstract CP bytesToCompactRepresentation(byte[] data)
protected abstract Class<CP> getPInstance()
protected void loadMasks() throws OBException
OBException
protected abstract void updateDistance(P query, CP proj, FixedPriorityQueue<P> queue)
query
- protected List<P> searchBuckets(P query, int maxF) throws InstantiationException, IllegalAccessException, OBException
query
- the query to employmaxF
- the max number of items that will be returned
InstantiationException
IllegalAccessException
OBException
public void init(OBStoreFactory fact) throws OBStorageException, OBException, InstantiationException, IllegalAccessException
AbstractOBIndex
init
in interface Index<O extends OB>
init
in class AbstractBucketIndex<O extends OB,B extends BucketObject<O>,Q,BC extends BucketContainer<O,B,Q>>
fact
- The storage factory that will be used to store the data.
OBStorageException
- If something goes wrong with the DB
OBException
- User generated exception
NotFrozenException
- if the index has not been frozen.
InstantiationException
- If there is a problem when instantiating objects O
IllegalAccessException
- If there is a problem when instantiating objects Oprotected BC getBucketContainer(byte[] id) throws OBException, InstantiationException, IllegalAccessException
getBucketContainer
in class AbstractBucketIndex<O extends OB,B extends BucketObject<O>,Q,BC extends BucketContainer<O,B,Q>>
OBException
InstantiationException
IllegalAccessException
protected void initByteArrayBuckets() throws OBException
AbstractBucketIndex
initByteArrayBuckets
in class AbstractBucketIndex<O extends OB,B extends BucketObject<O>,Q,BC extends BucketContainer<O,B,Q>>
OBException
protected abstract int getCPSize()
public void setExpectedError(double ep)
ep
- CompoundError value.protected void calculateEstimators() throws IllegalIdException, OBException, IllegalAccessException, InstantiationException
IllegalIdException
OBException
IllegalAccessException
InstantiationException
protected void maxKEstimation() throws IllegalIdException, OBException, IllegalAccessException, InstantiationException
IllegalIdException
OBException
IllegalAccessException
InstantiationException
protected String printEstimation(int i)
protected OperationStatus insertBucket(B b, O object) throws OBStorageException, IllegalIdException, IllegalAccessException, InstantiationException, OutOfRangeException, OBException
AbstractBucketIndex.Buckets
storage device. The
given bucket b should have been returned by #getBucket(OB, int)
insertBucket
in class AbstractBucketIndex<O extends OB,B extends BucketObject<O>,Q,BC extends BucketContainer<O,B,Q>>
b
- The bucket in which we will insert the object.object
- The object to insert.
OBStorageException
IllegalIdException
IllegalAccessException
InstantiationException
OutOfRangeException
OBException
protected OperationStatus insertBucketBulk(B b, O object) throws OBStorageException, IllegalIdException, IllegalAccessException, InstantiationException, OutOfRangeException, OBException
AbstractBucketIndex.Buckets
storage device. The
given bucket b should have been returned by #getBucket(OB, int)
No checks are performed, we simply add the objects believing they are
unique.
insertBucketBulk
in class AbstractBucketIndex<O extends OB,B extends BucketObject<O>,Q,BC extends BucketContainer<O,B,Q>>
b
- The bucket in which we will insert the object.object
- The object to insert.
OBStorageException
IllegalIdException
IllegalAccessException
InstantiationException
OutOfRangeException
OBException
protected void freezeDefault() throws AlreadyFrozenException, IllegalIdException, IllegalAccessException, InstantiationException, OutOfRangeException, OBException
freezeDefault
in class AbstractBucketIndex<O extends OB,B extends BucketObject<O>,Q,BC extends BucketContainer<O,B,Q>>
AlreadyFrozenException
IllegalIdException
IllegalAccessException
InstantiationException
OutOfRangeException
OBException
public void close() throws OBException
Index
close
in interface Index<O extends OB>
close
in class AbstractBucketIndex<O extends OB,B extends BucketObject<O>,Q,BC extends BucketContainer<O,B,Q>>
OBStorageException
- If something goes wrong with the DB.
OBException
protected abstract AbstractOBQuery<O> getKQuery(O object, int k) throws OBException, InstantiationException, IllegalAccessException
object
- (query object)k
- the number of objects to accept in the query.
IllegalAccessException
InstantiationException
OBException
public List<O> getAllObjects() throws IllegalIdException, IllegalAccessException, InstantiationException, OBException
OBException
InstantiationException
IllegalAccessException
IllegalIdException
protected void initCache() throws OBException
AbstractOBIndex
AbstractOBIndex.aCache
.
initCache
in class AbstractOBIndex<O extends OB>
OBException
protected abstract void maxKEstimationAux(O object) throws OBException, InstantiationException, IllegalAccessException
object
- objects
-
OBException
InstantiationException
IllegalAccessException
public int estimateK(int queryK) throws OBException
queryK
- k of the k-nn query.
OBException
public int[] getMaxK()
public double getExpectedEP()
public int getBucketPivotCount()
public void bucketStats() throws OBStorageException, IllegalIdException, IllegalAccessException, InstantiationException, OBException
bucketStats
in class AbstractBucketIndex<O extends OB,B extends BucketObject<O>,Q,BC extends BucketContainer<O,B,Q>>
OBStorageException
IllegalIdException
IllegalAccessException
InstantiationException
OBException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |