ostore.introspect
Class SDMBuilder

java.lang.Object
  |
  +--ostore.util.StandardStage
        |
        +--ostore.introspect.SDMBuilder
All Implemented Interfaces:
EventHandlerIF

public class SDMBuilder
extends StandardStage

Stage that accepts RecordEventReqs and builds a local model based on them. Periodically recalculates the local model based on these timed observations and emits (distpatches) SemanticDistanceModel.Deltas when the model is recalculated.

Configuration parameters:

 model          [string]    - the identifier for this model; only model
                              messages targeted at this model will be
                              received. Ommit this to receive all msgs.
 read_snapshot  [string]    - load a model from a snapshot file
 max_relations  [int]       - max relations to keep per row in model
 signal         [boolean]   - recalculate model on RBLD signal
 period         [int]       - recalculate model every X milliseconds
 maxobs         [int]       - recalculate model after X observations
 write_snapshot [string]    - write snapshot file after recalculating model
 emit_deltas    [boolean]   - emit deltas after recalculating model
 

Based on HMMBuilder.

Version:
$Id: SDMBuilder.java,v 1.3 2003/04/03 02:03:45 jeffpang Exp $
Author:
Jeff Pang
See Also:
SemanticDistanceModel

Nested Class Summary
static class SDMBuilder.InvalidTypeException
          An exception thrown when a config file supplies the name of a class or field that does not satisfy type restrictions.
static class SDMBuilder.UnsupportedConfigurationException
          An exception thrown when a config file requests an operation (e.g. emit_predictions) that a particular Builder does not provide.
 
Field Summary
static String class_tag
           
static boolean DEBUG
           
protected  boolean emit_deltas
          true iff this Builder should publish Deltas for its Model whenever the model parameters are recalculated.
protected  String ident
          The identifier of this model.
protected  SemanticDistanceModel model
          The learning model to use.
protected  String name
          Name of stage.
protected  int num_observed
          The total number of observations so far.
protected  int recalculation_maxobs
          The number of events to observe before recalculating model parameters.
protected  int recalculation_period
          The time (ms) between RebuildSignals are received.
protected  boolean recalculation_signal
          Recalculate the model when we get a Signal.RBLD (meaning the machine is "not busy")
protected  Signal signal
          Signal Handler
protected  String snapshot_name
          The name of the snapshot file to write, if write_snapshots == true.
protected  boolean write_snapshots
          true iff this stage should write out snapshots of its Model every time it recalculates its parameters.
 
Fields inherited from class ostore.util.StandardStage
classifier, event_types, inb_msg_types, logger, my_node_id, my_sink, outb_msg_types, resender, resender_tokens, serializable_types, sim_running, tag
 
Constructor Summary
SDMBuilder()
           
 
Method Summary
 void handleEvent(QueueElementIF elem)
           
 void init(ConfigDataIF config)
           
 
Methods inherited from class ostore.util.StandardStage
BUG, BUG, BUG, destroy, dispatch, enqueue, handleEvents, now_ms, now_us
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static final boolean DEBUG
See Also:
Constant Field Values

class_tag

public static final String class_tag
See Also:
Constant Field Values

name

protected String name
Name of stage.


ident

protected String ident
The identifier of this model. Only model messages destined for this model will be received. If null, receive all model messages.


recalculation_period

protected int recalculation_period
The time (ms) between RebuildSignals are received. If 0, then only recalculate when recalculation_maxobs outstanding observations are made.


recalculation_maxobs

protected int recalculation_maxobs
The number of events to observe before recalculating model parameters. If 0, recalculate only when a RebuildSignal is received.


recalculation_signal

protected boolean recalculation_signal
Recalculate the model when we get a Signal.RBLD (meaning the machine is "not busy")


write_snapshots

protected boolean write_snapshots
true iff this stage should write out snapshots of its Model every time it recalculates its parameters.


snapshot_name

protected String snapshot_name
The name of the snapshot file to write, if write_snapshots == true. Otherwise this parameter is ignored.


emit_deltas

protected boolean emit_deltas
true iff this Builder should publish Deltas for its Model whenever the model parameters are recalculated.


num_observed

protected int num_observed
The total number of observations so far.


model

protected SemanticDistanceModel model
The learning model to use.


signal

protected Signal signal
Signal Handler

Constructor Detail

SDMBuilder

public SDMBuilder()
Method Detail

handleEvent

public void handleEvent(QueueElementIF elem)
                 throws UnknownEventException
UnknownEventException

init

public void init(ConfigDataIF config)
          throws Exception
Specified by:
init in interface EventHandlerIF
Overrides:
init in class StandardStage
Exception