Skip to content

Commit 2400e11

Browse files
committed
Add troubleshooting guide link to error messages and moved troubleshooting.md to ai-samples repo
1 parent 708bcc0 commit 2400e11

File tree

7 files changed

+32
-33
lines changed

7 files changed

+32
-33
lines changed

ads/opctl/operator/lowcode/forecast/const.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,4 @@ class ForecastOutputColumns(ExtendedEnum):
9090
RENDER_LIMIT = 5000
9191
AUTO_SELECT = "auto-select"
9292
BACKTEST_REPORT_NAME = "back_test.csv"
93+
TROUBLESHOOTING_GUIDE = "https://github.com/oracle-samples/oci-data-science-ai-samples/blob/main/ai-operators/troubleshooting.md"

ads/opctl/operator/lowcode/forecast/errors.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
# Copyright (c) 2023 Oracle and/or its affiliates.
55
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
66

7+
from ads.opctl.operator.lowcode.forecast.const import TROUBLESHOOTING_GUIDE
8+
9+
710
class ForecastSchemaYamlError(Exception):
811
"""Exception raised when there is an issue with the schema."""
912

@@ -12,7 +15,7 @@ def __init__(self, error: str):
1215
"Invalid forecast operator specification. Check the YAML structure and ensure it "
1316
"complies with the required schema for forecast operator. \n"
1417
f"{error}"
15-
"\nPlease refer to the troubleshooting guide at https://github.com/oracle/accelerated-data-science/blob/main/ads/opctl/operator/lowcode/forecast/model/troubleshooting.MD for resolution steps."
18+
f"\nPlease refer to the troubleshooting guide at {TROUBLESHOOTING_GUIDE} for resolution steps."
1619
)
1720

1821

@@ -24,5 +27,5 @@ def __init__(self, error: str):
2427
"Invalid input data. Check the input data and ensure it "
2528
"complies with the validation criteria. \n"
2629
f"{error}"
27-
"\nPlease refer to the troubleshooting guide at https://github.com/oracle/accelerated-data-science/blob/main/ads/opctl/operator/lowcode/forecast/model/troubleshooting.MD for resolution steps."
30+
f"\nPlease refer to the troubleshooting guide at {TROUBLESHOOTING_GUIDE} for resolution steps."
2831
)

ads/opctl/operator/lowcode/forecast/model/base_model.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
SpeedAccuracyMode,
5151
SupportedMetrics,
5252
SupportedModels,
53+
TROUBLESHOOTING_GUIDE,
5354
)
5455
from ..operator_config import ForecastOperatorConfig, ForecastOperatorSpec
5556
from .forecast_datasets import ForecastDatasets, ForecastResults
@@ -719,7 +720,7 @@ def _validate_automlx_explanation_mode(self):
719720
raise ValueError(
720721
"AUTOMLX explanation accuracy mode is only supported for AutoMLX models. "
721722
"Please select mode other than AUTOMLX from the available explanations_accuracy_mode options"
722-
"\nPlease refer to the troubleshooting guide at https://github.com/oracle/accelerated-data-science/blob/main/ads/opctl/operator/lowcode/forecast/model/troubleshooting.MD for resolution steps."
723+
f"\nPlease refer to the troubleshooting guide at {TROUBLESHOOTING_GUIDE} for resolution steps."
723724
)
724725

725726
@runtime_dependency(

ads/opctl/operator/lowcode/forecast/model/factory.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
# Copyright (c) 2023, 2024 Oracle and/or its affiliates.
44
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
55

6-
from ..const import AUTO_SELECT, SpeedAccuracyMode, SupportedModels
6+
from ..const import (
7+
AUTO_SELECT,
8+
TROUBLESHOOTING_GUIDE,
9+
SpeedAccuracyMode,
10+
SupportedModels,
11+
)
712
from ..model_evaluator import ModelEvaluator
813
from ..operator_config import ForecastOperatorConfig
914
from .arima import ArimaOperatorModel
@@ -21,7 +26,7 @@ def __init__(self, model_type: str):
2126
super().__init__(
2227
f"Model: `{model_type}` "
2328
f"is not supported. Supported models: {SupportedModels.values()}"
24-
"\nPlease refer to the troubleshooting guide at https://github.com/oracle/accelerated-data-science/blob/main/ads/opctl/operator/lowcode/forecast/model/troubleshooting.MD for resolution steps."
29+
f"\nPlease refer to the troubleshooting guide at {TROUBLESHOOTING_GUIDE} for resolution steps."
2530
)
2631

2732

ads/opctl/operator/lowcode/forecast/model/forecast_datasets.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
get_frequency_of_datetime,
1919
)
2020

21-
from ..const import ForecastOutputColumns, SupportedModels
21+
from ..const import ForecastOutputColumns, SupportedModels, TROUBLESHOOTING_GUIDE
2222
from ..operator_config import ForecastOperatorConfig
2323

2424

@@ -48,7 +48,8 @@ def _verify_dt_col(self, spec):
4848
f"{SupportedModels.AutoMLX} requires data with a frequency of at least one hour. Please try using a different model,"
4949
" or select the 'auto' option."
5050
)
51-
raise InvalidParameterError(message)
51+
raise InvalidParameterError(f"{message}"
52+
f"\nPlease refer to the troubleshooting guide at {TROUBLESHOOTING_GUIDE} for resolution steps.")
5253

5354

5455
class AdditionalData(AbstractData):
@@ -63,10 +64,12 @@ def __init__(self, spec, historical_data, additional_data=None):
6364
if historical_data.get_max_time() > add_dates[-spec.horizon]:
6465
raise DataMismatchError(
6566
f"The Historical Data ends on {historical_data.get_max_time()}. The additional data horizon starts on {add_dates[-spec.horizon]}. The horizon should have exactly {spec.horizon} dates after the Historical at a frequency of {historical_data.freq}"
67+
f"\nPlease refer to the troubleshooting guide at {TROUBLESHOOTING_GUIDE} for resolution steps."
6668
)
6769
elif historical_data.get_max_time() != add_dates[-(spec.horizon + 1)]:
6870
raise DataMismatchError(
6971
f"The Additional Data must be present for all historical data and the entire horizon. The Historical Data ends on {historical_data.get_max_time()}. The additonal data horizon starts after {add_dates[-(spec.horizon+1)]}. These should be the same date."
72+
f"\nPlease refer to the troubleshooting guide at {TROUBLESHOOTING_GUIDE} for resolution steps."
7073
)
7174
else:
7275
self.name = "additional_data"
@@ -210,6 +213,7 @@ def get_data_at_series(self, s_id, include_horizon=True):
210213
except Exception as e:
211214
raise InvalidParameterError(
212215
f"Unable to retrieve series id: {s_id} from data. Available series ids are: {self.list_series_ids()}"
216+
f"\nPlease refer to the troubleshooting guide at {TROUBLESHOOTING_GUIDE} for resolution steps."
213217
) from e
214218

215219
def get_horizon_at_series(self, s_id):
@@ -291,6 +295,7 @@ def add_series_id(
291295
if not overwrite and series_id in self.series_id_map:
292296
raise ValueError(
293297
f"Attempting to update ForecastOutput for series_id {series_id} when this already exists. Set overwrite to True."
298+
f"\nPlease refer to the troubleshooting guide at {TROUBLESHOOTING_GUIDE} for resolution steps."
294299
)
295300
forecast = self._check_forecast_format(forecast)
296301
self.series_id_map[series_id] = forecast
@@ -331,6 +336,7 @@ def populate_series_output(
331336
except KeyError as e:
332337
raise ValueError(
333338
f"Attempting to update output for series: {series_id}, however no series output has been initialized."
339+
f"\nPlease refer to the troubleshooting guide at {TROUBLESHOOTING_GUIDE} for resolution steps."
334340
) from e
335341

336342
if (output_i.shape[0] - self.horizon) == len(fit_val):
@@ -351,18 +357,21 @@ def populate_series_output(
351357
if len(forecast_val) != self.horizon:
352358
raise ValueError(
353359
f"Attempting to set forecast along horizon ({self.horizon}) for series: {series_id}, however forecast is only length {len(forecast_val)}"
360+
f"\nPlease refer to the troubleshooting guide at {TROUBLESHOOTING_GUIDE} for resolution steps."
354361
)
355362
output_i["forecast_value"].iloc[-self.horizon :] = forecast_val
356363

357364
if len(upper_bound) != self.horizon:
358365
raise ValueError(
359366
f"Attempting to set upper_bound along horizon ({self.horizon}) for series: {series_id}, however upper_bound is only length {len(upper_bound)}"
367+
f"\nPlease refer to the troubleshooting guide at {TROUBLESHOOTING_GUIDE} for resolution steps."
360368
)
361369
output_i[self.upper_bound_name].iloc[-self.horizon :] = upper_bound
362370

363371
if len(lower_bound) != self.horizon:
364372
raise ValueError(
365373
f"Attempting to set lower_bound along horizon ({self.horizon}) for series: {series_id}, however lower_bound is only length {len(lower_bound)}"
374+
f"\nPlease refer to the troubleshooting guide at {TROUBLESHOOTING_GUIDE} for resolution steps."
366375
)
367376
output_i[self.lower_bound_name].iloc[-self.horizon :] = lower_bound
368377

ads/opctl/operator/lowcode/forecast/model/troubleshooting.MD

Lines changed: 0 additions & 24 deletions
This file was deleted.

ads/opctl/operator/lowcode/forecast/model_evaluator.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
from ads.opctl import logger
1111
from ads.opctl.operator.lowcode.common.const import DataColumns
1212
from ads.opctl.operator.lowcode.common.errors import InsufficientDataError
13-
from ads.opctl.operator.lowcode.forecast.const import BACKTEST_REPORT_NAME
13+
from ads.opctl.operator.lowcode.forecast.const import (
14+
BACKTEST_REPORT_NAME,
15+
TROUBLESHOOTING_GUIDE,
16+
)
1417
from ads.opctl.operator.lowcode.forecast.model.factory import SupportedModels
1518

1619
from .model.forecast_datasets import ForecastDatasets
@@ -79,7 +82,7 @@ def generate_k_fold_data(
7982
raise InsufficientDataError(
8083
"Insufficient data to evaluate multiple models. Please specify a model "
8184
"instead of using auto-select."
82-
"\nPlease refer to the troubleshooting guide at https://github.com/oracle/accelerated-data-science/blob/main/ads/opctl/operator/lowcode/forecast/model/troubleshooting.MD for resolution steps."
85+
f"\nPlease refer to the troubleshooting guide at {TROUBLESHOOTING_GUIDE} for resolution steps."
8386
)
8487
training_datasets = [
8588
sampled_historical_data[sampled_historical_data[date_col] <= cut_off_date]
@@ -224,6 +227,7 @@ def find_best_model(
224227
model = SupportedModels.Prophet
225228
logger.error(
226229
f"Running {model} model as auto-select failed with the following error: {e.message}"
230+
f"\nPlease refer to the troubleshooting guide at {TROUBLESHOOTING_GUIDE} for resolution steps."
227231
)
228232
return model
229233
nonempty_metrics = {

0 commit comments

Comments
 (0)