5d8d505c4c9659fb965c91ba365e7d3a1a39e557,tests/test_polyaxonfile/test_polyaxonfile.py,TestPolyaxonfile,test_matrix_early_stopping_file_passes,#TestPolyaxonfile#,351

Before Change


        assert plxfile.matrix["loss"].to_dict() == {"values": ["MeanSquaredError",
                                                               "AbsoluteDifference"]}
        assert plxfile.matrix_space == 10
        declarations = []
        for lr in plxfile.matrix["lr"].to_numpy():
            for loss in plxfile.matrix["loss"].to_numpy():
                declarations.append({"loss": loss, "lr": lr})
        assert sorted(
            plxfile.matrix_declarations, key=lambda x: (x["lr"], x["loss"])) == sorted(
            declarations, key=lambda x: (x["lr"], x["loss"]))
        assert isinstance(plxfile.settings, SettingsConfig)
        assert plxfile.settings.concurrent_experiments == 2
        assert plxfile.settings.n_experiments == 5
        assert plxfile.early_stopping == plxfile.settings.early_stopping
        assert len(plxfile.settings.early_stopping) == 1
        assert isinstance(plxfile.settings.early_stopping[0], EarlyStoppingMetricConfig)
        assert plxfile.run_type == RunTypes.KUBERNETES

        assert plxfile.experiments_def == (
            10,
            5,
            2,
            SearchMethods.GRID
        )

        for xp in range(plxfile.matrix_space):
            spec = plxfile.experiment_spec_at(xp)
            assert spec.is_runnable
            assert spec.environment is None
            assert spec.framework is None
            assert spec.cluster_def == ({TaskType.MASTER: 1}, False)

            model = spec.model
            assert isinstance(model, RegressorConfig)
            assert isinstance(model.loss, (MeanSquaredErrorConfig, AbsoluteDifferenceConfig))
            assert isinstance(model.optimizer, AdamConfig)
            assert isinstance(model.graph, GraphConfig)
            assert len(model.graph.layers) == 4
            assert model.graph.input_layers == [["images", 0, 0]]
            last_layer = model.graph.layers[-1].name
            assert model.graph.output_layers == [[last_layer, 0, 0]]
            assert isinstance(spec.train.data_pipeline, TFRecordImagePipelineConfig)

    def test_matrix_percent_experiments_file_passes(self):
        plxfile = PolyaxonFile(
            os.path.abspath("tests/fixtures/matrix_file_percent_experiments.yml"))
        assert plxfile.version == 1

After Change


        assert isinstance(spec.train.data_pipeline, TFRecordImagePipelineConfig)

    def test_matrix_early_stopping_file_passes(self):
        plxfile = PolyaxonFile(os.path.abspath("tests/fixtures/matrix_file_early_stopping.yml"))
        assert plxfile.version == 1
        assert plxfile.project.name == "project1"
        assert isinstance(plxfile.matrix["lr"], MatrixConfig)
        assert isinstance(plxfile.matrix["loss"], MatrixConfig)
        assert plxfile.matrix["lr"].to_dict() == {
            "logspace": {"start": 0.01, "stop": 0.1, "num": 5}}
        assert plxfile.matrix["loss"].to_dict() == {"values": ["MeanSquaredError",
                                                               "AbsoluteDifference"]}
        assert plxfile.matrix_space == 10
        assert isinstance(plxfile.settings, SettingsConfig)
        assert plxfile.settings.concurrent_experiments == 2
        assert plxfile.settings.n_experiments == 5
        assert plxfile.early_stopping == plxfile.settings.early_stopping
        assert len(plxfile.settings.early_stopping) == 1
        assert isinstance(plxfile.settings.early_stopping[0], EarlyStoppingMetricConfig)
        assert plxfile.run_type == RunTypes.KUBERNETES

        assert plxfile.experiments_def == (
            10,
            5,
            2,
            SearchMethods.GRID
        )

        spec = plxfile.get_experiment_spec(matrix_declaration=plxfile.matrix_declaration_test)
        assert spec.is_runnable
        assert spec.environment is None
        assert spec.framework is None
        assert spec.cluster_def == ({TaskType.MASTER: 1}, False)

        model = spec.model
        assert isinstance(model, RegressorConfig)
        assert isinstance(model.loss, (MeanSquaredErrorConfig, AbsoluteDifferenceConfig))
        assert isinstance(model.optimizer, AdamConfig)
        assert isinstance(model.graph, GraphConfig)
        assert len(model.graph.layers) == 4
        assert model.graph.input_layers == [["images", 0, 0]]
        last_layer = model.graph.layers[-1].name
        assert model.graph.output_layers == [[last_layer, 0, 0]]
        assert isinstance(spec.train.data_pipeline, TFRecordImagePipelineConfig)

    def test_matrix_percent_experiments_file_passes(self):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 27

Instances


Project Name: polyaxon/polyaxon
Commit Name: 5d8d505c4c9659fb965c91ba365e7d3a1a39e557
Time: 2018-04-04
Author: mouradmourafiq@gmail.com
File Name: tests/test_polyaxonfile/test_polyaxonfile.py
Class Name: TestPolyaxonfile
Method Name: test_matrix_early_stopping_file_passes


Project Name: polyaxon/polyaxon
Commit Name: 5d8d505c4c9659fb965c91ba365e7d3a1a39e557
Time: 2018-04-04
Author: mouradmourafiq@gmail.com
File Name: tests/test_polyaxonfile/test_polyaxonfile.py
Class Name: TestPolyaxonfile
Method Name: test_matrix_percent_experiments_file_passes


Project Name: polyaxon/polyaxon
Commit Name: 5d8d505c4c9659fb965c91ba365e7d3a1a39e557
Time: 2018-04-04
Author: mouradmourafiq@gmail.com
File Name: tests/test_polyaxonfile/test_polyaxonfile.py
Class Name: TestPolyaxonfile
Method Name: test_matrix_file_passes


Project Name: polyaxon/polyaxon
Commit Name: 5d8d505c4c9659fb965c91ba365e7d3a1a39e557
Time: 2018-04-04
Author: mouradmourafiq@gmail.com
File Name: tests/test_polyaxonfile/test_polyaxonfile.py
Class Name: TestPolyaxonfile
Method Name: test_matrix_large_n_experiments_ignored_file_passes


Project Name: polyaxon/polyaxon
Commit Name: 5d8d505c4c9659fb965c91ba365e7d3a1a39e557
Time: 2018-04-04
Author: mouradmourafiq@gmail.com
File Name: tests/test_polyaxonfile/test_polyaxonfile.py
Class Name: TestPolyaxonfile
Method Name: test_matrix_early_stopping_file_passes