Exemplo n.º 1
0
    def test_scenario2(self):
        """
            Scenario: Successfully building test predictions from source using datasets with max categories
                Given I have previously executed "<scenario>" or reproduce it with arguments <kwargs>
                And I create BigML resources with <max_categories> as categories limit and <objective> as objective field using source to test "<test>" and log predictions in "<output>"
                And I check that the dataset has been created
                And I check that the max_categories datasets have been created
                And I check that the models have been created
                And I check that the predictions are ready
                Then the local prediction file is like "<predictions_file>"

                Examples:
                |scenario    | kwargs                                                  |max_categories| objective | test                    | output                        |predictions_file           |
                | scenario_mc_1| {"data": "../data/iris.csv", "max_categories": "1", "objective": "species", "output": "./scenario_mc_1/predictions.csv", "test": "../data/test_iris.csv"}   |1| species | ../data/test_iris.csv   | ./scenario_mc_2/predictions.csv   | ./check_files/predictions_mc.csv   |
        """
        print self.test_scenario2.__doc__
        examples = [
            ['scenario_mc_1', '{"data": "data/iris.csv", "max_categories": "1", "objective": "species", "output": "scenario_mc_1/predictions.csv", "test": "data/test_iris.csv"}', '1', 'species', 'data/test_iris.csv', 'scenario_mc_2/predictions.csv', 'check_files/predictions_mc.csv']]
        for example in examples:
            print "\nTesting with:\n", example
            test_pred.i_have_previous_scenario_or_reproduce_it(self, example[0], example[1])
            max_cat.i_create_all_mc_resources_from_source(self, max_categories=example[2], objective=example[3], test=example[4], output=example[5])
            test_pred.i_check_create_dataset(self, suffix=None)
            max_cat.i_check_create_max_categories_datasets(self)
            test_pred.i_check_create_models(self)
            test_pred.i_check_create_predictions(self)
            test_pred.i_check_predictions(self, example[6])
Exemplo n.º 2
0
    def test_scenario2(self):
        """
            Scenario: Successfully building test predictions from source using datasets with max categories
                Given I have previously executed "<scenario>" or reproduce it with arguments <kwargs>
                And I create BigML resources with <max_categories> as categories limit and <objective> as objective field using source to test "<test>" and log predictions in "<output>"
                And I check that the dataset has been created
                And I check that the max_categories datasets have been created
                And I check that the models have been created
                And I check that the predictions are ready
                Then the local prediction file is like "<predictions_file>"

                Examples:
                |scenario    | kwargs                                                  |max_categories| objective | test                    | output                        |predictions_file           |
                | scenario_mc_1| {"data": "../data/iris.csv", "max_categories": "1", "objective": "species", "output": "./scenario_mc_1/predictions.csv", "test": "../data/test_iris.csv"}   |1| species | ../data/test_iris.csv   | ./scenario_mc_2/predictions.csv   | ./check_files/predictions_mc.csv   |
        """
        print self.test_scenario2.__doc__
        examples = [
            ['scenario_mc_1', '{"data": "data/iris.csv", "max_categories": "1", "objective": "species", "output": "scenario_mc_1/predictions.csv", "test": "data/test_iris.csv"}', '1', 'species', 'data/test_iris.csv', 'scenario_mc_2/predictions.csv', 'check_files/predictions_mc.csv']]
        for example in examples:
            print "\nTesting with:\n", example
            test_pred.i_have_previous_scenario_or_reproduce_it(self, example[0], example[1])
            max_cat.i_create_all_mc_resources_from_source(self, max_categories=example[2], objective=example[3], test=example[4], output=example[5])
            test_pred.i_check_create_dataset(self, suffix=None)
            max_cat.i_check_create_max_categories_datasets(self)
            test_pred.i_check_create_models(self)
            test_pred.i_check_create_predictions(self)
            test_pred.i_check_predictions(self, example[6])
Exemplo n.º 3
0
    def setup_scenario1(self):
        """
            Scenario: Successfully building test predictions from training data using datasets with max categories
                Given I create BigML resources from "<data>" with <max_categories> as categories limit and <objective> as objective field to test "<test>" and log predictions in "<output>"
                And I check that the source has been created
                And I check that the dataset has been created
                And I check that the max_categories datasets have been created
                And I check that the models have been created
                And I check that the predictions are ready
                Then the local prediction file is like "<predictions_file>"

                Examples:
                |data |max_categories | objective | test                        | output                          |predictions_file           |
                |../data/iris.csv |1| species |../data/test_iris.csv | ./scenario_mc_1/predictions.csv | ./check_files/predictions_mc.csv |
        """
        print self.setup_scenario1.__doc__
        examples = [
            ['data/iris.csv', '1', 'species', 'data/test_iris.csv', 'scenario_mc_1/predictions.csv', 'check_files/predictions_mc.csv']]
        for example in examples:
            print "\nTesting with:\n", example
            max_cat.i_create_all_mc_resources(self, example[0], max_categories=example[1], objective=example[2], test=example[3], output=example[4])
            test_pred.i_check_create_source(self)
            test_pred.i_check_create_dataset(self, suffix=None)
            max_cat.i_check_create_max_categories_datasets(self)
            test_pred.i_check_create_models(self)
            test_pred.i_check_create_predictions(self)
            test_pred.i_check_predictions(self, example[5])
Exemplo n.º 4
0
    def setup_scenario1(self):
        """
            Scenario: Successfully building test predictions from training data using datasets with max categories
                Given I create BigML resources from "<data>" with <max_categories> as categories limit and <objective> as objective field to test "<test>" and log predictions in "<output>"
                And I check that the source has been created
                And I check that the dataset has been created
                And I check that the max_categories datasets have been created
                And I check that the models have been created
                And I check that the predictions are ready
                Then the local prediction file is like "<predictions_file>"

                Examples:
                |data |max_categories | objective | test                        | output                          |predictions_file           |
                |../data/iris.csv |1| species |../data/test_iris.csv | ./scenario_mc_1/predictions.csv | ./check_files/predictions_mc.csv |
        """
        print self.setup_scenario1.__doc__
        examples = [
            ['data/iris.csv', '1', 'species', 'data/test_iris.csv', 'scenario_mc_1/predictions.csv', 'check_files/predictions_mc.csv']]
        for example in examples:
            print "\nTesting with:\n", example
            max_cat.i_create_all_mc_resources(self, example[0], max_categories=example[1], objective=example[2], test=example[3], output=example[4])
            test_pred.i_check_create_source(self)
            test_pred.i_check_create_dataset(self, suffix=None)
            max_cat.i_check_create_max_categories_datasets(self)
            test_pred.i_check_create_models(self)
            test_pred.i_check_create_predictions(self)
            test_pred.i_check_predictions(self, example[5])
Exemplo n.º 5
0
    def test_scenario5(self):
        """
            Scenario: Successfully building test predictions from dataset using datasets and model fields with max categories
                Given I have previously executed "<scenario>" or reproduce it with arguments <kwargs>
                And I create BigML resources with <max_categories> as categories limit and <objective> as objective field and model fields "<model_fields>" using dataset to test "<test>" and log predictions in "<output>"
                And I check that the max_categories datasets have been created
                And I check that the models have been created
                And I check that the predictions are ready
                Then the local prediction file is like "<predictions_file>"

                Examples:
                |scenario    | kwargs                                                  |max_categories|objective | model_fields | test                    | output                        |predictions_file           |
                | scenario_mc_1| {"data": "../data/iris.csv", "max_categories": "1", "objective": "species", "output": "./scenario_mc_1/predictions.csv", "test": "../data/test_iris.csv"}   |1| species |sepal length,sepal width |../data/test_iris.csv   | ./scenario_mc_5/predictions.csv   | ./check_files/predictions_mc2.csv   |

        """
        print self.test_scenario5.__doc__
        examples = [
            [
                "scenario_mc_1",
                '{"data": "data/iris.csv", "max_categories": "1", "objective": "species", "output": "scenario_mc_1/predictions.csv", "test": "data/test_iris.csv"}',
                "1",
                "species",
                "sepal length,sepal width",
                "data/test_iris.csv",
                "scenario_mc_5/predictions.csv",
                "check_files/predictions_mc2.csv",
            ]
        ]
        for example in examples:
            print "\nTesting with:\n", example
            test_pred.i_have_previous_scenario_or_reproduce_it(self, example[0], example[1])
            max_cat.i_create_all_mc_resources_from_dataset_with_model_fields(
                self,
                max_categories=example[2],
                objective=example[3],
                model_fields=example[4],
                test=example[5],
                output=example[6],
            )
            max_cat.i_check_create_max_categories_datasets(self)
            test_pred.i_check_create_models(self)
            test_pred.i_check_create_predictions(self)
            test_pred.i_check_predictions(self, example[7])