@@ -475,7 +475,10 @@ def score{modelPrefix}({inputVarList}):
475
475
# For models that output the classification from the prediction
476
476
cls .pyFile .write (
477
477
"""\n
478
- {metric} = prediction""" .format (metric = metrics [0 ]))
478
+ {metric} = prediction""" .format (
479
+ metric = metrics [0 ]
480
+ )
481
+ )
479
482
elif len (metrics ) == 2 :
480
483
cls .pyFile .write (
481
484
"""\n
@@ -484,7 +487,10 @@ def score{modelPrefix}({inputVarList}):
484
487
except TypeError:
485
488
# If the prediction returns as a list of values or improper value type, a TypeError will be raised.
486
489
# Attempt to handle the prediction output in the except block.
487
- {metric} = float(prediction[0])""" .format (metric = metrics [0 ]))
490
+ {metric} = float(prediction[0])""" .format (
491
+ metric = metrics [0 ]
492
+ )
493
+ )
488
494
if threshPrediction is None :
489
495
threshPrediction = np .mean (targetDF )
490
496
cls .pyFile .write (
@@ -502,16 +508,22 @@ def score{modelPrefix}({inputVarList}):
502
508
for i , metric in enumerate (metrics [:- 1 ]):
503
509
cls .pyFile .write (
504
510
"""\
505
- {metric} = float(prediction[{i}]""" .format (metric = metric , i = i )
511
+ {metric} = float(prediction[{i}]""" .format (
512
+ metric = metric , i = i
513
+ )
506
514
)
507
515
cls .pyFile .write (
508
516
"""\
509
517
max_prediction = max({metric_list})
510
518
index_prediction = {metric_list}.index(max_prediction)
511
- {classification} = index_prediction""" .format (metric_list = metrics [:- 1 ], classification = metrics [- 1 ])
519
+ {classification} = index_prediction""" .format (
520
+ metric_list = metrics [:- 1 ], classification = metrics [- 1 ]
521
+ )
512
522
)
513
523
else :
514
- ValueError ("Improper metrics argument was provided. Please provide a list of string metrics." )
524
+ ValueError (
525
+ "Improper metrics argument was provided. Please provide a list of string metrics."
526
+ )
515
527
516
528
elif isH2OModel and not isMLFlow :
517
529
cls .pyFile .write (
0 commit comments