@@ -302,12 +302,16 @@ def display_dataset_analysis(
302302 )
303303 if target_analysis :
304304 df_target = self ._create_train_test_df (
305- test = pd .DataFrame ({self .target_name : self .y_test }, index = range (len (self .y_test )))
306- if self .y_test is not None
307- else None ,
308- train = pd .DataFrame ({self .target_name : self .y_train }, index = range (len (self .y_train )))
309- if self .y_train is not None
310- else None ,
305+ test = (
306+ pd .DataFrame ({self .target_name : self .y_test }, index = range (len (self .y_test )))
307+ if self .y_test is not None
308+ else None
309+ ),
310+ train = (
311+ pd .DataFrame ({self .target_name : self .y_train }, index = range (len (self .y_train )))
312+ if self .y_train is not None
313+ else None
314+ ),
311315 )
312316 if df_target is not None :
313317 if target_analysis :
@@ -432,8 +436,8 @@ def display_model_explainability(self):
432436 )
433437
434438 # Interaction Plot
439+ explain_contrib_data_interaction = list ()
435440 if self .display_interaction_plot :
436- explain_contrib_data_interaction = list ()
437441 list_ind , _ = self .explainer .plot ._select_indices_interactions_plot (
438442 selection = None , max_points = self .max_points
439443 )
@@ -461,18 +465,18 @@ def display_model_explainability(self):
461465 }
462466 )
463467
464- # Aggregating the data
465- explain_data .append (
466- {
467- "index" : index_label ,
468- "name" : label_value ,
469- "feature_importance_plot" : plotly .io .to_html (
470- fig_features_importance , include_plotlyjs = False , full_html = False
471- ),
472- "features" : explain_contrib_data ,
473- "features_interaction" : explain_contrib_data_interaction ,
474- }
475- )
468+ # Aggregating the data
469+ explain_data .append (
470+ {
471+ "index" : index_label ,
472+ "name" : label_value ,
473+ "feature_importance_plot" : plotly .io .to_html (
474+ fig_features_importance , include_plotlyjs = False , full_html = False
475+ ),
476+ "features" : explain_contrib_data ,
477+ "features_interaction" : explain_contrib_data_interaction ,
478+ }
479+ )
476480 print_html (explainability_template .render (labels = explain_data ))
477481 print_md ("---" )
478482
@@ -508,9 +512,11 @@ def display_model_performance(self):
508512 df = pd .concat (
509513 [
510514 pd .DataFrame ({self .target_name : self .y_pred }).assign (_dataset = "pred" ),
511- pd .DataFrame ({self .target_name : self .y_test }).assign (_dataset = "true" )
512- if self .y_test is not None
513- else None ,
515+ (
516+ pd .DataFrame ({self .target_name : self .y_test }).assign (_dataset = "true" )
517+ if self .y_test is not None
518+ else None
519+ ),
514520 ]
515521 ).reset_index (drop = True )
516522 self ._perform_and_display_analysis_univariate (
0 commit comments