def test_scenario1(self): """ Scenario: Successfully creating a local prediction from an Ensemble: Given I create a data source uploading a "<data>" file And I wait until the source is ready less than <time_1> secs And I create a dataset And I wait until the dataset is ready less than <time_2> secs And I create an ensemble of <number_of_models> models and <tlp> tlp And I wait until the ensemble is ready less than <time_3> secs And I create a local Ensemble When I create a local ensemble prediction with confidence for "<data_input>" Then the local prediction is "<prediction>" And the local prediction's confidence is "<confidence>" And the local probabilities are "<probabilities>" Examples: | data | time_1 | time_2 | time_3 | number_of_models | tlp | data_input |prediction | confidence | ../data/iris.csv | 10 | 10 | 50 | 5 | 1 | {"petal width": 0.5} | Iris-versicolor | 0.3687 | [0.3403, 0.4150, 0.2447] """ print self.test_scenario1.__doc__ examples = [ ['data/iris.csv', '10', '10', '50', '5', '1', '{"petal width": 0.5}', 'Iris-versicolor', '0.415', '["0.3403", "0.4150", "0.2447"]' ]] for example in examples: print "\nTesting with:\n", example source_create.i_upload_a_file(self, example[0]) source_create.the_source_is_finished(self, example[1]) dataset_create.i_create_a_dataset(self) dataset_create.the_dataset_is_finished_in_less_than(self, example[2]) ensemble_create.i_create_an_ensemble(self, example[4], example[5]) ensemble_create.the_ensemble_is_finished_in_less_than(self, example[3]) ensemble_create.create_local_ensemble(self) prediction_create.create_local_ensemble_prediction_with_confidence(self, example[6]) compare_pred.the_local_prediction_is(self, example[7]) compare_pred.the_local_prediction_confidence_is(self, example[8]) compare_pred.the_local_probabilities_are(self, example[9])
def test_scenario5(self): """ Scenario: Successfully creating a local prediction from an Ensemble: Given I create a data source uploading a "<data>" file And I wait until the source is ready less than <time_1> secs And I create a dataset And I wait until the dataset is ready less than <time_2> secs And I create an ensemble of <number_of_models> models and <tlp> tlp And I wait until the ensemble is ready less than <time_3> secs And I create a local Ensemble When I create a local ensemble prediction using median with confidence for "<data_input>" Then the local prediction is "<prediction>" Examples: | data | time_1 | time_2 | time_3 | number_of_models | tlp | data_input |prediction | | ../data/grades.csv | 10 | 10 | 50 | 2 | 1 | {} | 67.5 | """ print self.test_scenario5.__doc__ examples = [ ['data/grades.csv', '30', '30', '50', '2', '1', '{}', 69.0934]] for example in examples: print "\nTesting with:\n", example source_create.i_upload_a_file(self, example[0]) source_create.the_source_is_finished(self, example[1]) dataset_create.i_create_a_dataset(self) dataset_create.the_dataset_is_finished_in_less_than(self, example[2]) ensemble_create.i_create_an_ensemble(self, example[4], example[5]) ensemble_create.the_ensemble_is_finished_in_less_than(self, example[3]) ensemble_create.create_local_ensemble(self) prediction_create.create_local_ensemble_prediction_using_median_with_confidence(self, example[6]) compare_pred.the_local_prediction_is(self, example[7])
def test_scenario6(self): """ Scenario: Successfully comparing predictions for ensembles: Given I create a data source uploading a "<data>" file And I wait until the source is ready less than <time_1> secs And I create a dataset And I wait until the dataset is ready less than <time_2> secs And I create an ensemble with "<params>" And I wait until the ensemble is ready less than <time_3> secs And I create a local ensemble When I create a prediction for "<data_input>" Then the prediction for "<objective>" is "<prediction>" And I create a local prediction for "<data_input>" Then the local prediction is "<prediction>" Examples: | data | time_1 | time_2 | time_3 | data_input | objective | prediction | params ['data/iris.csv', '10', '10', '120', '{"petal width": 0.5}', '000004', 'Iris-versicolor', '{"number_of_models": 5}'], ['data/iris.csv', '10', '10', '120', '{"petal length": 6, "petal width": 2}', '000004', 'Iris-virginica', '{"number_of_models": 5}'], ['data/iris.csv', '10', '10', '120', '{"petal length": 4, "petal width": 1.5}', '000004', 'Iris-versicolor', '{"number_of_models": 5}'], ['data/grades.csv', '10', '10', '120', '{"Midterm": 20}', '000005', 46.261364, '{"number_of_models": 5}'], ['data/iris.csv', '10', '10', '120', '{"petal width": 0.5}', '000004', 'Iris-setosa', '{"boosting": {"iterations": 5}, "number_of_models": 5}'], ['data/iris.csv', '10', '10', '120', '{"petal length": 6, "petal width": 2}', '000004', 'Iris-virginica', '{"boosting": {"iterations": 5}, "number_of_models": 5}'], ['data/iris.csv', '10', '10', '120', '{"petal length": 4, "petal width": 1.5}', '000004', 'Iris-versicolor', '{"boosting": {"iterations": 5}, "number_of_models": 5}'], """ examples = [ [ 'data/iris_unbalanced.csv', '10', '10', '120', '{"petal width": 4}', '000004', 'Iris-virginica', '{"boosting": {"iterations": 5}, "number_of_models": 5}' ], [ 'data/grades.csv', '10', '10', '120', '{"Midterm": 20}', '000005', 61.61036, '{"boosting": {"iterations": 5}, "number_of_models": 5}' ] ] show_doc(self.test_scenario6, examples) for example in examples: print "\nTesting with:\n", example source_create.i_upload_a_file(self, example[0]) source_create.the_source_is_finished(self, example[1]) dataset_create.i_create_a_dataset(self) dataset_create.the_dataset_is_finished_in_less_than( self, example[2]) ensemble_create.i_create_an_ensemble_with_params(self, example[7]) ensemble_create.the_ensemble_is_finished_in_less_than( self, example[3]) ensemble_create.create_local_ensemble(self) prediction_create.i_create_an_ensemble_prediction(self, example[4]) prediction_create.the_prediction_is(self, example[5], example[6]) prediction_compare.i_create_a_local_ensemble_prediction( self, example[4]) prediction_compare.the_local_prediction_is(self, example[6])
def test_scenario7(self): """ Scenario: Successfully comparing predictions for ensembles with proportional missing strategy: Given I create a data source uploading a "<data>" file And I wait until the source is ready less than <time_1> secs And I create a dataset And I wait until the dataset is ready less than <time_2> secs And I create an esemble with "<params>" And I wait until the ensemble is ready less than <time_3> secs And I create a local ensemble When I create a proportional missing strategy prediction for "<data_input>" Then the prediction for "<objective>" is "<prediction>" And the confidence for the prediction is "<confidence>" And I create a proportional missing strategy local prediction for "<data_input>" Then the local prediction is "<prediction>" And the local prediction's confidence is "<confidence>" Examples: | data | time_1 | time_2 | time_3 | data_input | objective | prediction | confidence | params ['data/iris.csv', '10', '10', '50', '{}', '000004', 'Iris-virginica', '0.33784', '{"boosting": {"iterations": 5}}'], """ examples = [ ['data/iris.csv', '30', '30', '50', '{}', '000004', 'Iris-virginica', '0.33784', '{"boosting": {"iterations": 5}}', {}], ['data/iris.csv', '30', '30', '50', '{}', '000004', 'Iris-versicolor', '0.27261', '{"number_of_models": 5"}', {"operating_kind": "confidence"}], ['data/grades.csv', '30', '30', '50', '{}', '000005', '70.505792', '30.7161', '{"number_of_models": 5}', {}], ['data/grades.csv', '30', '30', '50', '{"Midterm": 20}', '000005', '54.82214', '25.89672', '{"number_of_models": 5}', {"operating_kind": "confidence"}], ['data/grades.csv', '30', '30', '50', '{"Midterm": 20}', '000005', '45.4573', '29.58403', '{"number_of_models": 5}', {}], ['data/grades.csv', '30', '30', '50', '{"Midterm": 20, "Tutorial": 90, "TakeHome": 100}', '000005', '42.814', '31.51804', '{"number_of_models": 5}', {}]] show_doc(self.test_scenario7, examples) for example in examples: print "\nTesting with:\n", example source_create.i_upload_a_file(self, example[0]) source_create.the_source_is_finished(self, example[1]) dataset_create.i_create_a_dataset(self) dataset_create.the_dataset_is_finished_in_less_than(self, example[2]) ensemble_create.i_create_an_ensemble_with_params(self, example[8]) ensemble_create.the_ensemble_is_finished_in_less_than(self, example[3]) ensemble_create.create_local_ensemble(self) prediction_create.i_create_an_ensemble_proportional_prediction(self, example[4], example[9]) prediction_create.the_prediction_is(self, example[5], example[6]) prediction_create.the_confidence_is(self, example[7]) prediction_create.create_local_ensemble_proportional_prediction_with_confidence(self, example[4], example[9]) prediction_compare.the_local_ensemble_prediction_is(self, example[6]) prediction_compare.the_local_prediction_confidence_is(self, example[7])
def test_scenario7(self): """ Scenario: Successfully comparing predictions for ensembles with proportional missing strategy: Given I create a data source uploading a "<data>" file And I wait until the source is ready less than <time_1> secs And I create a dataset And I wait until the dataset is ready less than <time_2> secs And I create an esemble with "<params>" And I wait until the ensemble is ready less than <time_3> secs And I create a local ensemble When I create a proportional missing strategy prediction for "<data_input>" Then the prediction for "<objective>" is "<prediction>" And the confidence for the prediction is "<confidence>" And I create a proportional missing strategy local prediction for "<data_input>" Then the local prediction is "<prediction>" And the local prediction's confidence is "<confidence>" Examples: | data | time_1 | time_2 | time_3 | data_input | objective | prediction | confidence | params ['data/iris.csv', '10', '10', '50', '{}', '000004', 'Iris-virginica', '0.33784', '{"boosting": {"iterations": 5}}'], """ examples = [ ['data/iris.csv', '10', '10', '50', '{}', '000004', 'Iris-virginica', '0.33784', '{"boosting": {"iterations": 5}}', {}], ['data/iris.csv', '10', '10', '50', '{}', '000004', 'Iris-versicolor', '0.27261', '{"number_of_models": 5"}', {"operating_kind": "confidence"}], ['data/grades.csv', '10', '10', '50', '{}', '000005', '70.505792', '30.7161', '{"number_of_models": 5}', {}], ['data/grades.csv', '10', '10', '50', '{"Midterm": 20}', '000005', '54.82214', '25.89672', '{"number_of_models": 5}', {"operating_kind": "confidence"}], ['data/grades.csv', '10', '10', '50', '{"Midterm": 20}', '000005', '45.4573', '29.58403', '{"number_of_models": 5}', {}], ['data/grades.csv', '10', '10', '50', '{"Midterm": 20, "Tutorial": 90, "TakeHome": 100}', '000005', '42.814', '31.51804', '{"number_of_models": 5}', {}]] show_doc(self.test_scenario7, examples) for example in examples: print "\nTesting with:\n", example source_create.i_upload_a_file(self, example[0]) source_create.the_source_is_finished(self, example[1]) dataset_create.i_create_a_dataset(self) dataset_create.the_dataset_is_finished_in_less_than(self, example[2]) ensemble_create.i_create_an_ensemble_with_params(self, example[8]) ensemble_create.the_ensemble_is_finished_in_less_than(self, example[3]) ensemble_create.create_local_ensemble(self) prediction_create.i_create_an_ensemble_proportional_prediction(self, example[4], example[9]) prediction_create.the_prediction_is(self, example[5], example[6]) prediction_create.the_confidence_is(self, example[7]) prediction_create.create_local_ensemble_proportional_prediction_with_confidence(self, example[4], example[9]) prediction_compare.the_local_ensemble_prediction_is(self, example[6]) prediction_compare.the_local_prediction_confidence_is(self, example[7])
def test_scenario6(self): """ Scenario: Successfully comparing predictions for ensembles: Given I create a data source uploading a "<data>" file And I wait until the source is ready less than <time_1> secs And I create a dataset And I wait until the dataset is ready less than <time_2> secs And I create an ensemble with "<params>" And I wait until the ensemble is ready less than <time_3> secs And I create a local ensemble When I create a prediction for "<data_input>" Then the prediction for "<objective>" is "<prediction>" And I create a local prediction for "<data_input>" Then the local prediction is "<prediction>" Examples: | data | time_1 | time_2 | time_3 | data_input | objective | prediction | params ['data/iris.csv', '10', '10', '120', '{"petal width": 0.5}', '000004', 'Iris-versicolor', '{"number_of_models": 5}'], ['data/iris.csv', '10', '10', '120', '{"petal length": 6, "petal width": 2}', '000004', 'Iris-virginica', '{"number_of_models": 5}'], ['data/iris.csv', '10', '10', '120', '{"petal length": 4, "petal width": 1.5}', '000004', 'Iris-versicolor', '{"number_of_models": 5}'], ['data/grades.csv', '10', '10', '120', '{"Midterm": 20}', '000005', 46.261364, '{"number_of_models": 5}'], ['data/iris.csv', '10', '10', '120', '{"petal width": 0.5}', '000004', 'Iris-setosa', '{"boosting": {"iterations": 5}, "number_of_models": 5}'], ['data/iris.csv', '10', '10', '120', '{"petal length": 6, "petal width": 2}', '000004', 'Iris-virginica', '{"boosting": {"iterations": 5}, "number_of_models": 5}'], ['data/iris.csv', '10', '10', '120', '{"petal length": 4, "petal width": 1.5}', '000004', 'Iris-versicolor', '{"boosting": {"iterations": 5}, "number_of_models": 5}'], """ examples = [ ['data/iris_unbalanced.csv', '30', '30', '120', '{"petal width": 4}', '000004', 'Iris-virginica', '{"boosting": {"iterations": 5}, "number_of_models": 5}'], ['data/grades.csv', '30', '30', '120', '{"Midterm": 20}', '000005', 61.61036, '{"boosting": {"iterations": 5}, "number_of_models": 5}']] show_doc(self.test_scenario6, examples) for example in examples: print "\nTesting with:\n", example source_create.i_upload_a_file(self, example[0]) source_create.the_source_is_finished(self, example[1]) dataset_create.i_create_a_dataset(self) dataset_create.the_dataset_is_finished_in_less_than(self, example[2]) ensemble_create.i_create_an_ensemble_with_params(self, example[7]) ensemble_create.the_ensemble_is_finished_in_less_than(self, example[3]) ensemble_create.create_local_ensemble(self) prediction_create.i_create_an_ensemble_prediction(self, example[4]) prediction_create.the_prediction_is(self, example[5], example[6]) prediction_compare.i_create_a_local_ensemble_prediction(self, example[4]) prediction_compare.the_local_prediction_is(self, example[6])
def test_scenario7(self): """ Scenario: Successfully comparing predictions in operating points for ensembles: Given I create a data source uploading a "<data>" file And I wait until the source is ready less than <time_1> secs And I create a dataset And I wait until the dataset is ready less than <time_2> secs And I create an ensemble And I wait until the ensemble is ready less than <time_3> secs And I create a local ensemble When I create a prediction for "<data_input>" in "<operating_kind>" Then the prediction for "<objective>" is "<prediction>" And I create a local ensemble prediction for "<data_input>" in "<operating_kind>" Then the local ensemble prediction is "<prediction>" Examples: | data | time_1 | time_2 | time_3 | data_input | prediction | operating_kind """ examples = [ ['data/iris.csv', '10', '50', '50', '{"petal length": 2.46}', 'Iris-versicolor', "probability", "000004"], ['data/iris.csv', '10', '50', '50', '{"petal length": 2}', 'Iris-setosa', "probability", "000004"], ['data/iris.csv', '10', '50', '50', '{"petal length": 2.46}', 'Iris-versicolor', "confidence", "000004"], ['data/iris.csv', '10', '50', '50', '{"petal length": 2}', 'Iris-setosa', "confidence", "000004"], ['data/iris.csv', '10', '50', '50', '{"petal length": 2.46}', 'Iris-versicolor', "votes", "000004"], ['data/iris.csv', '10', '50', '50', '{"petal length": 1}', 'Iris-setosa', "votes", "000004"]] show_doc(self.test_scenario7, examples) for example in examples: print "\nTesting with:\n", example source_create.i_upload_a_file(self, example[0]) source_create.the_source_is_finished(self, example[1]) dataset_create.i_create_a_dataset(self) dataset_create.the_dataset_is_finished_in_less_than(self, example[2]) ensemble_create.i_create_an_ensemble(self) ensemble_create.the_ensemble_is_finished_in_less_than(self, example[3]) ensemble_create.create_local_ensemble(self) prediction_create.i_create_an_ensemble_prediction_op_kind(self, example[4], example[6]) prediction_create.the_prediction_is(self, example[7], example[5]) prediction_compare.i_create_a_local_ensemble_prediction_op_kind(self, example[4], example[6]) prediction_compare.the_local_prediction_is(self, example[5])
def test_scenario6(self): """ Scenario: Successfully comparing predictions with raw date input: Given I create a data source uploading a "<data>" file And I wait until the source is ready less than <time_1> secs And I create a dataset And I wait until the dataset is ready less than <time_2> secs And I create an ensemble And I wait until the ensemble is ready less than <time_3> secs And I create a local ensemble When I create a prediction for "<data_input>" Then the prediction for "<objective>" is "<prediction>" And I create a local prediction for "<data_input>" Then the local prediction is "<prediction>" Examples: |data|time_1|time_2|time_3|data_input|objective|prediction| """ examples = [ [ 'data/dates2.csv', 10, 10, 50, '{"time-1": "1910-05-08T19:10:23.106", "cat-0":"cat2"}', '000002', -0.11052 ], [ 'data/dates2.csv', 10, 10, 50, '{"time-1": "1920-06-30T20:21:20.320", "cat-0":"cat1"}', '000002', 0.79179 ], [ 'data/dates2.csv', 10, 10, 50, '{"time-1": "1932-01-30T19:24:11.450", "cat-0":"cat2"}', '000002', -1.00834 ], [ 'data/dates2.csv', 10, 10, 50, '{"time-1": "1950-11-06T05:34:05.252", "cat-0":"cat1"}', '000002', -0.14442 ], [ 'data/dates2.csv', 10, 10, 50, '{"time-1": "1969-7-14 17:36", "cat-0":"cat2"}', '000002', -0.05469 ], [ 'data/dates2.csv', 10, 10, 50, '{"time-1": "2001-01-05T23:04:04.693", "cat-0":"cat2"}', '000002', -0.23387 ], [ 'data/dates2.csv', 10, 10, 50, '{"time-1": "1969-W29-1T17:36:39Z", "cat-0":"cat1"}', '000002', -0.05469 ], [ 'data/dates2.csv', 10, 10, 50, '{"time-1": "Mon Jul 14 17:36 +0000 1969", "cat-0":"cat1"}', '000002', -0.05469 ] ] print self.test_scenario6.__doc__ for example in examples: print "\nTesting with:\n", example source_create.i_upload_a_file(self, example[0]) source_create.the_source_is_finished(self, example[1]) dataset_create.i_create_a_dataset(self) dataset_create.the_dataset_is_finished_in_less_than( self, example[2]) ensemble_create.i_create_an_ensemble(self) ensemble_create.the_ensemble_is_finished_in_less_than( self, example[3]) ensemble_create.create_local_ensemble(self) prediction_create.i_create_an_ensemble_prediction(self, example[4]) prediction_create.the_prediction_is(self, example[5], example[6]) prediction_create.create_local_ensemble_prediction_using_median_with_confidence( self, example[4]) compare_pred.the_local_prediction_is(self, example[6])