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_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_scenario2(self): """ Scenario: Successfully creating a batch prediction for 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 When I create a batch prediction for the dataset with the ensemble And I wait until the batch prediction is ready less than <time_4> secs And I download the created predictions file to "<local_file>" Then the batch prediction file is like "<predictions_file>" Examples: | data | time_1 | time_2 | number_of_models | tlp | time_3 | time_4 | local_file | predictions_file | | ../data/iris.csv | 30 | 30 | 5 | 1 | 80 | 50 | ./tmp/batch_predictions.csv | ./data/batch_predictions_e.csv | """ print self.test_scenario2.__doc__ examples = [ ['data/iris.csv', '30', '30', '5', '1', '80', '50', 'tmp/batch_predictions.csv', 'data/batch_predictions_e.csv']] 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[3], example[4]) ensemble_create.the_ensemble_is_finished_in_less_than(self, example[5]) batch_pred_create.i_create_a_batch_prediction_ensemble(self) batch_pred_create.the_batch_prediction_is_finished_in_less_than(self, example[6]) batch_pred_create.i_download_predictions_file(self, example[7]) batch_pred_create.i_check_predictions(self, example[8])
def test_scenario2(self): """ Scenario 2: Successfully creating a local ensemble from an exported file: 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 export the ensemble to "<exported_file>" When I create a local ensemble from the file "<exported_file>" Then the ensemble ID and the local ensemble ID match Examples: | data | time_1 | time_2 | time_3 | exported_file | ../data/iris.csv | 10 | 10 | 50 | ./tmp/ensemble.json """ print self.test_scenario2.__doc__ examples = [ ['data/iris.csv', '10', '10', '50', './tmp/ensemble.json']] 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.i_export_ensemble(self, example[4]) ensemble_create.i_create_local_ensemble_from_file(self, example[4]) ensemble_create.check_ensemble_id_local_id(self)
def test_scenario2(self): """ Scenario: Successfully creating an evaluation for 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 When I create an evaluation for the ensemble with the dataset And I wait until the evaluation is ready less than <time_4> secs Then the measured "<measure>" is <value> Examples: | data | time_1 | time_2 | number_of_models | tlp | time_3 | time_4 | measure | value | | ../data/iris.csv | 30 | 30 | 5 | 1 | 50 | 30 | average_phi | 0.98029 | """ print self.test_scenario2.__doc__ examples = [ ['data/iris.csv', '50', '50', '5', '1', '80', '80', 'average_phi', '0.98029']] 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[3], example[4]) ensemble_create.the_ensemble_is_finished_in_less_than(self, example[5]) evaluation_create.i_create_an_evaluation_ensemble(self) evaluation_create.the_evaluation_is_finished_in_less_than(self, example[6]) evaluation_create.the_measured_measure_is_value(self, example[7], example[8])
def test_scenario1(self): """ Scenario: Successfully creating a 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 When I create an ensemble prediction for "<data_input>" And I wait until the prediction is ready less than <time_4> secs Then the prediction for "<objective>" is "<prediction>" Examples: | data | time_1 | time_2 | time_3 | time_4 | number_of_models | tlp | data_input | objective | prediction | | ../data/iris.csv | 10 | 10 | 50 | 20 | 5 | 1 | {"petal width": 0.5} | 000004 | Iris-versicolor | | ../data/iris_sp_chars.csv | 10 | 10 | 50 | 20 | 5 | 1 | {"pétal&width\u0000": 0.5} | 000004 | Iris-versicolor | | ../data/grades.csv | 10 | 10 | 150 | 20 | 10 | 1 | {"Assignment": 81.22, "Tutorial": 91.95, "Midterm": 79.38, "TakeHome": 105.93} | 000005 | 88.205575 | | ../data/grades.csv | 10 | 10 | 150 | 20 | 10 | 1 | {"Assignment": 97.33, "Tutorial": 106.74, "Midterm": 76.88, "TakeHome": 108.89} | 000005 | 84.29401 | """ print self.test_scenario1.__doc__ examples = [ [ 'data/iris.csv', '30', '30', '50', '20', '5', '1', '{"petal width": 0.5}', '000004', 'Iris-versicolor' ], [ 'data/iris_sp_chars.csv', '30', '30', '50', '20', '5', '1', '{"pétal&width\u0000": 0.5}', '000004', 'Iris-versicolor' ], [ 'data/grades.csv', '30', '30', '150', '20', '10', '1', '{"Assignment": 81.22, "Tutorial": 91.95, "Midterm": 79.38, "TakeHome": 105.93}', '000005', '84.556' ], [ 'data/grades.csv', '30', '30', '150', '20', '10', '1', '{"Assignment": 97.33, "Tutorial": 106.74, "Midterm": 76.88, "TakeHome": 108.89}', '000005', '73.13558' ] ] 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[5], example[6]) ensemble_create.the_ensemble_is_finished_in_less_than( self, example[3]) prediction_create.i_create_an_ensemble_prediction(self, example[7]) prediction_create.the_prediction_is_finished_in_less_than( self, example[4]) prediction_create.the_prediction_is(self, example[8], example[9])
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_scenario2(self): """ Scenario: Successfully creating an evaluation for 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 When I create an evaluation for the ensemble with the dataset And I wait until the evaluation is ready less than <time_4> secs Then the measured "<measure>" is <value> Examples: | data | time_1 | time_2 | number_of_models | tlp | time_3 | time_4 | measure | value | | ../data/iris.csv | 30 | 30 | 5 | 1 | 50 | 30 | average_phi | 0.98029 | """ print self.test_scenario2.__doc__ examples = [[ 'data/iris.csv', '50', '50', '5', '1', '80', '80', 'average_phi', '0.98029' ]] 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[3], example[4]) ensemble_create.the_ensemble_is_finished_in_less_than( self, example[5]) evaluation_create.i_create_an_evaluation_ensemble(self) evaluation_create.the_evaluation_is_finished_in_less_than( self, example[6]) evaluation_create.the_measured_measure_is_value( self, example[7], example[8])
def test_scenario1(self): """ Scenario: Successfully creating a 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 When I create an ensemble prediction for "<data_input>" And I wait until the prediction is ready less than <time_4> secs Then the prediction for "<objective>" is "<prediction>" Examples: | data | time_1 | time_2 | time_3 | time_4 | number_of_models | tlp | data_input | objective | prediction | | ../data/iris.csv | 10 | 10 | 50 | 20 | 5 | 1 | {"petal width": 0.5} | 000004 | Iris-versicolor | | ../data/iris_sp_chars.csv | 10 | 10 | 50 | 20 | 5 | 1 | {"pétal&width\u0000": 0.5} | 000004 | Iris-versicolor | | ../data/grades.csv | 10 | 10 | 150 | 20 | 10 | 1 | {"Assignment": 81.22, "Tutorial": 91.95, "Midterm": 79.38, "TakeHome": 105.93} | 000005 | 88.205575 | | ../data/grades.csv | 10 | 10 | 150 | 20 | 10 | 1 | {"Assignment": 97.33, "Tutorial": 106.74, "Midterm": 76.88, "TakeHome": 108.89} | 000005 | 84.29401 | """ print self.test_scenario1.__doc__ examples = [ ['data/iris.csv', '10', '10', '50', '20', '5', '1', '{"petal width": 0.5}', '000004', 'Iris-versicolor'], ['data/iris_sp_chars.csv', '10', '10', '50', '20', '5', '1', '{"pétal&width\u0000": 0.5}', '000004', 'Iris-versicolor'], ['data/grades.csv', '10', '10', '150', '20', '10', '1', '{"Assignment": 81.22, "Tutorial": 91.95, "Midterm": 79.38, "TakeHome": 105.93}', '000005', '88.205575'], ['data/grades.csv', '10', '10', '150', '20', '10', '1', '{"Assignment": 97.33, "Tutorial": 106.74, "Midterm": 76.88, "TakeHome": 108.89}', '000005', '84.29401']] 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[5], example[6]) ensemble_create.the_ensemble_is_finished_in_less_than(self, example[3]) prediction_create.i_create_an_ensemble_prediction(self, example[7]) prediction_create.the_prediction_is_finished_in_less_than(self, example[4]) prediction_create.the_prediction_is(self, example[8], example[9])
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])