### Question:
DL4JSequenceRecommender extends RecommendationEngine { @Override public void train(RecommenderContext aContext, List<CAS> aCasses) { Object2IntMap<String> tagsetCollector = new Object2IntOpenHashMap<>(); try { ensureEmbeddingsAreAvailable(); List<Sample> trainingData = extractData(aCasses, true); MultiLayerNetwork model = train(trainingData, tagsetCollector); aContext.put(KEY_MODEL, model); aContext.put(KEY_TAGSET, compileTagset(tagsetCollector)); aContext.put(KEY_UNKNOWN, randUnk); } catch (IOException e) { throw new IllegalStateException("Unable to train model", e); } } DL4JSequenceRecommender(Recommender aRecommender, DL4JSequenceRecommenderTraits aTraits,
            File aDatasetCache); @Override boolean isReadyForPrediction(RecommenderContext aContext); @Override void train(RecommenderContext aContext, List<CAS> aCasses); @Override RecommendationEngineCapability getTrainingCapability(); List<String> extractTokenLabels(List<AnnotationFS> aTokens,
            List<AnnotationFS> aLabels); @Override void predict(RecommenderContext aContext, CAS aCas); @Override EvaluationResult evaluate(List<CAS> aCas, DataSplitter aDataSplitter); static final String NO_LABEL; static final Key<String[]> KEY_TAGSET; static final Key<MultiLayerNetwork> KEY_MODEL; static final Key<INDArray> KEY_UNKNOWN; }### Answer:
@Test public void thatPosTrainingWorks() throws Exception { DL4JSequenceRecommender sut = new DL4JSequenceRecommender(buildPosRecommender(), traits, cache); JCas cas = loadPosDevelopmentData("thatPosTrainingWorks"); casSession.add("testingNer", CasAccessMode.EXCLUSIVE_WRITE_ACCESS, cas.getCas()); sut.train(context, asList(cas.getCas())); assertThat(context.get(DL4JSequenceRecommender.KEY_MODEL)) .as("Model has been set") .isNotNull(); }
@Ignore @Test public void thatNerTrainingWorks() throws Exception { DL4JSequenceRecommender sut = new DL4JSequenceRecommender(buildNerRecommender(), traits, cache); JCas cas = loadNerDevelopmentData("thatNerTrainingWorks"); sut.train(context, asList(cas.getCas())); assertThat(context.get(DL4JSequenceRecommender.KEY_MODEL)) .as("Model has been set") .isNotNull(); }