net.siefkes.nlstego.predict
Class PredictionManager

java.lang.Object
  extended by net.siefkes.nlstego.predict.PredictionManager

public final class PredictionManager
extends Object

Manages the predictions of items, combining different prediction models.

Created (26.11.2001 09:32:34).

Version:
$Revision: 1.9 $, $Date: 2005/07/12 17:02:17 $, $Author: siefkes $
Author:
Christian Siefkes

Constructor Summary
PredictionManager(Configuration conf)
          Creates a new instance.
 
Method Summary
 void addItem(String key, boolean train)
          Registers an actual request.
 List<PredictedToken> choosePredictions()
          Delegates to choosePredictions(int), setting the number of predictions to return to getNumberOfPredictions().
 List<PredictedToken> choosePredictions(int number)
          Selects the most valuable predictions.
 int getID()
          Returns the unique ID of this instance.
 double getMinProbability()
          A standard get*().
 Iterator<FetchStats> getPredictionModelList()
          Returns an iterator over the registered prediction models.
 String printModelStats()
          Prints statistical information about the used models.
 void registerPredictionModel(FetchStats model)
          Registers a prediction model with this prediction manager.
 String toString()
          Returns a String that represents the value of this object.
 boolean unregisterPredictionModel(FetchStats model)
          Unregisters a prediction model from this prediction manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PredictionManager

public PredictionManager(Configuration conf)
Creates a new instance.

Created (26.11.2001 09:34:51) by Christian Siefkes.

Parameters:
conf - the Configuration to use
Method Detail

choosePredictions

public List<PredictedToken> choosePredictions()
                                       throws IllegalStateException,
                                              ConcurrentModificationException
Delegates to choosePredictions(int), setting the number of predictions to return to getNumberOfPredictions().

Returns:
a list of PredictedTokens with the most valuable predictions; will have between 0 (if no more predictions with the minimum probability exist) and getNumberOfPredictions() elements; sorted according to their probability
Throws:
IllegalStateException - if this method was called but there are no registered prediction models
ConcurrentModificationException - might be thrown if prediction models are (un)registered during a call to this method

choosePredictions

public List<PredictedToken> choosePredictions(int number)
                                       throws IllegalStateException,
                                              ConcurrentModificationException
Selects the most valuable predictions. For performance reasons, this method is not synchronized so you are not allowed to register or unregister prediction models during a call to this method.

Created (26.11.2001 09:53:36) by Christian Siefkes.

Parameters:
number - the number of predictions to return
Returns:
a list of PredictedTokens with the most valuable predictions; will have between 0 (if no more predictions with the minimum probability exist) and number elements; sorted according to their probability
Throws:
IllegalStateException - if this method was called but there are no registered prediction models
ConcurrentModificationException - might be thrown if prediction models are (un)registered during a call to this method
See Also:
registerPredictionModel(FetchStats), unregisterPredictionModel(FetchStats)

getMinProbability

public double getMinProbability()
A standard get*().

Created (04.10.2001 16:56:09) by Christian Siefkes.

Returns:
the value of the attribute

addItem

public void addItem(String key,
                    boolean train)
             throws IllegalStateException,
                    ConcurrentModificationException
Registers an actual request. The predictions of this model are removed. After calling this method you can call updatePredictions to add new ones. For performance reasons, this method is not synchronized so you are not allowed to register or unregister prediction models during a call to this method.

Created (03.01.2002 14:02:41) by Christian Siefkes.

Parameters:
key - the key of the item currently requested
train - true iff the models should be trained, i.e. this request should be incorporated into the prediction models; otherwise only the internal state of the models will be changed so the next call to choosePredictions(int) will find suitable predictions (this happens in any case)
Throws:
IllegalStateException - if this method was called but there are no registered prediction models
ConcurrentModificationException - might be thrown if prediction models are (un)registered during a call to this method
See Also:
registerPredictionModel(FetchStats), unregisterPredictionModel(FetchStats)

toString

public String toString()
Returns a String that represents the value of this object.

Created (04.10.2001 17:42:12) by Christian Siefkes.

Overrides:
toString in class Object
Returns:
a string representation of the receiver

getPredictionModelList

public Iterator<FetchStats> getPredictionModelList()
Returns an iterator over the registered prediction models. All elements in the iterator are guaranteed to be FetchStats.

Returns:
an iterator over the models

printModelStats

public String printModelStats()
Prints statistical information about the used models. This method might take some time while the data is gathered.

Returns:
a string listing statistical details about the used models

registerPredictionModel

public void registerPredictionModel(FetchStats model)
Registers a prediction model with this prediction manager.

Parameters:
model - the model to register

unregisterPredictionModel

public boolean unregisterPredictionModel(FetchStats model)
Unregisters a prediction model from this prediction manager.

Parameters:
model - the model to unregister
Returns:
whether the model was successfully unregistered (i.e. whether it has been registered before)

getID

public int getID()
Returns the unique ID of this instance.

Returns:
the ID


Copyright © 2003-2005 Christian Siefkes. All Rights Reserved.