Carlos-Francisco Méndez-Cruz

Conditional Random Fields

...@@ -235,13 +235,10 @@ if __name__ == "__main__": ...@@ -235,13 +235,10 @@ if __name__ == "__main__":
235 nameReport = options.trainingFile.replace('.txt', '.fStopWords_' + str(options.excludeStopWords) + '.fSymbols_' + str( 235 nameReport = options.trainingFile.replace('.txt', '.fStopWords_' + str(options.excludeStopWords) + '.fSymbols_' + str(
236 options.excludeSymbols) + '.txt') 236 options.excludeSymbols) + '.txt')
237 with open(os.path.join(options.outputPath, "reports", "report_" + nameReport), mode="w") as oFile: 237 with open(os.path.join(options.outputPath, "reports", "report_" + nameReport), mode="w") as oFile:
238 - oFile.write("********** TRAINING AND TESTING REPORT **********\n") 238 + oFile.write("********** TRAINING **********\n")
239 oFile.write("Training file: " + options.trainingFile + '\n') 239 oFile.write("Training file: " + options.trainingFile + '\n')
240 oFile.write('\n') 240 oFile.write('\n')
241 oFile.write("Model: {}".format(crf)) 241 oFile.write("Model: {}".format(crf))
242 - #oFile.write('best params:' + str(crf.best_params_) + '\n')
243 - #oFile.write('best CV score:' + str(crf.best_score_) + '\n')
244 - #oFile.write('model size: {:0.2f}M\n'.format(crf.best_estimator_.size_ / 1000000))
245 242
246 print("Training done in: %fs" % (time() - t0)) 243 print("Training done in: %fs" % (time() - t0))
247 t0 = time() 244 t0 = time()
...@@ -276,7 +273,7 @@ if __name__ == "__main__": ...@@ -276,7 +273,7 @@ if __name__ == "__main__":
276 # labels.remove('O') 273 # labels.remove('O')
277 274
278 with open(os.path.join(options.outputPath, "reports", "report_" + nameReport), mode="a") as oFile: 275 with open(os.path.join(options.outputPath, "reports", "report_" + nameReport), mode="a") as oFile:
279 - oFile.write('\n') 276 + oFile.write('********** EVALUATION **********\n')
280 oFile.write("Flat F1: " + str(metrics.flat_f1_score(y_test, y_pred, average='weighted', labels=labels))) 277 oFile.write("Flat F1: " + str(metrics.flat_f1_score(y_test, y_pred, average='weighted', labels=labels)))
281 oFile.write('\n') 278 oFile.write('\n')
282 # labels = list(crf.classes_) 279 # labels = list(crf.classes_)
......