net.siefkes.nlstego.predict
Class FetchStats

java.lang.Object
  extended by net.siefkes.nlstego.predict.FetchStats
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
PPMFetchStats

public abstract class FetchStats
extends Object
implements Serializable

Abstract class for collecting statistics about the fetching of items that can be used for predicting.

Created (11.09.2001 16:35:54).

Version:
$Revision: 1.8 $, $Date: 2005/07/28 15:03:09 $, $Author: siefkes $
Author:
Christian Siefkes
See Also:
Serialized Form

Field Summary
protected static Integer END_OF_SESSION
          Constant used to mark the end of a session.
protected static Integer START_OF_SESSION
          Constant used to mark the start of a session.
 
Constructor Summary
protected FetchStats(Configuration conf, StatelessFilter filter)
          Creates a new instance.
 
Method Summary
 void add(String key, int sessionID)
          Adds a request of an item, training the model.
abstract  void add(String key, int sessionID, boolean train)
          Adds a request of an item.
 int getID()
          Returns the unique ID of this instance.
 Integer getIDInteger()
          Returns the unique ID of this instance as an Integer object, for easy storage in collections etc..
 StatelessFilter getStatelessFilter()
          Returns the optional filter that decides which predictions should be stored in the stateless (global) model; if null, all predictions are stored.
static Integer mapKey(String key)
          Maps the key used to identify a document to a compact representation used for storing it in the FetchStats.
abstract  SortedMap predict(int number, int sessionID)
          Predicts the documents that will be probably fetched next.
abstract  String printModelStats()
          Prints statistical information about this model.
abstract  void sessionEnded(int sessionID)
          Marks a session as ended.
 void shutdown(boolean requestgraceful)
          Shuts down this entity.
static String unmapKey(int representation)
          Maps the key used to identify an item to a compact representation used for storing it in the FetchStats.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

START_OF_SESSION

protected static final Integer START_OF_SESSION
Constant used to mark the start of a session.

Created (27.09.2001 12:11:47) by Christian Siefkes.


END_OF_SESSION

protected static final Integer END_OF_SESSION
Constant used to mark the end of a session.

Created (01.10.2001 10:53:53) by Christian Siefkes.

Constructor Detail

FetchStats

protected FetchStats(Configuration conf,
                     StatelessFilter filter)
Creates a new instance.

Created (11.09.2001 16:35:54) by Christian Siefkes.

Parameters:
conf - the Configuration to use
filter - optional filter that decides which predictions should be stored in the stateless (global) model; if null, all predictions are stored
Method Detail

add

public final void add(String key,
                      int sessionID)
Adds a request of an item, training the model.

Created (27.09.2001 12:16:43) by Christian Siefkes.

Parameters:
key - the key of the item currently requested fetching the last document in this session
sessionID - the ID of the current session (must be unique among all sessions parallel in progress)

add

public abstract void add(String key,
                         int sessionID,
                         boolean train)
Adds a request of an item.

Created (27.09.2001 12:16:43) by Christian Siefkes.

Parameters:
key - the key of the item currently requested fetching the last document in this session
sessionID - the ID of the current session (must be unique among all sessions parallel in progress)
train - true iff the model should be trained, i.e. this request should be incorporated into the prediction model; otherwise only the internal state will be changed so the next call to predict(int, int) will find suitable predictions (this happens in any case)

mapKey

public static Integer mapKey(String key)
Maps the key used to identify a document to a compact representation used for storing it in the FetchStats.

Created (27.09.2001 15:20:15) by Christian Siefkes.

Parameters:
key - the key of the document (the URL's external form)
Returns:
a compact and unique representation of this key

predict

public abstract SortedMap predict(int number,
                                  int sessionID)
Predicts the documents that will be probably fetched next.

Created (27.09.2001 12:16:43) by Christian Siefkes.

Parameters:
number - the number of results to return, >0
sessionID - the ID of the current session (must be unique among all sessions parallel in progress)
Returns:
a SortedMap containing mapped keys as keys and FetchStatsResult's as values. The length of the map is max (number, all matching documents that had at least minAccesses)

sessionEnded

public abstract void sessionEnded(int sessionID)
Marks a session as ended.

Created (27.09.2001 12:16:43) by Christian Siefkes.

Parameters:
sessionID - the ID of the current session (must be unique among all sessions parallel in progress)

shutdown

public void shutdown(boolean requestgraceful)
Shuts down this entity. The intention is to free all resources occupied by this entity and shut down all other entities that belong to this one.

Created (04.03.2002 11:31:28) by Christian Siefkes.

Parameters:
requestgraceful - a boolean; if set to true the entity should wait for its current activity to stop and then shutdown, if set to false it shuts down immediately

printModelStats

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

Returns:
a string listing statistical details about this model

unmapKey

public static String unmapKey(int representation)
                       throws IndexOutOfBoundsException
Maps the key used to identify an item to a compact representation used for storing it in the FetchStats.

Created (27.09.2001 15:20:15) by Christian Siefkes.

Parameters:
representation - the compact integer representation of a key which must have been mapped before by mapKey
Returns:
the represented key
Throws:
IndexOutOfBoundsException - if the key wasn't mapped before

getID

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

Returns:
the ID

getIDInteger

public final Integer getIDInteger()
Returns the unique ID of this instance as an Integer object, for easy storage in collections etc..

Returns:
the ID Integer object

getStatelessFilter

public StatelessFilter getStatelessFilter()
Returns the optional filter that decides which predictions should be stored in the stateless (global) model; if null, all predictions are stored.

Returns:
the value of the attribute


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