title: time series alignment with continuous and categorical data
body: <p>I have pairs of series of timed measurements I want to align.  I have
  annotators judging and marking ambiguous events in a signal and want
  to optimally match their times and events.  The input is four columns:
  the event onset times and labels for one annotator, and the times and
  labels for the other annotator.  For example (as rows):</p>
  
  <pre><code>annotator_1_times: .34, .39, .50, .68, .88
  
  annotator_1_label:   A,   X,   Q,   L,   Z
  
  annotator_2_times: .33, .41, .67, .90
  
  annotator_2_label:   A,   X,   L,   X
  </code></pre>
  
  <p>Annotators don't necessarily have the same number of events when they
  interpret the same signal.  Annotators in general are expected to have
  similar but nonidentical labels, and similar but nonidentical times.</p>
  
  <p>How this should be done depends on some sort of cost function --
  something that will decide how "bad" it is for a time to be off a
  certain amount, and for two labels to disagree.</p>
  
  <p>A desirable output in my example case:</p>
  
  <pre><code>   annotator_1_times: .34, .39, .50, .68, .88
  
     annotator_1_label:   A,   X,   Q,   L,   Z
  
     annotator_2_times: .33, .41,  [], .67, .90    &lt;-note gap inserted
  
     annotator_2_label:   A,   X,  [],   L,   X
  </code></pre>
  
  <p>Stuff I would then do post hoc:</p>
  
  <pre><code>time_mismatch_dif: .01, .02,  XX, .01, .02    &lt;- for computing agreemt
  
  label_mismatches_:   0,   0, ADD,   0, SUBST  &lt;- for computing agreemt
  </code></pre>
  
  <p>The hard part is to know where to insert the gaps.</p>
  
  <p>If need be, I can do just the numerical alignments and separately just
  the label alignments and then merge them somehow.  I know there are
  character alignment algorithms (e.g. in genetics) and there must be
  time-series alignment algorithms.</p>
  
  <p>Any suggestions welcome.</p>