@@ -106,6 +106,7 @@ def generate_report(self):
106106 self .datasets ,
107107 self .forecast_output ,
108108 self .spec .datetime_column .name ,
109+ self .original_target_column ,
109110 target_col = self .forecast_col_name ,
110111 )
111112 else :
@@ -126,6 +127,7 @@ def generate_report(self):
126127 target_columns = self .target_columns ,
127128 test_filename = self .spec .test_data .url ,
128129 output = self .forecast_output ,
130+ original_target_column = self .original_target_column ,
129131 target_col = self .forecast_col_name ,
130132 elapsed_time = elapsed_time ,
131133 )
@@ -145,12 +147,13 @@ def generate_report(self):
145147
146148 title_text = dp .Text ("# Forecast Report" )
147149
148- md_columns = " * " .join ([f"{ x } \n " for x in self .target_columns ])
150+ md_columns = " * " .join ([f"{ utils .convert_target (x ,self .original_target_column )} \n "
151+ for x in self .target_columns ])
149152 first_10_rows_blocks = [
150153 dp .DataTable (
151154 df .head (10 ).rename ({col : self .spec .target_column }, axis = 1 ),
152155 caption = "Start" ,
153- label = col ,
156+ label = utils . convert_target ( col , self . original_target_column ) ,
154157 )
155158 for col , df in self .full_data_dict .items ()
156159 ]
@@ -159,7 +162,7 @@ def generate_report(self):
159162 dp .DataTable (
160163 df .tail (10 ).rename ({col : self .spec .target_column }, axis = 1 ),
161164 caption = "End" ,
162- label = col ,
165+ label = utils . convert_target ( col , self . original_target_column ) ,
163166 )
164167 for col , df in self .full_data_dict .items ()
165168 ]
@@ -168,7 +171,7 @@ def generate_report(self):
168171 dp .DataTable (
169172 df .rename ({col : self .spec .target_column }, axis = 1 ).describe (),
170173 caption = "Summary Statistics" ,
171- label = col ,
174+ label = utils . convert_target ( col , self . original_target_column ) ,
172175 )
173176 for col , df in self .full_data_dict .items ()
174177 ]
@@ -224,7 +227,7 @@ def generate_report(self):
224227 ),
225228 dp .Text (
226229 "The following report compares a variety of metrics and plots "
227- f"for your target columns: \n { md_columns } .\n " ,
230+ f"for your target columns: \n * { md_columns } .\n " ,
228231 label = "Target Columns" ,
229232 ),
230233 ]
@@ -255,6 +258,7 @@ def generate_report(self):
255258 forecast_sec = utils .get_forecast_plots (
256259 self .forecast_output ,
257260 self .target_columns ,
261+ self .original_target_column ,
258262 horizon = self .spec .horizon ,
259263 test_data = test_data ,
260264 ci_interval_width = self .spec .confidence_interval_width ,
@@ -281,7 +285,7 @@ def generate_report(self):
281285 )
282286
283287 def _test_evaluate_metrics (
284- self , target_columns , test_filename , output , target_col = "yhat" , elapsed_time = 0
288+ self , target_columns , test_filename , output , original_target_column , target_col = "yhat" , elapsed_time = 0
285289 ):
286290 total_metrics = pd .DataFrame ()
287291 summary_metrics = pd .DataFrame ()
@@ -336,7 +340,7 @@ def _test_evaluate_metrics(
336340 metrics_df = utils ._build_metrics_df (
337341 y_true = y_true [- self .spec .horizon :],
338342 y_pred = y_pred [- self .spec .horizon :],
339- column_name = target_column_i ,
343+ column_name = utils . convert_target ( target_column_i , original_target_column ) ,
340344 )
341345 total_metrics = pd .concat ([total_metrics , metrics_df ], axis = 1 )
342346 else :
@@ -685,7 +689,7 @@ def explain_model(self, datetime_col_name, explain_predict_fn) -> dict:
685689 f"No explanations generated. Ensure that additional data has been provided."
686690 )
687691 else :
688- self .global_explanation [series_id ] = dict (
692+ self .global_explanation [utils . convert_target ( series_id , self . original_target_column ) ] = dict (
689693 zip (
690694 data_trimmed .columns [1 :],
691695 np .average (np .absolute (kernel_explnr_vals [:, 1 :]), axis = 0 ),
@@ -734,4 +738,4 @@ def local_explainer(self, kernel_explainer, series_id, datetime_col_name) -> Non
734738 ["series_id" , self .spec .target_column ], axis = 1 , inplace = True
735739 )
736740
737- self .local_explanation [series_id ] = local_kernel_explnr_df
741+ self .local_explanation [utils . convert_target ( series_id , self . original_target_column ) ] = local_kernel_explnr_df
0 commit comments