Skip to content
Merged
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
2 changes: 1 addition & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @darenr @mayoor @mrDzurb @VipulMascarenhas @qiuosier @ahosler
* @darenr @mayoor @mrDzurb @VipulMascarenhas @qiuosier
2 changes: 1 addition & 1 deletion ads/opctl/operator/lowcode/forecast/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class SupportedModels(str, metaclass=ExtendedEnumMeta):
Prophet = "prophet"
Arima = "arima"
NeuralProphet = "neuralprophet"
LGBForecast = "lgbforecast"
MLForecast = "mlforecast"
AutoMLX = "automlx"
AutoTS = "autots"
Auto = "auto"
Expand Down
2 changes: 1 addition & 1 deletion ads/opctl/operator/lowcode/forecast/model/automlx.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def set_kwargs(self):
time_budget = model_kwargs_cleaned.pop("time_budget", -1)
model_kwargs_cleaned[
"preprocessing"
] = self.spec.preprocessing.enabled or model_kwargs_cleaned.get("preprocessing", True)
] = self.spec.preprocessing or model_kwargs_cleaned.get("preprocessing", True)
return model_kwargs_cleaned, time_budget

def preprocess(self, data, series_id=None): # TODO: re-use self.le for explanations
Expand Down
2 changes: 1 addition & 1 deletion ads/opctl/operator/lowcode/forecast/model/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ForecastOperatorModelFactory:
SupportedModels.Prophet: ProphetOperatorModel,
SupportedModels.Arima: ArimaOperatorModel,
SupportedModels.NeuralProphet: NeuralProphetOperatorModel,
SupportedModels.LGBForecast: MLForecastOperatorModel,
SupportedModels.MLForecast: MLForecastOperatorModel,
SupportedModels.AutoMLX: AutoMLXOperatorModel,
SupportedModels.AutoTS: AutoTSOperatorModel
}
Expand Down
35 changes: 14 additions & 21 deletions ads/opctl/operator/lowcode/forecast/model/ml_forecast.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*--

# Copyright (c) 2024 Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
import numpy as np
import pandas as pd
import numpy as np

from ads.common.decorator import runtime_dependency
from ads.opctl import logger
from ads.common.decorator import runtime_dependency
from ads.opctl.operator.lowcode.forecast.utils import _select_plot_list

from ..const import ForecastOutputColumns, SupportedModels
from ..operator_config import ForecastOperatorConfig
from .base_model import ForecastOperatorBaseModel
from .forecast_datasets import ForecastDatasets, ForecastOutput
from ..operator_config import ForecastOperatorConfig
from ..const import ForecastOutputColumns, SupportedModels


class MLForecastOperatorModel(ForecastOperatorBaseModel):
Expand Down Expand Up @@ -58,25 +58,18 @@ def _train_model(self, data_train, data_test, model_kwargs):
from mlforecast.target_transforms import Differences

lgb_params = {
"verbosity": model_kwargs.get("verbosity", -1),
"num_leaves": model_kwargs.get("num_leaves", 512),
"verbosity": -1,
"num_leaves": 512,
}
additional_data_params = {}
if len(self.datasets.get_additional_data_column_names()) > 0:
additional_data_params = {
"target_transforms": [
Differences([model_kwargs.get("Differences", 12)])
],
"target_transforms": [Differences([12])],
"lags": model_kwargs.get("lags", [1, 6, 12]),
"lag_transforms": (
{
1: [ExpandingMean()],
12: [
RollingMean(
window_size=model_kwargs.get("RollingMean", 24),
min_samples=1,
)
],
12: [RollingMean(window_size=24)],
}
),
}
Expand Down Expand Up @@ -154,7 +147,7 @@ def _train_model(self, data_train, data_test, model_kwargs):
)

self.model_parameters[s_id] = {
"framework": SupportedModels.LGBForecast,
"framework": SupportedModels.MLForecast,
**lgb_params,
}

Expand Down Expand Up @@ -211,10 +204,10 @@ def _generate_report(self):
self.datasets.list_series_ids(),
)

# Section 2: LGBForecast Model Parameters
# Section 2: MlForecast Model Parameters
sec2_text = rc.Block(
rc.Heading("LGBForecast Model Parameters", level=2),
rc.Text("These are the parameters used for the LGBForecast model."),
rc.Heading("MlForecast Model Parameters", level=2),
rc.Text("These are the parameters used for the MlForecast model."),
)

blocks = [
Expand All @@ -228,7 +221,7 @@ def _generate_report(self):

all_sections = [sec1_text, sec_1, sec2_text, sec_2]
model_description = rc.Text(
"LGBForecast uses mlforecast framework to perform time series forecasting using machine learning models"
"mlforecast is a framework to perform time series forecasting using machine learning models"
"with the option to scale to massive amounts of data using remote clusters."
"Fastest implementations of feature engineering for time series forecasting in Python."
"Support for exogenous variables and static covariates."
Expand Down
2 changes: 1 addition & 1 deletion ads/opctl/operator/lowcode/forecast/schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ spec:
- prophet
- arima
- neuralprophet
- lgbforecast
- mlforecast
- automlx
- autots
- auto-select
Expand Down
6 changes: 3 additions & 3 deletions tests/operators/forecast/test_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"prophet",
"neuralprophet",
"autots",
"lgbforecast",
"mlforecast",
"auto-select",
]

Expand Down Expand Up @@ -135,15 +135,15 @@ def test_load_datasets(model, data_details):
if model == "automlx":
yaml_i["spec"]["model_kwargs"] = {"time_budget": 2}
if model == "auto-select":
yaml_i["spec"]["model_kwargs"] = {"model_list": ['prophet', 'arima', 'lgbforecast']}
yaml_i["spec"]["model_kwargs"] = {"model_list": ['prophet', 'arima', 'mlforecast']}
if dataset_name == f'{DATASET_PREFIX}dataset4.csv':
pytest.skip("Skipping dataset4 with auto-select") # todo:// ODSC-58584

run(yaml_i, backend="operator.local", debug=False)
subprocess.run(f"ls -a {output_data_path}", shell=True)
if yaml_i["spec"]["generate_explanations"] and model not in [
"automlx",
"lgbforecast",
"mlforecast",
"auto-select"
]:
verify_explanations(
Expand Down
4 changes: 2 additions & 2 deletions tests/operators/forecast/test_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
"prophet",
"neuralprophet",
"autots",
"lgbforecast",
"mlforecast",
# "auto",
]

Expand Down Expand Up @@ -687,7 +687,7 @@ def test_arima_automlx_errors(operator_setup, model):
in error_content["13"]["error"]
), "Error message mismatch"

if model not in ["autots", "automlx", "lgbforecast"]:
if model not in ["autots", "automlx", "mlforecast"]:
global_fn = f"{tmpdirname}/results/global_explanation.csv"
assert os.path.exists(
global_fn
Expand Down