@@ -1331,7 +1331,7 @@ class EvaluationRecipeCreator(DSSRecipeCreator):
13311331 # Create a new evaluation recipe outputing to a new dataset, to a metrics dataset and/or to a model evaluation store
13321332
13331333 project = client.get_project("MYPROJECT")
1334- builder = EvaluationRecipeCreator("my_evaluation_recipe", project )
1334+ builder = project.new_recipe("evaluation" )
13351335 builder.with_input_model(saved_model_id)
13361336 builder.with_input("dataset_to_evaluate")
13371337
@@ -1344,21 +1344,20 @@ class EvaluationRecipeCreator(DSSRecipeCreator):
13441344 # Access the settings
13451345
13461346 er_settings = new_recipe.get_settings()
1347- json_payload = er_settings.get_json_payload()
1347+ payload = er_settings.obj_payload
13481348
13491349 # Change the settings
13501350
1351- json_payload ['dontComputePerformance'] = True
1352- json_payload ['outputProbabilities'] = False
1353- json_payload ['metrics'] = ["precision", "recall", "auc", "f1", "costMatrixGain"]
1351+ payload ['dontComputePerformance'] = True
1352+ payload ['outputProbabilities'] = False
1353+ payload ['metrics'] = ["precision", "recall", "auc", "f1", "costMatrixGain"]
13541354
13551355 # Manage evaluation labels
13561356
1357- json_payload ['labels'] = [dict(key="label_1", value="value_1"), dict(key="label_2", value="value_2")]
1357+ payload ['labels'] = [dict(key="label_1", value="value_1"), dict(key="label_2", value="value_2")]
13581358
13591359 # Save the settings and run the recipe
13601360
1361- er_settings.set_json_payload(json_payload)
13621361 er_settings.save()
13631362
13641363 new_recipe.run()
@@ -1408,7 +1407,7 @@ class StandaloneEvaluationRecipeCreator(DSSRecipeCreator):
14081407 # Create a new standalone evaluation of a scored dataset
14091408
14101409 project = client.get_project("MYPROJECT")
1411- builder = StandaloneEvaluationRecipeCreator("my_standalone_evaluation_recipe", project )
1410+ builder = project.new_recipe("standalone_evaluation" )
14121411 builder.with_input("scored_dataset_to_evaluate")
14131412 builder.with_output_evaluation_store(evaluation_store_id)
14141413
@@ -1417,20 +1416,20 @@ class StandaloneEvaluationRecipeCreator(DSSRecipeCreator):
14171416 # Modify the model parameters in the SER settings
14181417
14191418 ser_settings = new_recipe.get_settings()
1420- ser_json_payload = ser_settings.get_json_payload()
1419+ payload = ser_settings.obj_payload
14211420
1422- ser_json_payload ['predictionType'] = "BINARY_CLASSIFICATION"
1423- ser_json_payload ['targetVariable'] = "Survived"
1424- ser_json_payload ['predictionVariable'] = "prediction"
1425- ser_json_payload ['isProbaAware'] = True
1426- ser_json_payload ['dontComputePerformance'] = False
1421+ payload ['predictionType'] = "BINARY_CLASSIFICATION"
1422+ payload ['targetVariable'] = "Survived"
1423+ payload ['predictionVariable'] = "prediction"
1424+ payload ['isProbaAware'] = True
1425+ payload ['dontComputePerformance'] = False
14271426
14281427 # For a classification model with probabilities, the 'probas' section can be filled with the mapping of the class and the probability column
14291428 # e.g. for a binary classification model with 2 columns: proba_0 and proba_1
14301429
14311430 class_0 = dict(key=0, value="proba_0")
14321431 class_1 = dict(key=1, value="proba_1")
1433- ser_payload ['probas'] = [class_0, class_1]
1432+ payload ['probas'] = [class_0, class_1]
14341433
14351434 # Change the 'features' settings for this standalone evaluation
14361435 # e.g. reject the features that you do not want to use in the evaluation
@@ -1439,18 +1438,15 @@ class StandaloneEvaluationRecipeCreator(DSSRecipeCreator):
14391438 feature_ticket = dict(name="Ticket", role="REJECT", type="TEXT")
14401439 feature_cabin = dict(name="Cabin", role="REJECT", type="TEXT")
14411440
1442- ser_payload ['features'] = [feature_passengerid, feature_ticket, feature_cabin]
1441+ payload ['features'] = [feature_passengerid, feature_ticket, feature_cabin]
14431442
14441443 # To set the cost matrix properly, access the 'metricParams' section of the payload and set the cost matrix weights:
14451444
1446- ser_payload ['metricParams'] = dict(costMatrixWeights=dict(tpGain=0.4, fpGain=-1.0, tnGain=0.2, fnGain=-0.5))
1445+ payload ['metricParams'] = dict(costMatrixWeights=dict(tpGain=0.4, fpGain=-1.0, tnGain=0.2, fnGain=-0.5))
14471446
1448- # Add the modified json payload to the recipe settings and save the recipe
1447+ # Save the recipe and run the recipe
14491448 # Note that with this method, all the settings that were not explicitly set are instead set to their default value.
14501449
1451- ser_settings = new_recipe.get_settings()
1452-
1453- ser_settings.set_json_payload(ser_payload)
14541450 ser_settings.save()
14551451
14561452 new_recipe.run()
0 commit comments