ostore.introspect
Interface SemanticDistanceModel.Filter

All Superinterfaces:
QuickSerializable
All Known Implementing Classes:
WeightedAvgFilter
Enclosing interface:
SemanticDistanceModel

public static interface SemanticDistanceModel.Filter
extends QuickSerializable

A filter determines how to integrate new semantic distance values into the table. Implementations should take care of outliers by ignoring them (they determine what should be considered an outlier). In particular, the distance values may be Distance.INFINITY, in which case special action should be taken to ensure the bogus value does not propogate.

Version:
$Id: SemanticDistanceModel.java,v 1.11 2003/11/17 23:52:43 emilong Exp $
Author:
Jeff Pang

Method Summary
 Distance recalculate(Distance previous_age, Distance increment)
          Update the age of the model as a function of the previous_age value and the increment amount of time since the last call to this function.
 void recalculate(SemanticDistanceModel.Tuple current, Distance age, Distance val)
          Recalcualate the semantic distance and weight of a tuple given the tuple's contents (distance and previous weight) the new observed value.
 void recalculate(SemanticDistanceModel.Tuple old, Distance age, Set vals)
          Recalculate the semantic distance given the old distance and the new observed values (in order).
 Distance sum(Distance current_age, Distance addum_age)
          Update the age of the model as a function of the current_age of this model and the addum_age of the table we are incorporating into this model.
 void sum(SemanticDistanceModel.Tuple current, Distance curr_age, int curr_clients, SemanticDistanceModel.Tuple addum, Distance addum_age, int addum_clients)
          Recalculate the semantic distance and weight of a tuple given a new distance value from another semantic distance table.
 void update_priority(SemanticDistanceModel.Tuple t, SemanticDistanceModel.BoundedPrioQueue q)
          Recalcualte the priority of t.
 
Methods inherited from interface ostore.util.QuickSerializable
serialize
 

Method Detail

recalculate

public void recalculate(SemanticDistanceModel.Tuple current,
                        Distance age,
                        Distance val)
Recalcualate the semantic distance and weight of a tuple given the tuple's contents (distance and previous weight) the new observed value. This method should filter out any new val that is considered an outlier (i.e., in that case it should just return old so the value does not change.

Parameters:
current - the tuple to be updated (contains the current semantic distance)
age - the age of the current model
val - the new value recorded

recalculate

public void recalculate(SemanticDistanceModel.Tuple old,
                        Distance age,
                        Set vals)
Recalculate the semantic distance given the old distance and the new observed values (in order).

Parameters:
old - the old semantic distance
age - the age of the current model
vals - the new Set<Distance> values recorded

recalculate

public Distance recalculate(Distance previous_age,
                            Distance increment)
Update the age of the model as a function of the previous_age value and the increment amount of time since the last call to this function.

This is usually only called each time we receive a new observation.

Parameters:
previous_age - the previous age value
increment - the amount of time since the previous call to this function
Returns:
the new age value for this model

sum

public void sum(SemanticDistanceModel.Tuple current,
                Distance curr_age,
                int curr_clients,
                SemanticDistanceModel.Tuple addum,
                Distance addum_age,
                int addum_clients)
Recalculate the semantic distance and weight of a tuple given a new distance value from another semantic distance table.

Parameters:
current - the tuple to be updated
curr_age - the age of the current model
curr_clients - the number of clients represented by the current model
addum - the new tuple from the other table
addum_age - the age of the other model
addum_clients - the number of clients represented by the other model

sum

public Distance sum(Distance current_age,
                    Distance addum_age)
Update the age of the model as a function of the current_age of this model and the addum_age of the table we are incorporating into this model.


update_priority

public void update_priority(SemanticDistanceModel.Tuple t,
                            SemanticDistanceModel.BoundedPrioQueue q)
Recalcualte the priority of t. This is used to determine its position in the table's prio queue. Smaller values are more likely to be kept than larger values.

Parameters:
t - the tuple
q - the prio queue this tuple is to be placed in or is already in. WARNING: if t is already in the queue, then its priority is not yet updated. The queue may not be in order.
Returns:
the priority of t as a distance.