def test_scenario3(self): """ Scenario: Successfully comparing predictions 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 a model And I wait until the model is ready less than <time_3> secs And I create a local model 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 | | ../data/iris.csv | 10 | 10 | 10 | {} | 000004 | Iris-setosa | 0.2629 | | ../data/grades.csv | 10 | 10 | 10 | {} | 000005 | 68.62224 | 27.5358 | | ../data/grades.csv | 10 | 10 | 10 | {"Midterm": 20} | 000005 | 46.69889 | 37.27594297134128 | | ../data/grades.csv | 10 | 10 | 10 | {"Midterm": 20, "Tutorial": 90, "TakeHome": 100} | 000005 | 28.06 | 24.86634 | """ print self.test_scenario3.__doc__ examples = [[ 'data/iris.csv', '10', '10', '10', '{}', '000004', 'Iris-setosa', '0.2629' ], [ 'data/grades.csv', '10', '10', '10', '{}', '000005', '68.62224', '27.5358' ], [ 'data/grades.csv', '10', '10', '10', '{"Midterm": 20}', '000005', '46.69889', '37.27594297134128' ], [ 'data/grades.csv', '10', '10', '10', '{"Midterm": 20, "Tutorial": 90, "TakeHome": 100}', '000005', '28.06', '24.86634' ]] 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]) model_create.i_create_a_model(self) model_create.the_model_is_finished_in_less_than(self, example[3]) prediction_compare.i_create_a_local_model(self) prediction_create.i_create_a_proportional_prediction( self, example[4]) prediction_create.the_prediction_is(self, example[5], example[6]) prediction_compare.i_create_a_proportional_local_prediction( self, example[4]) prediction_compare.the_local_prediction_is(self, example[6])
def test_scenario10(self): """ Scenario: Successfully comparing predictions with proportional missing strategy and balanced models: 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 a balanced model And I wait until the model is ready less than <time_3> secs And I create a local model 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>" And I create local probabilities for "<data_input>" Then the local probabilities are "<probabilities>" Examples: | data | time_1 | time_2 | time_3 | data_input | objective | prediction | confidence | """ examples = [ [ 'data/iris_unbalanced.csv', '10', '10', '10', '{}', '000004', 'Iris-setosa', '0.25284', '[0.33333, 0.33333, 0.33333]' ], [ 'data/iris_unbalanced.csv', '10', '10', '10', '{"petal length":1, "sepal length":1, "petal width": 1, "sepal width": 1}', '000004', 'Iris-setosa', '0.7575', '[1.0, 0.0, 0.0]' ] ] show_doc(self.test_scenario10, 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]) model_create.i_create_a_balanced_model(self) model_create.the_model_is_finished_in_less_than(self, example[3]) prediction_compare.i_create_a_local_model(self) prediction_create.i_create_a_proportional_prediction( self, example[4]) prediction_create.the_prediction_is(self, example[5], example[6]) prediction_compare.i_create_a_proportional_local_prediction( self, example[4]) prediction_compare.the_local_prediction_is(self, example[6]) prediction_create.the_confidence_is(self, example[7]) prediction_compare.the_local_prediction_confidence_is( self, example[7]) prediction_compare.i_create_local_probabilities(self, example[4]) prediction_compare.the_local_probabilities_are(self, example[8])
def test_scenario3(self): """ Scenario: Successfully comparing predictions 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 a model And I wait until the model is ready less than <time_3> secs And I create a local model 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 | | ../data/iris.csv | 10 | 10 | 10 | {} | 000004 | Iris-setosa | 0.2629 | | ../data/grades.csv | 10 | 10 | 10 | {} | 000005 | 68.62224 | 27.5358 | | ../data/grades.csv | 10 | 10 | 10 | {"Midterm": 20} | 000005 | 46.69889 | 37.27594297134128 | | ../data/grades.csv | 10 | 10 | 10 | {"Midterm": 20, "Tutorial": 90, "TakeHome": 100} | 000005 | 28.06 | 24.86634 | """ print self.test_scenario3.__doc__ examples = [ ["data/iris.csv", "10", "10", "10", "{}", "000004", "Iris-setosa", "0.2629"], ["data/grades.csv", "10", "10", "10", "{}", "000005", "68.62224", "27.5358"], ["data/grades.csv", "10", "10", "10", '{"Midterm": 20}', "000005", "46.69889", "37.27594297134128"], [ "data/grades.csv", "10", "10", "10", '{"Midterm": 20, "Tutorial": 90, "TakeHome": 100}', "000005", "28.06", "24.86634", ], ] 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]) model_create.i_create_a_model(self) model_create.the_model_is_finished_in_less_than(self, example[3]) prediction_compare.i_create_a_local_model(self) prediction_create.i_create_a_proportional_prediction(self, example[4]) prediction_create.the_prediction_is(self, example[5], example[6]) prediction_compare.i_create_a_proportional_local_prediction(self, example[4]) prediction_compare.the_local_prediction_is(self, example[6])
def test_scenario6(self): """ Scenario: Successfully comparing predictions with proportional missing strategy for missing_splits models: 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 a model with missing splits And I wait until the model is ready less than <time_3> secs And I create a local model 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 | | ../data/iris_missing2.csv | 10 | 10 | 10 | {"petal width": 1} | 000004 | Iris-setosa | 0.8064 | | ../data/iris_missing2.csv | 10 | 10 | 10 | {"petal width": 1, "petal length": 4} | 000004 | Iris-versicolor | 0.7847 | """ print self.test_scenario6.__doc__ examples = [[ 'data/iris_missing2.csv', '10', '10', '10', '{"petal width": 1}', '000004', 'Iris-setosa', '0.8064' ], [ 'data/iris_missing2.csv', '10', '10', '10', '{"petal width": 1, "petal length": 4}', '000004', 'Iris-versicolor', '0.7847' ]] 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]) model_create.i_create_a_model_with_missing_splits(self) model_create.the_model_is_finished_in_less_than(self, example[3]) prediction_compare.i_create_a_local_model(self) prediction_create.i_create_a_proportional_prediction( self, example[4]) prediction_create.the_prediction_is(self, example[5], example[6]) prediction_create.the_confidence_is(self, example[7]) prediction_compare.i_create_a_proportional_local_prediction( self, example[4]) prediction_compare.the_local_prediction_is(self, example[6]) prediction_compare.the_local_prediction_confidence_is( self, example[7])
def test_scenario6(self): """ Scenario: Successfully comparing predictions with proportional missing strategy for missing_splits models: 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 a model with missing splits And I wait until the model is ready less than <time_3> secs And I create a local model 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 | | ../data/iris_missing2.csv | 10 | 10 | 10 | {"petal width": 1} | 000004 | Iris-setosa | 0.8064 | | ../data/iris_missing2.csv | 10 | 10 | 10 | {"petal width": 1, "petal length": 4} | 000004 | Iris-versicolor | 0.7847 | """ print self.test_scenario6.__doc__ examples = [ ["data/iris_missing2.csv", "10", "10", "10", '{"petal width": 1}', "000004", "Iris-setosa", "0.8064"], [ "data/iris_missing2.csv", "10", "10", "10", '{"petal width": 1, "petal length": 4}', "000004", "Iris-versicolor", "0.7847", ], ] 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]) model_create.i_create_a_model_with_missing_splits(self) model_create.the_model_is_finished_in_less_than(self, example[3]) prediction_compare.i_create_a_local_model(self) prediction_create.i_create_a_proportional_prediction(self, example[4]) prediction_create.the_prediction_is(self, example[5], example[6]) prediction_create.the_confidence_is(self, example[7]) prediction_compare.i_create_a_proportional_local_prediction(self, example[4]) prediction_compare.the_local_prediction_is(self, example[6]) prediction_compare.the_local_prediction_confidence_is(self, example[7])
def test_scenario8(self): """ Scenario: Successfully comparing predictions with text options and 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 update the source with params "<options>" And I create a dataset And I wait until the dataset is ready less than <time_2> secs And I create a model And I wait until the model is ready less than <time_3> secs And I create a local model When I create a proportional missing strategy prediction for "<data_input>" Then the prediction for "<objective>" is "<prediction>" And I create a proportional missing strategy local prediction for "<data_input>" Then the local prediction is "<prediction>" Examples: """ examples = [ [ 'data/text_missing.csv', '20', '20', '30', '{"fields": {"000001": {"optype": "text", "term_analysis": {"token_mode": "all", "language": "en"}}, "000000": {"optype": "text", "term_analysis": {"token_mode": "all", "language": "en"}}}}', '{}', "000003", 'swap' ], [ 'data/text_missing.csv', '20', '20', '30', '{"fields": {"000001": {"optype": "text", "term_analysis": {"token_mode": "all", "language": "en"}}, "000000": {"optype": "text", "term_analysis": {"token_mode": "all", "language": "en"}}}}', '{"category1": "a"}', "000003", 'paperwork' ] ] show_doc(self.test_scenario8, 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]) source_create.i_update_source_with(self, example[4]) dataset_create.i_create_a_dataset(self) dataset_create.the_dataset_is_finished_in_less_than( self, example[2]) model_create.i_create_a_model(self) model_create.the_model_is_finished_in_less_than(self, example[3]) prediction_compare.i_create_a_local_model(self) prediction_create.i_create_a_proportional_prediction( self, example[5]) prediction_create.the_prediction_is(self, example[6], example[7]) prediction_compare.i_create_a_proportional_local_prediction( self, example[5]) prediction_compare.the_local_prediction_is(self, example[7])
def test_scenario10(self): """ Scenario: Successfully comparing predictions with proportional missing strategy and balanced models: 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 a balanced model And I wait until the model is ready less than <time_3> secs And I create a local model 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>" And I create local probabilities for "<data_input>" Then the local probabilities are "<probabilities>" Examples: | data | time_1 | time_2 | time_3 | data_input | objective | prediction | confidence | """ examples = [ ['data/iris_unbalanced.csv', '10', '10', '10', '{}', '000004', 'Iris-setosa', '0.25284', '[0.33333, 0.33333, 0.33333]'], ['data/iris_unbalanced.csv', '10', '10', '10', '{"petal length":1, "sepal length":1, "petal width": 1, "sepal width": 1}', '000004', 'Iris-setosa', '0.7575', '[1.0, 0.0, 0.0]']] show_doc(self.test_scenario10, 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]) model_create.i_create_a_balanced_model(self) model_create.the_model_is_finished_in_less_than(self, example[3]) prediction_compare.i_create_a_local_model(self) prediction_create.i_create_a_proportional_prediction(self, example[4]) prediction_create.the_prediction_is(self, example[5], example[6]) prediction_compare.i_create_a_proportional_local_prediction(self, example[4]) prediction_compare.the_local_prediction_is(self, example[6]) prediction_create.the_confidence_is(self, example[7]) prediction_compare.the_local_prediction_confidence_is(self, example[7]) prediction_compare.i_create_local_probabilities(self, example[4]) prediction_compare.the_local_probabilities_are(self, example[8])
def test_scenario3(self): """ Scenario: Successfully comparing predictions 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 a model And I wait until the model is ready less than <time_3> secs And I create a local model 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 | """ examples = [ ['data/iris.csv', '10', '10', '10', '{}', '000004', 'Iris-setosa', '0.2629'], ['data/grades.csv', '10', '10', '10', '{}', '000005', '68.62224', '27.5358'], ['data/grades.csv', '10', '10', '10', '{"Midterm": 20}', '000005', '40.46667', '54.89713'], ['data/grades.csv', '10', '10', '10', '{"Midterm": 20, "Tutorial": 90, "TakeHome": 100}', '000005', '28.06', '25.65806']] show_doc(self.test_scenario3, 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]) model_create.i_create_a_model(self) model_create.the_model_is_finished_in_less_than(self, example[3]) prediction_compare.i_create_a_local_model(self) prediction_create.i_create_a_proportional_prediction(self, example[4]) prediction_create.the_prediction_is(self, example[5], example[6]) prediction_create.the_confidence_is(self, example[7]) prediction_compare.i_create_a_proportional_local_prediction(self, example[4]) prediction_compare.the_local_prediction_is(self, example[6]) prediction_compare.the_local_prediction_confidence_is(self, example[7])
def test_scenario11(self): """ Scenario: Successfully comparing predictions with text options and 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 update the source with params "<options>" And I create a dataset And I wait until the dataset is ready less than <time_2> secs And I create a model And I wait until the model is ready less than <time_3> secs And I create a local model When I create a proportional missing strategy prediction for "<data_input>" Then the prediction for "<objective>" is "<prediction>" And I create a proportional missing strategy local prediction for "<data_input>" Then the local prediction is "<prediction>" Examples: | ../data/text_missing.csv | 20 | 20 | 30 | {"fields": {"000001": {"optype": "text", "term_analysis": {"token_mode": "all", "language": "en"}}, {"000000": {"optype": "text", "term_analysis": {"token_mode": "all", "language": "en"}}}} |{} | paperwork | """ print self.test_scenario11.__doc__ examples = [ ['data/text_missing.csv', '20', '20', '30', '{"fields": {"000001": {"optype": "text", "term_analysis": {"token_mode": "all", "language": "en"}}, "000000": {"optype": "text", "term_analysis": {"token_mode": "all", "language": "en"}}}}', '{}', "000003",'swap'], ['data/text_missing.csv', '20', '20', '30', '{"fields": {"000001": {"optype": "text", "term_analysis": {"token_mode": "all", "language": "en"}}, "000000": {"optype": "text", "term_analysis": {"token_mode": "all", "language": "en"}}}}', '{"category1": "a"}', "000003",'paperwork']] 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]) source_create.i_update_source_with(self, example[4]) dataset_create.i_create_a_dataset(self) dataset_create.the_dataset_is_finished_in_less_than(self, example[2]) model_create.i_create_a_model(self) model_create.the_model_is_finished_in_less_than(self, example[3]) prediction_compare.i_create_a_local_model(self) prediction_create.i_create_a_proportional_prediction(self, example[5]) prediction_create.the_prediction_is(self, example[6], example[7]) prediction_compare.i_create_a_proportional_local_prediction(self, example[5]) prediction_compare.the_local_prediction_is(self, example[7])