Пример #1
0
 def testSequenceTagger(self, mode):
     model = models.SequenceTagger(inputters.WordEmbedder(10),
                                   encoders.MeanEncoder(),
                                   crf_decoding=True)
     features_file, labels_file, data_config = self._makeToyTaggerData()
     data_config["tagging_scheme"] = "bioes"
     params = {"optimizer": "SGD", "learning_rate": 0.1}
     self._testGenericModel(
         model,
         mode,
         features_file,
         labels_file,
         data_config,
         prediction_heads=["tags", "length"],
         metrics=["accuracy", "precision", "recall", "f1"],
         params=params)
Пример #2
0
 def testSequenceTagger(self, mode):
   model = models.SequenceTagger(
       inputters.WordEmbedder("source_vocabulary", 10),
       encoders.MeanEncoder(),
       "target_vocabulary",
       crf_decoding=True,
       tagging_scheme="bioes")
   features_file, labels_file, metadata = self._makeToyTaggerData()
   params = {
       "optimizer": "GradientDescentOptimizer",
       "learning_rate": 0.1}
   self._testGenericModel(
       model,
       mode,
       features_file,
       labels_file,
       metadata,
       prediction_heads=["tags", "length"],
       metrics=["accuracy", "precision", "recall", "f1"],
       params=params)