diva.sketch.recognition
Class MSTrainingModel

java.lang.Object
  extended by diva.sketch.recognition.MSTrainingModel

public class MSTrainingModel
extends Object

MSTrainingModel (Multi-Stroke Training Model) is a data structure for storing training examples and their types. Each training example is a set of TimedStroke objects.

Version:
$Revision: 1.2 $
Author:
Heloise Hse (hwawen@eecs.berkeley.edu)

Field Summary
protected static boolean NEGATIVE
          Internal constant for the array slot of negative examples.
protected static boolean POSITIVE
          Internal constant for the array slot of positive examples.
 
Constructor Summary
MSTrainingModel()
          Construct an empty training model.
 
Method Summary
 void addExample(String t, TimedStroke[] s, boolean which)
          Add an example to this training model for the given type (either positive or negative, denoted by the "which" argument).
 void addNegativeExample(String t, TimedStroke[] s)
          Add a negative example to this training model for the given type.
 void addPositiveExample(String t, TimedStroke[] s)
          Add a positive example to this training model for the given type.
 void combine(MSTrainingModel model)
          Add the data in the specified model into "this" model.
 boolean containsType(String t)
          Return true if the training type with the specified name is in the model, or false otherwise.
 int getTypeCount()
          Return how many types are contained in this training model.
 int negativeExampleCount(String t)
          Returns the number of negative examples for the given type.
 Iterator negativeExamples(String t)
          An iterator over the negative examples for the given type.
 int positiveExampleCount(String t)
          Returns the number of positive examples for the given type.
 Iterator positiveExamples(String t)
          An iterator over the positive examples for the given type.
 String toString()
           
 Iterator types()
          An iterator over the types contained in this training model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NEGATIVE

protected static final boolean NEGATIVE
Internal constant for the array slot of negative examples.

See Also:
Constant Field Values

POSITIVE

protected static final boolean POSITIVE
Internal constant for the array slot of positive examples.

See Also:
Constant Field Values
Constructor Detail

MSTrainingModel

public MSTrainingModel()
Construct an empty training model.

Method Detail

addNegativeExample

public final void addNegativeExample(String t,
                                     TimedStroke[] s)
Add a negative example to this training model for the given type.


addPositiveExample

public final void addPositiveExample(String t,
                                     TimedStroke[] s)
Add a positive example to this training model for the given type.


addExample

public final void addExample(String t,
                             TimedStroke[] s,
                             boolean which)
Add an example to this training model for the given type (either positive or negative, denoted by the "which" argument).


combine

public final void combine(MSTrainingModel model)
Add the data in the specified model into "this" model.


containsType

public final boolean containsType(String t)
Return true if the training type with the specified name is in the model, or false otherwise.


getTypeCount

public final int getTypeCount()
Return how many types are contained in this training model.


negativeExampleCount

public final int negativeExampleCount(String t)
Returns the number of negative examples for the given type.


negativeExamples

public final Iterator negativeExamples(String t)
An iterator over the negative examples for the given type. Each example returned in the iterator is an array of TimedStrokes (TimedStroke[]).


positiveExampleCount

public final int positiveExampleCount(String t)
Returns the number of positive examples for the given type.


positiveExamples

public final Iterator positiveExamples(String t)
An iterator over the positive examples for the given type. Each example returned in the iterator is an array of TimedStrokes (TimedStroke[]).


types

public Iterator types()
An iterator over the types contained in this training model.


toString

public String toString()
Overrides:
toString in class Object


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.