public class FixSizeKernelCache extends KernelCache implements Serializable
examplesToStore
parameter.
Once the cache is initialized, its dimension is immutable.
The memory occupation is about k*(k+1)/2 floats.
It uses a Least Recently Used policy when free space is required.Constructor and Description |
---|
FixSizeKernelCache() |
FixSizeKernelCache(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 FixSizeKernelCache(int examplesToStore)
examplesToStore
examplesexamplesToStore
- the maximum number of examples whose pairwise kernel computations
can be simultaneously storedpublic FixSizeKernelCache()
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
if a cache miss occurspublic 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 © 2018 Semantic Analytics Group @ Uniroma2. All rights reserved.