def test_scenario1(self): """ Scenario: Successfully creating a prediction in DEV mode: Given I want to use api in DEV mode When I create a data source uploading a "<data>" file And I wait until the source is ready less than <time_1> secs And the source has DEV True 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 When I create a prediction for "<data_input>" Then the prediction for "<objective>" is "<prediction>" Examples: | data | time_1 | time_2 | time_3 | data_input | objective | prediction | | ../data/iris.csv | 10 | 10 | 10 | {"petal width": 0.5} | 000004 | Iris-setosa | """ print self.test_scenario1.__doc__ examples = [ ['data/iris.csv', '10', '10', '10', '{"petal width": 0.5}', '000004', 'Iris-setosa']] 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_read.source_has_dev(self, True) 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_create.i_create_a_prediction(self, example[4]) prediction_create.the_prediction_is(self, example[5], example[6])
def test_scenario1(self): """ Scenario: Successfully creating a prediction using a public model: 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 make the model public And I wait until the model is ready less than <time_3> secs And I check the model status using the model's public url When I create a prediction for "<data_input>" Then the prediction for "<objective>" is "<prediction>" Examples: | data | time_1 | time_2 | time_3 | data_input | objective | prediction | | ../data/iris.csv | 10 | 10 | 10 | {"petal width": 0.5} | 000004 | Iris-setosa | """ print self.test_scenario1.__doc__ examples = [ ['data/iris.csv', '10', '10', '10', '{"petal width": 0.5}', '000004', 'Iris-setosa']] 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]) model_create.make_the_model_public(self) model_create.the_model_is_finished_in_less_than(self, example[3]) model_create.model_from_public_url(self) prediction_create.i_create_a_prediction(self, example[4]) prediction_create.the_prediction_is(self, example[5], example[6])
def test_scenario2(self): """ Scenario: Successfully creating a prediction from a source in a remote location Given I create a data source using the url "<url>" 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 When I create a prediction for "<data_input>" Then the prediction for "<objective>" is "<prediction>" Examples: | url | time_1 | time_2 | time_3 | data_input | objective | prediction | | s3://bigml-public/csv/iris.csv | 10 | 10 | 10 | {"petal width": 0.5} | 000004 | Iris-setosa | """ print self.test_scenario2.__doc__ examples = [ ['s3://bigml-public/csv/iris.csv', '10', '10', '10', '{"petal width": 0.5}', '000004', 'Iris-setosa']] for example in examples: print "\nTesting with:\n", example source_create.i_create_using_url(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_create.i_create_a_prediction(self, example[4]) prediction_create.the_prediction_is(self, example[5], example[6])
def test_scenario1(self): """ Scenario: Successfully creating a prediction with a user's project connection: Given I create a data source uploading a "<data>" file And I wait until the source is ready less than <time_1> secs And the source is in the project 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 When I create a prediction for "<data_input>" Then the prediction for "<objective>" is "<prediction>" Examples: | data | time_1 | time_2 | time_3 | data_input | objective | prediction | | ../data/iris.csv | 10 | 10 | 10 | {"petal width": 0.5} | 000004 | Iris-setosa | """ print self.test_scenario1.__doc__ examples = [ ['data/iris.csv', '10', '10', '10', '{"petal width": 0.5}', '000004', 'Iris-setosa']] for example in examples: print "\nTesting with:\n", example source_create.i_upload_a_file_with_project_conn(self, example[0]) source_create.the_source_is_finished(self, example[1]) assert world.source['project'] == world.project_id dataset_create.i_create_a_dataset(self) dataset_create.the_dataset_is_finished_in_less_than(self, example[2]) assert world.dataset['project'] == world.project_id model_create.i_create_a_model(self) model_create.the_model_is_finished_in_less_than(self, example[3]) assert world.model['project'] == world.project_id prediction_create.i_create_a_prediction(self, example[4]) prediction_create.the_prediction_is(self, example[5], example[6]) assert world.prediction['project'] == world.project_id
def test_scenario1(self): """ Scenario: Successfully creating a prediction: 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 When I create a prediction for "<data_input>" Then the prediction for "<objective>" is "<prediction>" Examples: | data | time_1 | time_2 | time_3 | data_input | objective | prediction | | ../data/iris.csv | 10 | 10 | 10 | {"petal width": 0.5} | 000004 | Iris-setosa | | ../data/iris_sp_chars.csv | 10 | 10 | 10 | {"pétal&width\u0000": 0.5} | 000004 | Iris-setosa | """ print self.test_scenario1.__doc__ examples = [ ["data/iris.csv", "10", "10", "10", '{"petal width": 0.5}', "000004", "Iris-setosa"], ["data/iris_sp_chars.csv", "10", "10", "10", '{"pétal&width\u0000": 0.5}', "000004", "Iris-setosa"], ] 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_create.i_create_a_prediction(self, example[4]) prediction_create.the_prediction_is(self, example[5], example[6])
def test_scenario2(self): """ Scenario: Successfully comparing predictions with text options: 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 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 | options | data_input | objective | prediction | | ../data/spam.csv | 20 | 20 | 30 | {"fields": {"000001": {"optype": "text", "term_analysis": {"case_sensitive": true, "stem_words": true, "use_stopwords": false, "language": "en"}}}} |{"Message": "Mobile call"} | 000000 | ham | | ../data/spam.csv | 20 | 20 | 30 | {"fields": {"000001": {"optype": "text", "term_analysis": {"case_sensitive": true, "stem_words": true, "use_stopwords": false, "language": "en"}}}} |{"Message": "A normal message"} | 000000 | ham | | ../data/spam.csv | 20 | 20 | 30 | {"fields": {"000001": {"optype": "text", "term_analysis": {"case_sensitive": false, "stem_words": false, "use_stopwords": false, "language": "en"}}}} |{"Message": "Mobile calls"} | 000000 | spam | | ../data/spam.csv | 20 | 20 | 30 | {"fields": {"000001": {"optype": "text", "term_analysis": {"case_sensitive": false, "stem_words": false, "use_stopwords": false, "language": "en"}}}} |{"Message": "A normal message"} | 000000 | ham | | ../data/spam.csv | 20 | 20 | 30 | {"fields": {"000001": {"optype": "text", "term_analysis": {"case_sensitive": false, "stem_words": true, "use_stopwords": true, "language": "en"}}}} |{"Message": "Mobile call"} | 000000 | spam | | ../data/spam.csv | 20 | 20 | 30 | {"fields": {"000001": {"optype": "text", "term_analysis": {"case_sensitive": false, "stem_words": true, "use_stopwords": true, "language": "en"}}}} |{"Message": "A normal message"} | 000000 | ham | | ../data/spam.csv | 20 | 20 | 30 | {"fields": {"000001": {"optype": "text", "term_analysis": {"token_mode": "full_terms_only", "language": "en"}}}} |{"Message": "FREE for 1st week! No1 Nokia tone 4 ur mob every week just txt NOKIA to 87077 Get txting and tell ur mates. zed POBox 36504 W45WQ norm150p/tone 16+"} | 000000 | spam | | ../data/spam.csv | 20 | 20 | 30 | {"fields": {"000001": {"optype": "text", "term_analysis": {"token_mode": "full_terms_only", "language": "en"}}}} |{"Message": "Ok"} | 000000 | ham | | ../data/movies.csv | 20 | 20 | 30 | {"fields": {"000007": {"optype": "items", "item_analysis": {"separator": "$"}}}} |{"genres": "Adventure$Action", "timestamp": 993906291, "occupation": "K-12 student"}'| 000009| 3.93064 | ../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 | paperwork | """ print self.test_scenario2.__doc__ examples = [ ['data/spam.csv', '20', '20', '30', '{"fields": {"000001": {"optype": "text", "term_analysis": {"case_sensitive": true, "stem_words": true, "use_stopwords": false, "language": "en"}}}}', '{"Message": "Mobile call"}', '000000', 'ham'], ['data/spam.csv', '20', '20', '30', '{"fields": {"000001": {"optype": "text", "term_analysis": {"case_sensitive": true, "stem_words": true, "use_stopwords": false, "language": "en"}}}}', '{"Message": "A normal message"}', '000000', 'ham'], ['data/spam.csv', '20', '20', '30', '{"fields": {"000001": {"optype": "text", "term_analysis": {"case_sensitive": false, "stem_words": false, "use_stopwords": false, "language": "en"}}}}', '{"Message": "Mobile calls"}', '000000', 'spam'], ['data/spam.csv', '20', '20', '30', '{"fields": {"000001": {"optype": "text", "term_analysis": {"case_sensitive": false, "stem_words": false, "use_stopwords": false, "language": "en"}}}}', '{"Message": "A normal message"}', '000000', 'ham'], ['data/spam.csv', '20', '20', '30', '{"fields": {"000001": {"optype": "text", "term_analysis": {"case_sensitive": false, "stem_words": true, "use_stopwords": true, "language": "en"}}}}', '{"Message": "Mobile call"}', '000000', 'spam'], ['data/spam.csv', '20', '20', '30', '{"fields": {"000001": {"optype": "text", "term_analysis": {"case_sensitive": false, "stem_words": true, "use_stopwords": true, "language": "en"}}}}', '{"Message": "A normal message"}', '000000', 'ham'], ['data/spam.csv', '20', '20', '30', '{"fields": {"000001": {"optype": "text", "term_analysis": {"token_mode": "full_terms_only", "language": "en"}}}}', '{"Message": "FREE for 1st week! No1 Nokia tone 4 ur mob every week just txt NOKIA to 87077 Get txting and tell ur mates. zed POBox 36504 W45WQ norm150p/tone 16+"}', '000000', 'spam'], ['data/spam.csv', '20', '20', '30', '{"fields": {"000001": {"optype": "text", "term_analysis": {"token_mode": "full_terms_only", "language": "en"}}}}', '{"Message": "Ok"}', '000000', 'ham'], ['data/movies.csv', '20', '20', '30', '{"fields": {"000007": {"optype": "items", "item_analysis": {"separator": "$"}}}}', '{"genres": "Adventure$Action", "timestamp": 993906291, "occupation": "K-12 student"}', '000009', '3.93064'], ['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']] 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_prediction(self, example[5]) prediction_create.the_prediction_is(self, example[6], example[7]) prediction_compare.i_create_a_local_prediction(self, example[5]) prediction_compare.the_local_prediction_is(self, example[7])
def test_scenario2(self): """ Scenario: Successfully comparing predictions with text options: 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 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 | options | data_input | objective | prediction | """ examples = [ ['data/spam.csv', '20', '20', '30', '{"fields": {"000001": {"optype": "text", "term_analysis": {"case_sensitive": true, "stem_words": true, "use_stopwords": false, "language": "en"}}}}', '{"Message": "Mobile call"}', '000000', 'spam'], ['data/spam.csv', '20', '20', '30', '{"fields": {"000001": {"optype": "text", "term_analysis": {"case_sensitive": true, "stem_words": true, "use_stopwords": false, "language": "en"}}}}', '{"Message": "A normal message"}', '000000', 'ham'], ['data/spam.csv', '20', '20', '30', '{"fields": {"000001": {"optype": "text", "term_analysis": {"case_sensitive": false, "stem_words": false, "use_stopwords": false, "language": "en"}}}}', '{"Message": "Mobile calls"}', '000000', 'spam'], ['data/spam.csv', '20', '20', '30', '{"fields": {"000001": {"optype": "text", "term_analysis": {"case_sensitive": false, "stem_words": false, "use_stopwords": false, "language": "en"}}}}', '{"Message": "A normal message"}', '000000', 'ham'], ['data/spam.csv', '20', '20', '30', '{"fields": {"000001": {"optype": "text", "term_analysis": {"case_sensitive": false, "stem_words": true, "use_stopwords": true, "language": "en"}}}}', '{"Message": "Mobile call"}', '000000', 'spam'], ['data/spam.csv', '20', '20', '30', '{"fields": {"000001": {"optype": "text", "term_analysis": {"case_sensitive": false, "stem_words": true, "use_stopwords": true, "language": "en"}}}}', '{"Message": "A normal message"}', '000000', 'ham'], ['data/spam.csv', '20', '20', '30', '{"fields": {"000001": {"optype": "text", "term_analysis": {"token_mode": "full_terms_only", "language": "en"}}}}', '{"Message": "FREE for 1st week! No1 Nokia tone 4 ur mob every week just txt NOKIA to 87077 Get txting and tell ur mates. zed POBox 36504 W45WQ norm150p/tone 16+"}', '000000', 'spam'], ['data/spam.csv', '20', '20', '30', '{"fields": {"000001": {"optype": "text", "term_analysis": {"token_mode": "full_terms_only", "language": "en"}}}}', '{"Message": "Ok"}', '000000', 'ham'], ['data/movies.csv', '20', '20', '30', '{"fields": {"000007": {"optype": "items", "item_analysis": {"separator": "$"}}}}', '{"genres": "Adventure$Action", "timestamp": 993906291, "occupation": "K-12 student"}', '000009', '3.93064'], ['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']] show_doc(self.test_scenario2, 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_prediction(self, example[5]) prediction_create.the_prediction_is(self, example[6], example[7]) prediction_compare.i_create_a_local_prediction(self, example[5]) prediction_compare.the_local_prediction_is(self, example[7])
def test_scenario13(self): """ Scenario: Successfully comparing predictions: 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 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/iris.csv', '10', '10', '10', '{"petal width": 0.5}', '000004', 'Iris-setosa', "tmp/my_model.json", "my_test"], ['data/iris.csv', '10', '10', '10', '{"petal length": 6, "petal width": 2}', '000004', 'Iris-virginica', "tmp/my_model.json", "my_test"], ['data/iris.csv', '10', '10', '10', '{"petal length": 4, "petal width": 1.5}', '000004', 'Iris-versicolor', "tmp/my_model.json", "my_test"], ['data/iris_sp_chars.csv', '10', '10', '10', '{"pétal.length": 4, "pétal&width\u0000": 1.5}', '000004', 'Iris-versicolor', "tmp/my_model.json", "my_test"]] show_doc(self.test_scenario13, 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]) args = '{"tags": ["%s"]}' % example[8] model_create.i_create_a_model_with(self, data=args) model_create.the_model_is_finished_in_less_than(self, example[3]) model_create.i_export_model(self, False, example[7]) # no pmml prediction_compare.i_create_a_local_model_from_file(self, example[7]) prediction_create.i_create_a_prediction(self, example[4]) prediction_create.the_prediction_is(self, example[5], example[6]) prediction_compare.i_create_a_local_prediction(self, example[4]) prediction_compare.the_local_prediction_is(self, example[6]) model_create.i_export_tags_model(self, example[7], example[8]) prediction_compare.i_create_a_local_model_from_file(self, example[7]) prediction_compare.i_create_a_local_prediction(self, example[4]) prediction_compare.the_local_prediction_is(self, example[6])
def test_scenario13(self): """ Scenario: Successfully comparing predictions: 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 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/iris.csv', '10', '10', '10', '{"petal width": 0.5}', '000004', 'Iris-setosa', "tmp/my_model.json", "my_test"], ['data/iris.csv', '10', '10', '10', '{"petal length": 6, "petal width": 2}', '000004', 'Iris-virginica', "tmp/my_model.json", "my_test"], ['data/iris.csv', '10', '10', '10', '{"petal length": 4, "petal width": 1.5}', '000004', 'Iris-versicolor', "tmp/my_model.json", "my_test"], ['data/iris_sp_chars.csv', '10', '10', '10', '{"pétal.length": 4, "pétal&width\u0000": 1.5}', '000004', 'Iris-versicolor', "tmp/my_model.json", "my_test"]] show_doc(self.test_scenario13, 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]) args = '{"tags": ["%s"]}' % example[8] model_create.i_create_a_model_with(self, data=args) model_create.the_model_is_finished_in_less_than(self, example[3]) model_create.i_export_model(self, False, example[7]) # no pmml prediction_compare.i_create_a_local_model_from_file(self, example[7]) prediction_create.i_create_a_prediction(self, example[4]) prediction_create.the_prediction_is(self, example[5], example[6]) prediction_compare.i_create_a_local_prediction(self, example[4]) prediction_compare.the_local_prediction_is(self, example[6]) model_create.i_export_tags_model(self, example[7], example[8]) prediction_compare.i_create_a_local_model_from_file(self, example[7]) prediction_compare.i_create_a_local_prediction(self, example[4]) prediction_compare.the_local_prediction_is(self, example[6])
def test_scenario1(self): """ Scenario: Successfully comparing predictions: 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 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 | | ../data/iris.csv | 10 | 10 | 10 | {"petal width": 0.5} | 000004 | Iris-setosa | | ../data/iris.csv | 10 | 10 | 10 | {"petal length": 6, "petal width": 2} | 000004 | Iris-virginica | | ../data/iris.csv | 10 | 10 | 10 | {"petal length": 4, "petal width": 1.5}| 000004 | Iris-versicolor | | ../data/iris_sp_chars.csv | 10 | 10 | 10 | {"pétal.length": 4, "pétal&width\u0000": 1.5}| 000004 | Iris-versicolor | """ print self.test_scenario1.__doc__ examples = [ ['data/iris.csv', '10', '10', '10', '{"petal width": 0.5}', '000004', 'Iris-setosa'], ['data/iris.csv', '10', '10', '10', '{"petal length": 6, "petal width": 2}', '000004', 'Iris-virginica'], ['data/iris.csv', '10', '10', '10', '{"petal length": 4, "petal width": 1.5}', '000004', 'Iris-versicolor'], ['data/iris_sp_chars.csv', '10', '10', '10', '{"pétal.length": 4, "pétal&width\u0000": 1.5}', '000004', 'Iris-versicolor']] 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_prediction(self, example[4]) prediction_create.the_prediction_is(self, example[5], example[6]) prediction_compare.i_create_a_local_prediction(self, example[4]) prediction_compare.the_local_prediction_is(self, example[6])
def test_scenario1(self): """ Scenario: Successfully comparing predictions: 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 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 | | ../data/iris.csv | 10 | 10 | 10 | {"petal width": 0.5} | 000004 | Iris-setosa | | ../data/iris.csv | 10 | 10 | 10 | {"petal length": 6, "petal width": 2} | 000004 | Iris-virginica | | ../data/iris.csv | 10 | 10 | 10 | {"petal length": 4, "petal width": 1.5}| 000004 | Iris-versicolor | | ../data/iris_sp_chars.csv | 10 | 10 | 10 | {"pétal.length": 4, "pétal&width\u0000": 1.5}| 000004 | Iris-versicolor | """ print self.test_scenario1.__doc__ examples = [ ['data/iris.csv', '10', '10', '10', '{"petal width": 0.5}', '000004', 'Iris-setosa'], ['data/iris.csv', '10', '10', '10', '{"petal length": 6, "petal width": 2}', '000004', 'Iris-virginica'], ['data/iris.csv', '10', '10', '10', '{"petal length": 4, "petal width": 1.5}', '000004', 'Iris-versicolor'], ['data/iris_sp_chars.csv', '10', '10', '10', '{"pétal.length": 4, "pétal&width\u0000": 1.5}', '000004', 'Iris-versicolor']] 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_prediction(self, example[4]) prediction_create.the_prediction_is(self, example[5], example[6]) prediction_compare.i_create_a_local_prediction(self, example[4]) prediction_compare.the_local_prediction_is(self, example[6])
def test_scenario1(self): """ Scenario: Successfully creating a prediction using a public model: 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 make the model public And I wait until the model is ready less than <time_3> secs And I check the model status using the model's public url When I create a prediction for "<data_input>" Then the prediction for "<objective>" is "<prediction>" Examples: | data | time_1 | time_2 | time_3 | data_input | objective | prediction | | ../data/iris.csv | 10 | 10 | 10 | {"petal width": 0.5} | 000004 | Iris-setosa | """ print self.test_scenario1.__doc__ examples = [[ 'data/iris.csv', '10', '10', '10', '{"petal width": 0.5}', '000004', 'Iris-setosa' ]] 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]) model_create.make_the_model_public(self) model_create.the_model_is_finished_in_less_than(self, example[3]) model_create.model_from_public_url(self) prediction_create.i_create_a_prediction(self, example[4]) prediction_create.the_prediction_is(self, example[5], example[6])
def test_scenario1(self): """ Scenario: Successfully creating a prediction with a user's project connection: Given I create a data source uploading a "<data>" file And I wait until the source is ready less than <time_1> secs And the source is in the project 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 When I create a prediction for "<data_input>" Then the prediction for "<objective>" is "<prediction>" Examples: | data | time_1 | time_2 | time_3 | data_input | objective | prediction | | ../data/iris.csv | 10 | 10 | 10 | {"petal width": 0.5} | 000004 | Iris-setosa | """ print self.test_scenario1.__doc__ examples = [[ 'data/iris.csv', '10', '10', '10', '{"petal width": 0.5}', '000004', 'Iris-setosa' ]] for example in examples: print "\nTesting with:\n", example source_create.i_upload_a_file_with_project_conn(self, example[0]) source_create.the_source_is_finished(self, example[1]) assert world.source['project'] == world.project_id dataset_create.i_create_a_dataset(self) dataset_create.the_dataset_is_finished_in_less_than( self, example[2]) assert world.dataset['project'] == world.project_id model_create.i_create_a_model(self) model_create.the_model_is_finished_in_less_than(self, example[3]) assert world.model['project'] == world.project_id prediction_create.i_create_a_prediction(self, example[4]) prediction_create.the_prediction_is(self, example[5], example[6]) assert world.prediction['project'] == world.project_id
def test_scenario1(self): """ Scenario: Successfully creating a prediction in DEV mode: Given I want to use api in DEV mode When I create a data source uploading a "<data>" file And I wait until the source is ready less than <time_1> secs And the source has DEV True 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 When I create a prediction for "<data_input>" Then the prediction for "<objective>" is "<prediction>" Examples: | data | time_1 | time_2 | time_3 | data_input | objective | prediction | | ../data/iris.csv | 10 | 10 | 10 | {"petal width": 0.5} | 000004 | Iris-setosa | """ print self.test_scenario1.__doc__ examples = [[ 'data/iris.csv', '10', '10', '10', '{"petal width": 0.5}', '000004', 'Iris-setosa' ]] 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_read.source_has_dev(self, True) 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_create.i_create_a_prediction(self, example[4]) prediction_create.the_prediction_is(self, example[5], example[6])