Exemple #1
0
    def test_cli(self):
        with self.assertRaises(SystemExit):
            sio = io.StringIO()
            with contextlib.redirect_stdout(sio):
                run_module("vecto",
                           "benchmark",
                           "WRONG_NAME",
                           "path_embs")

        sio = io.StringIO()
        with contextlib.redirect_stdout(sio):
            run_module("vecto",
                       "benchmark",
                       "help")
    def test_cli(self):
        sio = io.StringIO()
        with contextlib.redirect_stdout(sio):
            run_module("vecto", "benchmark", "relation_extraction", path_emb,
                       path_dataset, "--path_out", "/tmp/vecto/benchmarks/")

        with self.assertRaises(FileNotFoundError):
            sio = io.StringIO()
            with contextlib.redirect_stdout(sio):
                run_module("vecto", "benchmark", "relation_extraction",
                           path_emb + "NONEXISTING", path_dataset,
                           "--path_out", "/tmp/vecto/benchmarks/")

        from matplotlib import pyplot as plt
        visualize.plot_accuracy("/tmp/vecto/benchmarks/relation_extraction",
                                key_secondary="experiment_setup.dataset")
        plt.savefig("/tmp/vecto/benchmarks/relation_extraction.pdf",
                    bbox_inches="tight")
Exemple #3
0
    def test_cli(self):
        sio = io.StringIO()
        with contextlib.redirect_stdout(sio):
            run_module("vecto", "benchmark", "language_modeling", path_emb,
                       "--window_size", "5", "--path_out",
                       "/tmp/vecto/benchmarks/")

        sio = io.StringIO()
        with contextlib.redirect_stdout(sio):
            run_module("vecto", "benchmark", "language_modeling", path_emb,
                       "--method", "lr", "--path_out",
                       "/tmp/vecto/benchmarks/tmp")

        with self.assertRaises(FileNotFoundError):
            sio = io.StringIO()
            with contextlib.redirect_stdout(sio):
                run_module("vecto", "benchmark", "language_modeling",
                           path_emb + "NONEXISTING", "--path_out",
                           "/tmp/vecto/benchmarks/")

        from matplotlib import pyplot as plt
        visualize.plot_accuracy("/tmp/vecto/benchmarks/language_modeling",
                                key_secondary="experiment_setup.dataset")
        plt.savefig("/tmp/vecto/benchmarks/language_modeling.pdf",
                    bbox_inches="tight")
    def test_cli(self):
        sio = io.StringIO()
        with contextlib.redirect_stdout(sio):
            run_module("vecto.benchmarks.sequence_labeling", path_emb,
                       path_sequence_labeling_dataset_ner, "--path_out",
                       "/tmp/vecto/benchmarks/")

        sio = io.StringIO()
        with contextlib.redirect_stdout(sio):
            run_module("vecto.benchmarks.sequence_labeling", path_emb,
                       path_sequence_labeling_dataset_ner, "--path_out",
                       "/tmp/vecto/benchmarks/")

        with self.assertRaises(FileNotFoundError):
            sio = io.StringIO()
            with contextlib.redirect_stdout(sio):
                run_module("vecto.benchmarks.sequence_labeling",
                           path_emb + "NONEXISTING",
                           path_sequence_labeling_dataset_ner, "--path_out",
                           "/tmp/vecto/benchmarks/")

        from matplotlib import pyplot as plt
        # here the visualization only for the ner sub task.
        visualize.plot_accuracy("/tmp/vecto/benchmarks/ner",
                                key_secondary="experiment_setup.dataset")
        plt.savefig("/tmp/vecto/benchmarks/sequence_labeling.pdf",
                    bbox_inches="tight")