|
1 | 1 | #!/usr/bin/env python |
2 | 2 |
|
3 | | -# Copyright (c) 2023, 2024 Oracle and/or its affiliates. |
| 3 | +# Copyright (c) 2023, 2025 Oracle and/or its affiliates. |
4 | 4 | # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/ |
5 | 5 |
|
6 | 6 | import logging |
@@ -132,13 +132,14 @@ def _train_model(self, i, s_id, df, model_kwargs): |
132 | 132 |
|
133 | 133 | logger.debug("===========Done===========") |
134 | 134 | except Exception as e: |
135 | | - self.errors_dict[s_id] = { |
| 135 | + new_error = { |
136 | 136 | "model_name": self.spec.model, |
137 | 137 | "error": str(e), |
138 | 138 | "error_trace": traceback.format_exc(), |
139 | 139 | } |
140 | | - logger.warn(f"Encountered Error: {e}. Skipping.") |
141 | | - logger.warn(traceback.format_exc()) |
| 140 | + self.errors_dict[s_id] = new_error |
| 141 | + logger.warning(f"Encountered Error: {e}. Skipping.") |
| 142 | + logger.warning(traceback.format_exc()) |
142 | 143 |
|
143 | 144 | def _build_model(self) -> pd.DataFrame: |
144 | 145 | full_data_dict = self.datasets.get_data_by_series() |
@@ -166,7 +167,7 @@ def _generate_report(self): |
166 | 167 | sec5_text = rc.Heading("ARIMA Model Parameters", level=2) |
167 | 168 | blocks = [ |
168 | 169 | rc.Html( |
169 | | - m['model'].summary().as_html(), |
| 170 | + m["model"].summary().as_html(), |
170 | 171 | label=s_id if self.target_cat_col else None, |
171 | 172 | ) |
172 | 173 | for i, (s_id, m) in enumerate(self.models.items()) |
@@ -201,11 +202,15 @@ def _generate_report(self): |
201 | 202 | self.formatted_local_explanation = aggregate_local_explanations |
202 | 203 |
|
203 | 204 | if not self.target_cat_col: |
204 | | - self.formatted_global_explanation = self.formatted_global_explanation.rename( |
205 | | - {"Series 1": self.original_target_column}, |
206 | | - axis=1, |
| 205 | + self.formatted_global_explanation = ( |
| 206 | + self.formatted_global_explanation.rename( |
| 207 | + {"Series 1": self.original_target_column}, |
| 208 | + axis=1, |
| 209 | + ) |
| 210 | + ) |
| 211 | + self.formatted_local_explanation.drop( |
| 212 | + "Series", axis=1, inplace=True |
207 | 213 | ) |
208 | | - self.formatted_local_explanation.drop("Series", axis=1, inplace=True) |
209 | 214 |
|
210 | 215 | # Create a markdown section for the global explainability |
211 | 216 | global_explanation_section = rc.Block( |
@@ -235,7 +240,7 @@ def _generate_report(self): |
235 | 240 | local_explanation_section, |
236 | 241 | ] |
237 | 242 | except Exception as e: |
238 | | - logger.warn(f"Failed to generate Explanations with error: {e}.") |
| 243 | + logger.warning(f"Failed to generate Explanations with error: {e}.") |
239 | 244 | logger.debug(f"Full Traceback: {traceback.format_exc()}") |
240 | 245 |
|
241 | 246 | model_description = rc.Text( |
|
0 commit comments