@@ -347,19 +347,15 @@ def _visualize(output_dir, estimator, cm, accuracy, importances=None,
347
347
348
348
# summarize model accuracy and params
349
349
result = pd .Series (estimator .get_params (), name = 'Parameter setting' )
350
- result = result .to_frame ().to_html (classes = (
351
- "table table-striped table-hover" )).replace ('border="1"' , 'border="0"' )
350
+ result = q2templates .df_to_html (result .to_frame ())
352
351
353
- cm = cm .to_html (classes = (
354
- "table table-striped table-hover" )).replace ('border="1"' , 'border="0"' )
352
+ cm = q2templates .df_to_html (cm )
355
353
if importances is not None :
356
354
importances = sort_importances (importances )
357
355
pd .set_option ('display.float_format' , '{:.3e}' .format )
358
356
importances .to_csv (join (
359
357
output_dir , 'feature_importance.tsv' ), sep = '\t ' , index = False )
360
- importances = importances .to_html (classes = (
361
- "table table-striped table-hover" ), index = False ).replace (
362
- 'border="1"' , 'border="0"' )
358
+ importances = q2templates .df_to_html (importances , index = False )
363
359
364
360
index = join (TEMPLATES , 'index.html' )
365
361
q2templates .render (index , output_dir , context = {
@@ -384,9 +380,7 @@ def _visualize_maturity_index(table, metadata, group_by, category,
384
380
importances = sort_importances (importances )
385
381
importances .to_csv (
386
382
join (output_dir , 'feature_importance.tsv' ), index = False , sep = '\t ' )
387
- importance = importances .to_html (classes = (
388
- "table table-striped table-hover" ), index = False ).replace (
389
- 'border="1"' , 'border="0"' )
383
+ importance = q2templates .df_to_html (importances , index = False )
390
384
391
385
# save predicted values, maturity, and MAZ score data
392
386
maz_md = metadata [[group_by , category , predicted_category , maturity , maz ]]
@@ -421,8 +415,7 @@ def _visualize_maturity_index(table, metadata, group_by, category,
421
415
422
416
result = pd .Series (estimator .get_params (), name = 'Parameter setting' )
423
417
result .append (pd .Series ([accuracy ], index = ['Accuracy score' ]))
424
- result = result .to_frame ().to_html (classes = (
425
- "table table-striped table-hover" )).replace ('border="1"' , 'border="0"' )
418
+ result = q2templates .df_to_html (result .to_frame ())
426
419
427
420
index = join (TEMPLATES , 'index.html' )
428
421
q2templates .render (index , output_dir , context = {
0 commit comments