ostore.oil
Interface Model

All Superinterfaces:
QuickSerializable
All Known Subinterfaces:
ContinuousModel, SegmentedModel
All Known Implementing Classes:
HMM, Screen, SemanticDistanceModel

public interface Model
extends QuickSerializable

An interface for introspective models. A Model can observe QuickSerializable objects, estimating their likelihood based on an internal learning model and updating that model based on those observations. Predictions may be estimates of the current state of a simple model, or a confidence-weighted guess for future observations, depending on the particular Model.

Version:
$Id: Model.java,v 1.11 2002/07/22 20:54:53 srhea Exp $
Author:
Dennis Geels
See Also:
SegmentedModel, HMM

Nested Class Summary
static interface Model.Delta
          A summary of the knowledge learned by a Model.
static interface Model.Prediction
          A summary of the current state predicted by the Model.
 
Method Summary
 void add_delta(Model.Delta d)
          Incorporate the information from a Delta into this Model.
 void clear()
          Forget all observations recorded since the last call to clear or recalculate.
 void clear(int num)
          Forget the least-recent recorded observations.
 double loglikelihood()
          Calculates the log-likelihood of all recorded observations.
 QuickSerializable[] outliers()
          Returns the recent observations which the model assigns the lowest likelihood.
 Model.Prediction predict(int horizon)
          Make a prediction based on current model parameters and observations.
 Model.Delta recalculate()
          Process recently recorded observations.
 void record(QuickSerializable observation)
          Notes an observation for later processing.
 void record(QuickSerializable[] observations)
          Notes a group of observations for later processing.
 
Methods inherited from interface ostore.util.QuickSerializable
serialize
 

Method Detail

record

public void record(QuickSerializable observation)
Notes an observation for later processing. This method should execute very quickly, so that OIL does not create a bottleneck in a critical path. Any significant processing should be postponed until the recalculate method is called.

Parameters:
observation - Any event, value, etc. that this Model understands.
Throws:
IllegalArgumentException - if the particular subclass of Model cannot process the observation.

record

public void record(QuickSerializable[] observations)
Notes a group of observations for later processing. This method allows the Model to process a group of observations in bulk, potentially saving resources.

Parameters:
observations - An array of events, values, etc., not necessarily all the same type, that this Model understands.
Throws:
IllegalArgumentException - if the particular subclass of Model cannot process the observation.

clear

public void clear(int num)
Forget the least-recent recorded observations.


clear

public void clear()
Forget all observations recorded since the last call to clear or recalculate.


loglikelihood

public double loglikelihood()
Calculates the log-likelihood of all recorded observations. Only observations recorded since the last call to clear or recalculate are considered.

Returns:
a non-positive number equal to the logarithm of the probability of the observations (D) given the current model (M); log(p(D|M)). If no observations exist, it returns Double.NaN.

recalculate

public Model.Delta recalculate()
Process recently recorded observations. The internal model parameters are updated to produce the model which maximizes the likelihood of the observations. Observations are forgotten after processing, as if clear were called. Different Models may provide different semantics for how prior parameters are included in the resulting ones. For instance, sufficient statistics may be added cumulatively, parameters may have finite moments, etc.

Returns:
A Delta storing the difference between the new model parameters and the old.

predict

public Model.Prediction predict(int horizon)
Make a prediction based on current model parameters and observations.

Returns:
A Prediction, whose semantics depends on the particular subclass of Model.

outliers

public QuickSerializable[] outliers()
Returns the recent observations which the model assigns the lowest likelihood. This method is useful both for standard outlier detections as well as for swapping in model segments using reverse lookup.

Returns:
an array containing recent observations which the model did not expect.

add_delta

public void add_delta(Model.Delta d)
Incorporate the information from a Delta into this Model. The resulting Model should be equivalent to that which produced the Delta, given that they began in the same state. Subclasses of Model employ specific subclasses of Delta.

Throws:
IllegalArgumentException - if the Delta object is not of the correct subclass.