Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ads/model/model_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ class Framework(ExtendedEnum):
PYOD = "pyod"
SPACY = "spacy"
PROPHET = "prophet"
THETA = "theta"
SKTIME = "sktime"
STATSMODELS = "statsmodels"
CUML = "cuml"
Expand Down
1 change: 1 addition & 0 deletions ads/opctl/operator/lowcode/forecast/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class SupportedModels(ExtendedEnum):
LGBForecast = "lgbforecast"
AutoMLX = "automlx"
AutoTS = "autots"
Theta = "theta"
# Auto = "auto"


Expand Down
2 changes: 2 additions & 0 deletions ads/opctl/operator/lowcode/forecast/model/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/

from ads.opctl.operator.lowcode.common.transformations import Transformations
from .theta import ThetaOperatorModel

from ..const import (
AUTO_SELECT,
Expand Down Expand Up @@ -46,6 +47,7 @@ class ForecastOperatorModelFactory:
SupportedModels.LGBForecast: MLForecastOperatorModel,
SupportedModels.AutoMLX: AutoMLXOperatorModel,
SupportedModels.AutoTS: AutoTSOperatorModel,
SupportedModels.Theta: ThetaOperatorModel,
}

@classmethod
Expand Down
19 changes: 9 additions & 10 deletions ads/opctl/operator/lowcode/forecast/model/forecast_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,41 +345,40 @@ def populate_series_output(
f"\nPlease refer to the troubleshooting guide at {TROUBLESHOOTING_GUIDE} for resolution steps."
) from e

start_idx = output_i.shape[0] - self.horizon - len(fit_val)
if (output_i.shape[0] - self.horizon) == len(fit_val):
output_i["fitted_value"].iloc[: -self.horizon] = (
fit_val # Note: may need to do len(output_i) - (len(fit_val) + horizon) : -horizon
)
output_i.loc[output_i.index[
: -self.horizon], "fitted_value"] = fit_val # Note: may need to do len(output_i) - (len(fit_val) + horizon) : -horizon
elif (output_i.shape[0] - self.horizon) > len(fit_val):
logger.debug(
f"Fitted Values were only generated on a subset ({len(fit_val)}/{(output_i.shape[0] - self.horizon)}) of the data for Series: {series_id}."
)
start_idx = output_i.shape[0] - self.horizon - len(fit_val)
output_i["fitted_value"].iloc[start_idx : -self.horizon] = fit_val
output_i.loc[output_i.index[start_idx: -self.horizon], "fitted_value"] = fit_val
else:
output_i["fitted_value"].iloc[start_idx : -self.horizon] = fit_val[
-(output_i.shape[0] - self.horizon) :
output_i.loc[output_i.index[start_idx: -self.horizon], "fitted_value"] = fit_val[
-(output_i.shape[0] - self.horizon):
]

if len(forecast_val) != self.horizon:
raise ValueError(
f"Attempting to set forecast along horizon ({self.horizon}) for series: {series_id}, however forecast is only length {len(forecast_val)}"
f"\nPlease refer to the troubleshooting guide at {TROUBLESHOOTING_GUIDE} for resolution steps."
)
output_i["forecast_value"].iloc[-self.horizon :] = forecast_val
output_i.loc[output_i.index[-self.horizon:], "forecast_value"] = forecast_val

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

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

self.series_id_map[series_id] = output_i
self.verify_series_output(series_id)
Expand Down
Loading