|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.fu_berlin.ties.classify.winnow.WinnowStore
public class WinnowStore
Feature store used by Winnow
. Controls the number of stored
features and implements pruning based on the LRU (least recently used)
principle.
Instances of this class are synchronized externally by Winnow.
Constructor Summary | |
---|---|
WinnowStore(float initialWeight,
int featureNum,
int candidates,
int pruneNum)
Creates a new instance. |
|
WinnowStore(float initialWeight,
TiesConfiguration config,
String configSuffix)
Creates a new instance. |
Method Summary | |
---|---|
float[] |
getWeights(Integer featureHash)
Returns the weights of a feature. |
int |
maxSize()
Returns the maximum number of features that can be stored by this instance. |
void |
putWeights(Integer featureHash,
float[] weights)
Stores new weights for a feature. |
void |
reset()
Resets the store, completely deleting the prediction model. |
int |
size()
Returns the number of features currently stored by this instance. |
Map.Entry[] |
sortForPruning(Map.Entry[] candidates)
Sorts an array of map entries that are candidates for being pruned (deleted). This implementation sorts the candidate by the deviation of their weights from the initial weights, so candidates with lower deviation will be pruned first. |
String |
toString()
Returns a string representation of this object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public WinnowStore(float initialWeight, TiesConfiguration config, String configSuffix)
initialWeight
- The initial weight of each feature -- this
implementation prunes features whose weights deviate least from this
initial weightconfig
- Used to configure this instanceconfigSuffix
- Optional suffix appended to the configuration keys
when configuring this instance; might be null
public WinnowStore(float initialWeight, int featureNum, int candidates, int pruneNum)
initialWeight
- The initial weight of each feature -- this
implementation prunes features whose weights deviate least from this
initial weightfeatureNum
- The number of features to storecandidates
- The number of candidates to consider for each pruning
operationpruneNum
- The number of elements to remove by each pruning
operation, must not be larger than candidates
Method Detail |
---|
public float[] getWeights(Integer featureHash)
featureHash
- The hash code integer identifying the feature
public int maxSize()
public void putWeights(Integer featureHash, float[] weights)
featureHash
- The hash code integer identifying the featureweights
- The new weights of this featurepublic void reset()
public int size()
public Map.Entry[] sortForPruning(Map.Entry[] candidates)
sortForPruning
in interface Pruner
candidates
- an array of entries to be considered as candidates for
pruning
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |