def test_scenario06(self): """ Scenario: Successfully building batch test predictions from model Given I have previously executed "<scenario>" or reproduce it with arguments <kwargs> And I create BigML logistic regression resources using model to test "<test>" as a batch prediction and log predictions in "<output>" And I check that the predictions are ready Then the local prediction file is like "<predictions_file>" Examples: |scenario | kwargs | test | output |predictions_file | | scenario1| {"data": "../data/iris.csv", "output": "./scenario1/predictions.csv", "test": "../data/test_iris.csv"} | ../data/test_iris.csv | ./scenario4/predictions.csv | ./check_files/predictions_iris.csv | """ print self.test_scenario06.__doc__ examples = [[ 'scenario1_lr', '{"data": "data/iris.csv", "output": "scenario1_lr/predictions.csv", "test": "data/test_iris.csv"}', 'data/test_iris.csv', 'scenario5_lr/predictions.csv', 'check_files/predictions_iris_lr.csv' ]] for example in examples: print "\nTesting with:\n", example test_pred.i_have_previous_scenario_or_reproduce_it( self, example[0], example[1]) lr_pred.i_create_lr_resources_from_model_remote(self, test=example[2], output=example[3]) batch_pred.i_check_create_batch_prediction(self) test_pred.i_check_create_predictions(self) test_pred.i_check_predictions(self, example[4])
def setup_scenario2(self): """ Scenario 2: Successfully building test predictions from scratch: Given I create BigML resources uploading train "<data>" file to test "<test>" remotely 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 model has been created And I check that the source has been created from the test file And I check that the dataset has been created from the test file And I check that the batch prediction has been created And I check that the predictions are ready Then the local prediction file is like "<predictions_file>" Examples: | data | test | output |predictions_file | | ../data/iris.csv | ../data/test_iris.csv | ./scenario_r1/predictions.csv | ./check_files/predictions_iris.csv | """ print self.setup_scenario2.__doc__ examples = [ ['data/iris.csv', 'data/test_iris.csv', 'scenario_r1/predictions.csv', 'check_files/predictions_iris.csv']] for example in examples: print "\nTesting with:\n", example test_pred.i_create_all_resources_batch(self, data=example[0], test=example[1], output=example[2]) test_pred.i_check_create_source(self) test_pred.i_check_create_dataset(self, suffix=None) test_pred.i_check_create_model(self) test_batch_pred.i_check_create_test_source(self) test_batch_pred.i_check_create_test_dataset(self) test_batch_pred.i_check_create_batch_prediction(self) test_pred.i_check_create_predictions(self) test_pred.i_check_predictions(self, example[3])
def test_scenario5(self): """ Scenario 5: Successfully building test predictions from dataset and prediction format info Given I have previously executed "<scenario>" or reproduce it with arguments <kwargs> And I create BigML resources using a model to test the previous test dataset remotely with prediction headers and fields "<fields>" and log predictions in "<output>" And I check that the batch prediction has been created And I check that the predictions are ready Then the local prediction file is like "<predictions_file>" Examples: |scenario | kwargs | fields | output |predictions_file | | scenario_r1| {"data": "../data/iris.csv", "output": "./scenario_r1/predictions.csv", "test": "../data/test_iris.csv"} | sepal length,sepal width | ./scenario_r4/predictions.csv | ./check_files/predictions_iris_format.csv | """ print self.test_scenario5.__doc__ examples = [ ['scenario_r1', '{"data": "data/iris.csv", "output": "scenario_r1/predictions.csv", "test": "data/test_iris.csv"}', 'sepal length,sepal width', 'scenario_r4/predictions.csv', 'check_files/predictions_iris_format.csv']] for example in examples: print "\nTesting with:\n", example test_pred.i_have_previous_scenario_or_reproduce_it(self, example[0], example[1]) test_pred.i_create_resources_from_model_batch(self, fields=example[2], output=example[3]) test_batch_pred.i_check_create_batch_prediction(self) test_pred.i_check_create_predictions(self) test_pred.i_check_predictions(self, example[4])
def test_scenario6(self): """ Scenario 6: Successfully building remote test predictions from scratch to a dataset: Given I create BigML resources uploading train "<data>" file to test "<test>" remotely to a dataset with no CSV output and log resources in "<output_dir>" And I check that the source has been created And I check that the dataset has been created And I check that the model has been created And I check that the source has been created from the test file And I check that the dataset has been created from the test file And I check that the batch prediction has been created Then I check that the batch predictions dataset exists And no local CSV file is created Examples: | data | test | output_dir | | ../data/iris.csv | ../data/test_iris.csv | ./scenario_r5 | """ print self.test_scenario6.__doc__ examples = [ ['data/iris.csv', 'data/test_iris.csv', 'scenario_r5']] for example in examples: print "\nTesting with:\n", example test_pred.i_create_all_resources_batch_to_dataset(self, data=example[0], test=example[1], output_dir=example[2]) test_pred.i_check_create_source(self) test_pred.i_check_create_dataset(self, suffix=None) test_pred.i_check_create_model(self) test_batch_pred.i_check_create_test_source(self) test_batch_pred.i_check_create_test_dataset(self) test_batch_pred.i_check_create_batch_prediction(self) test_batch_pred.i_check_create_batch_predictions_dataset(self) anomaly_pred.i_check_no_local_CSV(self)
def test_scenario07(self): """ Scenario: Successfully building batch test predictions from model with customized output Given I have previously executed "<scenario>" or reproduce it with arguments <kwargs> And I create BigML deepnet resources using model to test "<test>" as a batch prediction with output format "<batch-output>" and log predictions in "<output>" And I check that the predictions are ready Then the local prediction file is like "<predictions_file>" Examples: |scenario | kwargs | test |batch_output | output |predictions_file | | scenario1| {"data": "../data/iris.csv", "output": "./scenario1/predictions.csv", "test": "../data/test_iris.csv"} | ../data/test_iris.csv | ../data/batch_output.json | ./scenario6_dn/predictions.csv | ./check_files/predictions_iris.csv | """ print self.test_scenario07.__doc__ examples = [[ 'scenario1_dn', '{"data": "data/iris.csv", "output": "scenario1_dn/predictions.csv", "test": "data/test_iris.csv"}', 'data/test_iris.csv', 'data/batch_output.json', 'scenario6_dn/predictions.csv', 'check_files/predictions_iris_dn_prob.csv' ]] for example in examples: print "\nTesting with:\n", example test_pred.i_have_previous_scenario_or_reproduce_it( self, example[0], example[1]) dn_pred.i_create_dn_resources_from_model_remote_with_options( self, test=example[2], output=example[4], options_file=example[3]) batch_pred.i_check_create_batch_prediction(self) test_pred.i_check_create_predictions(self) test_pred.i_check_predictions(self, example[5])
def test_scenario4(self): """ Scenario 4: Successfully building test predictions from dataset Given I have previously executed "<scenario>" or reproduce it with arguments <kwargs> And I create BigML resources using dataset to test the previous test dataset remotely and log predictions in "<output>" And I check that the model has been created And I check that the batch prediction has been created And I check that the predictions are ready Then the local prediction file is like "<predictions_file>" Examples: |scenario | kwargs | test | output |predictions_file | | scenario_r1| {"data": "../data/iris.csv", "output": "./scenario_r1/predictions.csv", "test": "../data/test_iris.csv"} | ../data/test_iris.csv | ./scenario_r3/predictions.csv | ./check_files/predictions_iris.csv | """ print self.test_scenario4.__doc__ examples = [ ['scenario_r1', '{"data": "data/iris.csv", "output": "scenario_r1/predictions.csv", "test": "data/test_iris.csv"}', 'scenario_r3/predictions.csv', 'check_files/predictions_iris.csv']] for example in examples: print "\nTesting with:\n", example test_pred.i_have_previous_scenario_or_reproduce_it(self, example[0], example[1]) test_pred.i_create_resources_from_dataset_batch(self, output=example[2]) test_pred.i_check_create_model(self) test_batch_pred.i_check_create_batch_prediction(self) test_pred.i_check_create_predictions(self) test_pred.i_check_predictions(self, example[3])
def test_scenario5(self): """ Scenario 5: Successfully building test predictions from dataset and prediction format info Given I have previously executed "<scenario>" or reproduce it with arguments <kwargs> And I create BigML resources using a model to test the previous test dataset remotely with prediction headers and fields "<fields>" and log predictions in "<output>" And I check that the batch prediction has been created And I check that the predictions are ready Then the local prediction file is like "<predictions_file>" Examples: |scenario | kwargs | fields | output |predictions_file | | scenario_r1| {"data": "../data/iris.csv", "output": "./scenario_r1/predictions.csv", "test": "../data/test_iris.csv"} | sepal length,sepal width | ./scenario_r4/predictions.csv | ./check_files/predictions_iris_format.csv | """ print self.test_scenario5.__doc__ examples = [[ 'scenario_r1', '{"data": "data/iris.csv", "output": "scenario_r1/predictions.csv", "test": "data/test_iris.csv"}', 'sepal length,sepal width', 'scenario_r4/predictions.csv', 'check_files/predictions_iris_format.csv' ]] for example in examples: print "\nTesting with:\n", example test_pred.i_have_previous_scenario_or_reproduce_it( self, example[0], example[1]) test_pred.i_create_resources_from_model_batch(self, fields=example[2], output=example[3]) test_batch_pred.i_check_create_batch_prediction(self) test_pred.i_check_create_predictions(self) test_pred.i_check_predictions(self, example[4])
def test_scenario6(self): """ Scenario 6: Successfully building remote test predictions from scratch to a dataset: Given I create BigML resources uploading train "<data>" file to test "<test>" remotely to a dataset with no CSV output and log resources in "<output_dir>" And I check that the source has been created And I check that the dataset has been created And I check that the model has been created And I check that the source has been created from the test file And I check that the dataset has been created from the test file And I check that the batch prediction has been created Then I check that the batch predictions dataset exists And no local CSV file is created Examples: | data | test | output_dir | | ../data/iris.csv | ../data/test_iris.csv | ./scenario_r5 | """ print self.test_scenario6.__doc__ examples = [['data/iris.csv', 'data/test_iris.csv', 'scenario_r5']] for example in examples: print "\nTesting with:\n", example test_pred.i_create_all_resources_batch_to_dataset( self, data=example[0], test=example[1], output_dir=example[2]) test_pred.i_check_create_source(self) test_pred.i_check_create_dataset(self, suffix=None) test_pred.i_check_create_model(self) test_batch_pred.i_check_create_test_source(self) test_batch_pred.i_check_create_test_dataset(self) test_batch_pred.i_check_create_batch_prediction(self) test_batch_pred.i_check_create_batch_predictions_dataset(self) anomaly_pred.i_check_no_local_CSV(self)
def test_scenario4(self): """ Scenario 4: Successfully building test predictions from dataset Given I have previously executed "<scenario>" or reproduce it with arguments <kwargs> And I create BigML resources using dataset to test the previous test dataset remotely and log predictions in "<output>" And I check that the model has been created And I check that the batch prediction has been created And I check that the predictions are ready Then the local prediction file is like "<predictions_file>" Examples: |scenario | kwargs | test | output |predictions_file | | scenario_r1| {"data": "../data/iris.csv", "output": "./scenario_r1/predictions.csv", "test": "../data/test_iris.csv"} | ../data/test_iris.csv | ./scenario_r3/predictions.csv | ./check_files/predictions_iris.csv | """ print self.test_scenario4.__doc__ examples = [[ 'scenario_r1', '{"data": "data/iris.csv", "output": "scenario_r1/predictions.csv", "test": "data/test_iris.csv"}', 'scenario_r3/predictions.csv', 'check_files/predictions_iris.csv' ]] for example in examples: print "\nTesting with:\n", example test_pred.i_have_previous_scenario_or_reproduce_it( self, example[0], example[1]) test_pred.i_create_resources_from_dataset_batch(self, output=example[2]) test_pred.i_check_create_model(self) test_batch_pred.i_check_create_batch_prediction(self) test_pred.i_check_create_predictions(self) test_pred.i_check_predictions(self, example[3])
def setup_scenario2(self): """ Scenario 2: Successfully building test predictions from scratch: Given I create BigML resources uploading train "<data>" file to test "<test>" remotely 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 model has been created And I check that the source has been created from the test file And I check that the dataset has been created from the test file And I check that the batch prediction has been created And I check that the predictions are ready Then the local prediction file is like "<predictions_file>" Examples: | data | test | output |predictions_file | | ../data/iris.csv | ../data/test_iris.csv | ./scenario_r1/predictions.csv | ./check_files/predictions_iris.csv | """ print self.setup_scenario2.__doc__ examples = [ ['data/iris.csv', 'data/test_iris.csv', 'scenario_r1/predictions.csv', 'check_files/predictions_iris.csv']] for example in examples: print "\nTesting with:\n", example test_pred.i_create_all_resources_batch(self, data=example[0], test=example[1], output=example[2]) test_pred.i_check_create_source(self) test_pred.i_check_create_dataset(self, suffix=None) test_pred.i_check_create_model(self) test_batch_pred.i_check_create_test_source(self) test_batch_pred.i_check_create_test_dataset(self) test_batch_pred.i_check_create_batch_prediction(self) test_pred.i_check_create_predictions(self) test_pred.i_check_predictions(self, example[3])
def test_scenario7(self): """ Scenario: Successfully building test predictions from model with operating point Given I have previously executed "<scenario>" or reproduce it with arguments <kwargs> And I create BigML resources using model with operating point "<operating_point>" to test "<test>" and log predictions in "<output>" And I check that the predictions are ready Then the local prediction file is like "<predictions_file>" Examples: |scenario | kwargs | operating_point | test | output |predictions_file | """ examples = [ ['scenario_r1', '{"data": "data/iris.csv", "output": "scenario_r1/predictions.csv", "test": "data/test_iris.csv"}', 'data/test_iris.csv', 'scenario_r7/predictions_p.csv', 'check_files/predictions_iris_op_prob.csv', "data/operating_point_prob.json"], ['scenario_r1', '{"data": "data/iris.csv", "output": "scenario_r1/predictions.csv", "test": "data/test_iris.csv"}', 'data/test_iris.csv', 'scenario_r7/predictions_c.csv', 'check_files/predictions_iris_op_conf.csv', "data/operating_point_conf.json"]] print self.test_scenario7.__doc__ for example in examples: print "\nTesting with:\n", example test_pred.i_have_previous_scenario_or_reproduce_it(self, example[0], example[1]) test_batch_pred.i_create_resources_from_model_with_op_remote(self, operating_point=example[5], test=example[2], output=example[3]) test_batch_pred.i_check_create_batch_prediction(self) test_pred.i_check_create_predictions(self) test_pred.i_check_predictions(self, example[4])
def test_scenario7(self): """ Scenario: Successfully building test predictions from model with operating point Given I have previously executed "<scenario>" or reproduce it with arguments <kwargs> And I create BigML resources using model with operating point "<operating_point>" to test "<test>" and log predictions in "<output>" And I check that the predictions are ready Then the local prediction file is like "<predictions_file>" Examples: |scenario | kwargs | operating_point | test | output |predictions_file | """ examples = [ ['scenario_r1', '{"data": "data/iris.csv", "output": "scenario_r1/predictions.csv", "test": "data/test_iris.csv"}', 'data/test_iris.csv', 'scenario_r7/predictions_p.csv', 'check_files/predictions_iris_op_prob.csv', "data/operating_point_prob.json"], ['scenario_r1', '{"data": "data/iris.csv", "output": "scenario_r1/predictions.csv", "test": "data/test_iris.csv"}', 'data/test_iris.csv', 'scenario_r7/predictions_c.csv', 'check_files/predictions_iris_op_conf.csv', "data/operating_point_conf.json"]] print self.test_scenario7.__doc__ for example in examples: print "\nTesting with:\n", example test_pred.i_have_previous_scenario_or_reproduce_it(self, example[0], example[1]) test_batch_pred.i_create_resources_from_model_with_op_remote(self, operating_point=example[5], test=example[2], output=example[3]) test_batch_pred.i_check_create_batch_prediction(self) test_pred.i_check_create_predictions(self) test_pred.i_check_predictions(self, example[4])
def test_scenario02(self): """ Scenario: Successfully building batch test predictions from model Given I have previously executed "<scenario>" or reproduce it with arguments <kwargs> And I create BigML fusion resources using model built from "<train>" to test "<test>" as a batch prediction and log predictions in "<output>" And I check that the predictions are ready Then the local prediction file is like "<predictions_file>" """ print self.test_scenario02.__doc__ examples = [ ['data/test_iris.csv', 'scenario2_fs/predictions.csv', 'check_files/predictions_iris_fs.csv']] for example in examples: print "\nTesting with:\n", example fs_pred.i_create_fs_resources_from_model_remote(self, test=example[0], output=example[1]) fs_pred.i_check_create_fusion(self) batch_pred.i_check_create_batch_prediction(self) test_pred.i_check_create_predictions(self) test_pred.i_check_predictions(self, example[2])
def test_scenario06(self): """ Scenario: Successfully building batch test predictions from model Given I have previously executed "<scenario>" or reproduce it with arguments <kwargs> And I create BigML logistic regression resources using model to test "<test>" as a batch prediction and log predictions in "<output>" And I check that the predictions are ready Then the local prediction file is like "<predictions_file>" Examples: |scenario | kwargs | test | output |predictions_file | | scenario1| {"data": "../data/iris.csv", "output": "./scenario1/predictions.csv", "test": "../data/test_iris.csv"} | ../data/test_iris.csv | ./scenario4/predictions.csv | ./check_files/predictions_iris.csv | """ print self.test_scenario06.__doc__ examples = [ ['scenario1_lr', '{"data": "data/iris.csv", "output": "scenario1_lr/predictions.csv", "test": "data/test_iris.csv"}', 'data/test_iris.csv', 'scenario5_lr/predictions.csv', 'check_files/predictions_iris_lr.csv']] for example in examples: print "\nTesting with:\n", example test_pred.i_have_previous_scenario_or_reproduce_it(self, example[0], example[1]) lr_pred.i_create_lr_resources_from_model_remote(self, test=example[2], output=example[3]) batch_pred.i_check_create_batch_prediction(self) test_pred.i_check_create_predictions(self) test_pred.i_check_predictions(self, example[4])