code: function(err) {
          if (err) {
              threadPool.destroy();
              return callback(err);
          }
  
          for (var j = self.lastAdded; j < totalDocs; j++) {
              self.classifier.addExample(docFeatures[j], self.docs[j].label);
              self.events.emit('trainedWithDocument', {
                  index: j,
                  total: totalDocs,
                  doc: self.docs[j]
              });
              self.lastAdded++;
          }
  
          self.events.emit('doneTraining', true);
          self.classifier.train();
  
          threadPool.destroy();
          callback(null);
      }
docs: Called when all batches finish processing