@Override
 public void onEvent(TwoPhaseEvent<SparseItem> event, long sequence, boolean endOfBatch)
     throws Exception {
   double prediction = algorithm.learn(event.output(), increment);
   model.writeToModel(increment);
   outputFormat.emit(event.output(), prediction);
 }
 @Override
 public void onShutdown() {
   try {
     outputFormat.close();
   } catch (IOException e) {
     logger.error("Failed to close", e);
   } finally {
     phaser.arriveAndDeregister();
   }
 }