public class DynamicIndexSquaredNormCache extends Object implements SquaredNormCache
Constructor and Description |
---|
DynamicIndexSquaredNormCache() |
DynamicIndexSquaredNormCache(int examplesToStore)
Initializes a DynamicIndexSquaredNormCache that can contain all up to
examplesToStore norms |
Modifier and Type | Method and Description |
---|---|
void |
flush()
Empties the cache
|
int |
getExamplesToStore()
Returns the maximum number of norms that
can be simultaneously stored
|
Float |
getSquaredNorm(Example example)
Returns a previously stored norm of a given example
|
void |
setExamplesToStore(int examplesToStore)
Sets the maximum number of norms that
can be simultaneously stored
|
void |
setSquaredNormValue(Example example,
float squaredNorm)
Stores a squared norm in the cache
|
public DynamicIndexSquaredNormCache(int examplesToStore)
examplesToStore
normsexamplesToStore
- the maximum number of norms that
can be simultaneously storedpublic DynamicIndexSquaredNormCache()
public int getExamplesToStore()
public void setExamplesToStore(int examplesToStore)
examplesToStore
- the examplesToStore to set
NOTE: all the already stored norms will be lost
public Float getSquaredNorm(Example example)
SquaredNormCache
getSquaredNorm
in interface SquaredNormCache
example
- the instance whose squared norm is requirednull
if a cache miss occurspublic void setSquaredNormValue(Example example, float squaredNorm)
SquaredNormCache
setSquaredNormValue
in interface SquaredNormCache
example
- the example whose quadratic norm must be storedsquaredNorm
- the squared norm to be storedpublic void flush()
SquaredNormCache
flush
in interface SquaredNormCache
Copyright © 2018 Semantic Analytics Group @ Uniroma2. All rights reserved.