@@ -480,7 +480,8 @@ def load_data(params, generated_data=[], add_dtype=False, label_2d=False,
480
480
return tuple (full_data .values ())
481
481
482
482
483
- def gen_basic_dict (library , algorithm , stage , params , data ):
483
+ def gen_basic_dict (library , algorithm , stage , params , data , alg_instance = None ,
484
+ alg_params = None ):
484
485
result = {
485
486
'library' : library ,
486
487
'algorithm' : algorithm ,
@@ -495,9 +496,6 @@ def gen_basic_dict(library, algorithm, stage, params, data):
495
496
'columns' : data .shape [1 ]
496
497
}
497
498
}
498
- return result
499
-
500
- def update_algorithm_parameters (result , alg_instance = None , alg_params = None ):
501
499
result ['algorithm_parameters' ] = {}
502
500
if alg_instance is not None :
503
501
if 'Booster' in str (type (alg_instance )):
@@ -509,15 +507,8 @@ def update_algorithm_parameters(result, alg_instance=None, alg_params=None):
509
507
alg_instance_params ['dtype' ] = str (
510
508
alg_instance_params ['dtype' ])
511
509
result ['algorithm_parameters' ].update (alg_instance_params )
512
- if 'init' in result ['algorithm_parameters' ]:
513
- if not isinstance (result ['algorithm_parameters' ]['init' ], str ):
514
- result ['algorithm_parameters' ]['init' ] = 'random'
515
510
if alg_params is not None :
516
511
result ['algorithm_parameters' ].update (alg_params )
517
- if 'init' in result ['algorithm_parameters' ].keys ():
518
- if not isinstance (result ['algorithm_parameters' ]['init' ], str ):
519
- result ['algorithm_parameters' ]['init' ] = 'random'
520
- result ['algorithm_parameters' ].pop ('handle' ,None )
521
512
return result
522
513
523
514
@@ -545,7 +536,11 @@ def print_output(library, algorithm, stages, params, functions,
545
536
elif algorithm == 'dbscan' :
546
537
result .update ({'n_clusters' : params .n_clusters })
547
538
# replace non-string init with string for kmeans benchmarks
548
- result = update_algorithm_parameters (result , alg_instance , alg_params )
539
+ if alg_instance is not None :
540
+ if 'init' in result ['algorithm_parameters' ].keys ():
541
+ if not isinstance (result ['algorithm_parameters' ]['init' ], str ):
542
+ result ['algorithm_parameters' ]['init' ] = 'random'
543
+ result ['algorithm_parameters' ].pop ('handle' ,None )
549
544
output .append (result )
550
545
print (json .dumps (output , indent = 4 ))
551
546
0 commit comments