public class DynamicIndexKernelCache extends KernelCache implements Serializable
exampleToStore
parameter. It is the optimal solution when all the pairwise kernel computations
between all the examples in the datasets can be simultaneously stored in cache, but examples IDs
are not consecutive making FixIndexKernelCache not working.
Given a number of examples to store m, the memory occupation is about m*(m+1)/2 floats = m*(m+1)*2B
it uses a Least Recently Used policy when free space is requiredConstructor and Description |
---|
DynamicIndexKernelCache() |
DynamicIndexKernelCache(int examplesToStore)
Initializes a DynamicIndexKernelCache that can contain all the possible pairwise kernel computations
between up to
examplesToStore examples |
Modifier and Type | Method and Description |
---|---|
void |
flushCache()
Empties the cache
|
int |
getExamplesToStore()
Returns the maximum number of examples whose pairwise kernel computations
can be simultaneously stored
|
protected Float |
getStoredKernelValue(Example exA,
Example exB)
Retrieves in the cache the kernel operation between two examples
|
void |
setExamplesToStore(int examplesToStore)
Sets the maximum number of examples whose pairwise kernel computations
can be simultaneously stored
|
void |
setKernelValue(Example exA,
Example exB,
float value)
Stores a kernel computation in cache
|
getCacheHits, getCacheMisses, getKernelValue, resetCacheStats
public DynamicIndexKernelCache(int examplesToStore)
examplesToStore
examplesexamplesToStore
- the maximum number of examples whose pairwise kernel computations
can be simultaneously storedpublic DynamicIndexKernelCache()
public int getExamplesToStore()
public void setExamplesToStore(int examplesToStore)
examplesToStore
- the examplesToStore to set
NOTE: all the already stored kernel computations will be lost
protected Float getStoredKernelValue(Example exA, Example exB)
KernelCache
getStoredKernelValue
in class KernelCache
exA
- the first exampleexB
- the second examplenull<\code> if a cache miss occurs
public void setKernelValue(Example exA, Example exB, float value)
KernelCache
setKernelValue
in class KernelCache
exA
- the first exampleexB
- the second examplevalue
- the kernel value to be stored in cachepublic void flushCache()
KernelCache
flushCache
in class KernelCache
Copyright © 2015 Semantic Analytics Group @ Uniroma2. All rights reserved.