Skip to content

Commit fc1a992

Browse files
committed
adding more example datasets
1 parent 26900c0 commit fc1a992

File tree

9 files changed

+92
-18
lines changed

9 files changed

+92
-18
lines changed

ads/opctl/operator/common/utils.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python
2-
# -*- coding: utf-8 -*--
32

43
# Copyright (c) 2023, 2024 Oracle and/or its affiliates.
54
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
@@ -18,23 +17,25 @@
1817
from cerberus import Validator
1918

2019
from ads.opctl import logger, utils
21-
from ads.opctl.operator import __operators__
2220

2321
CONTAINER_NETWORK = "CONTAINER_NETWORK"
2422

2523

2624
class OperatorValidator(Validator):
2725
"""The custom validator class."""
2826

29-
pass
27+
def validate(self, obj_dict, **kwargs):
28+
# Model should be case insensitive
29+
obj_dict["spec"]["model"] = str(obj_dict["spec"]["model"]).lower()
30+
return super().validate(obj_dict, **kwargs)
3031

3132

3233
def create_output_folder(name):
3334
output_folder = name
3435
protocol = fsspec.utils.get_protocol(output_folder)
3536
storage_options = {}
3637
if protocol != "file":
37-
storage_options = auth or default_signer()
38+
storage_options = default_signer()
3839

3940
fs = fsspec.filesystem(protocol, **storage_options)
4041
name_suffix = 1

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ class UnSupportedModelError(Exception):
2626

2727
def __init__(self, operator_config: AnomalyOperatorConfig, model_type: str):
2828
supported_models = (
29-
SupportedModels.values
29+
SupportedModels.values()
3030
if operator_config.spec.datetime_column
31-
else NonTimeADSupportedModels.values
31+
else NonTimeADSupportedModels.values()
3232
)
3333
message = (
3434
f"Model: `{model_type}` is not supported. "

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from .autots import AutoTSOperatorModel
1212
from .base_model import ForecastOperatorBaseModel
1313
from .forecast_datasets import ForecastDatasets
14+
from .ml_forecast import MLForecastOperatorModel
1415
from .neuralprophet import NeuralProphetOperatorModel
1516
from .prophet import ProphetOperatorModel
1617

@@ -19,7 +20,7 @@ class UnSupportedModelError(Exception):
1920
def __init__(self, model_type: str):
2021
super().__init__(
2122
f"Model: `{model_type}` "
22-
f"is not supported. Supported models: {SupportedModels.values}"
23+
f"is not supported. Supported models: {SupportedModels.values()}"
2324
)
2425

2526

@@ -32,7 +33,7 @@ class ForecastOperatorModelFactory:
3233
SupportedModels.Prophet: ProphetOperatorModel,
3334
SupportedModels.Arima: ArimaOperatorModel,
3435
SupportedModels.NeuralProphet: NeuralProphetOperatorModel,
35-
# SupportedModels.LGBForecast: MLForecastOperatorModel,
36+
SupportedModels.LGBForecast: MLForecastOperatorModel,
3637
SupportedModels.AutoMLX: AutoMLXOperatorModel,
3738
SupportedModels.AutoTS: AutoTSOperatorModel,
3839
}

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env python
2-
# -*- coding: utf-8 -*--
32

4-
# Copyright (c) 2023 Oracle and/or its affiliates.
3+
# Copyright (c) 2023, 2024 Oracle and/or its affiliates.
54
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
65

76
import uuid
@@ -18,7 +17,7 @@ class UnSupportedDetectorError(Exception):
1817
def __init__(self, dtype: str):
1918
super().__init__(
2019
f"Detector: `{dtype}` "
21-
f"is not supported. Supported models: {SupportedDetector.values}"
20+
f"is not supported. Supported models: {SupportedDetector.values()}"
2221
)
2322

2423

@@ -42,7 +41,9 @@ class SpacyDetector(PiiBaseDetector):
4241
@runtime_dependency(module="scrubadub", install_from=OptionalDependency.PII)
4342
@runtime_dependency(module="scrubadub_spacy", install_from=OptionalDependency.PII)
4443
def construct(cls, entity, model, **kwargs):
45-
spacy_entity_detector = scrubadub_spacy.detectors.spacy.SpacyEntityDetector(
44+
import scrubadub
45+
from scrubadub_spacy.detectors.spacy import SpacyEntityDetector
46+
spacy_entity_detector = SpacyEntityDetector(
4647
named_entities=[entity],
4748
name=f"spacy_{uuid.uuid4()}",
4849
model=model,

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env python
2-
# -*- coding: utf-8 -*--
32

4-
# Copyright (c) 2023 Oracle and/or its affiliates.
3+
# Copyright (c) 2023, 2024 Oracle and/or its affiliates.
54
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
65

76
from ..constant import SupportedModels
@@ -10,11 +9,12 @@
109
from .recommender_dataset import RecommenderDatasets
1110
from .svd import SVDOperatorModel
1211

12+
1313
class UnSupportedModelError(Exception):
1414
def __init__(self, model_type: str):
1515
super().__init__(
1616
f"Model: `{model_type}` "
17-
f"is not supported. Supported models: {SupportedModels.values}"
17+
f"is not supported. Supported models: {SupportedModels.values()}"
1818
)
1919

2020

@@ -23,9 +23,7 @@ class RecommenderOperatorModelFactory:
2323
The factory class helps to instantiate proper model operator based on the model type.
2424
"""
2525

26-
_MAP = {
27-
SupportedModels.SVD: SVDOperatorModel
28-
}
26+
_MAP = {SupportedModels.SVD: SVDOperatorModel}
2927

3028
@classmethod
3129
def get_model(
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
kind: operator
2+
type: forecast
3+
version: v1
4+
spec:
5+
datetime_column:
6+
name: Date
7+
historical_data:
8+
url: timeseries/retail_prim.csv
9+
additional_data:
10+
url: timeseries/retail_add.csv
11+
test_data:
12+
url: timeseries/retail_test.csv
13+
horizon: 3
14+
model: LGBForecast
15+
target_column: Sales
16+
# generate_explanations: True
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Date,Ad Spend,Discount Rate,Foot Traffic
2+
2023-01-01,100.0,0.0,1000.0
3+
2023-02-01,100.0,0.0,1100.0
4+
2023-03-01,100.0,0.0,1300.0
5+
2023-04-01,100.0,0.0,1400.0
6+
2023-05-01,100.0,0.0,1500.0
7+
2023-06-01,100.0,0.0,1600.0
8+
2023-07-01,100.0,0.0,1700.0
9+
2023-08-01,100.0,0.0,1800.0
10+
2023-09-01,0.0,0.0,1900.0
11+
2023-10-01,0.0,0.0,2000.0
12+
2023-11-01,0.0,0.0,2000.0
13+
2023-12-01,0.0,0.0,2100.0
14+
2024-01-01,0.0,0.0,2200.0
15+
2024-02-01,0.0,0.0,2300.0
16+
2024-03-01,0.0,0.0,2400.0
17+
2024-04-01,0.0,0.1,2500.0
18+
2024-05-01,0.0,0.1,2600.0
19+
2024-06-01,0.0,0.1,2700.0
20+
2024-07-01,0.0,0.1,2800.0
21+
2024-08-01,0.0,0.1,2900.0
22+
2024-09-01,0.0,0.1,3000.0
23+
2024-10-01,0.0,0.1,3100.0
24+
2024-11-01,0.0,0.1,3200.0
25+
2024-12-01,0.0,0.1,3300.0
26+
2025-01-01,100.0,0.1,3400.0
27+
2025-02-01,100.0,0.1,3500.0
28+
2025-03-01,100.0,0.1,3700.0
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Date,Sales
2+
2023-01-01,672.9013417961711
3+
2023-02-01,725.386000114524
4+
2023-03-01,787.6404076885843
5+
2023-04-01,838.6794060206407
6+
2023-05-01,896.0618494560191
7+
2023-06-01,944.0145584340703
8+
2023-07-01,998.8245931828164
9+
2023-08-01,1042.7815773098787
10+
2023-09-01,990.7393502418831
11+
2023-10-01,1050.4189067877965
12+
2023-11-01,1087.699685678044
13+
2023-12-01,1158.7867475664566
14+
2024-01-01,1214.0293852069105
15+
2024-02-01,1260.0462629542862
16+
2024-03-01,1304.5403104618904
17+
2024-04-01,1573.163162016336
18+
2024-05-01,1611.2355265665328
19+
2024-06-01,1680.5619939753535
20+
2024-07-01,1739.2582412202794
21+
2024-08-01,1801.9466748533303
22+
2024-09-01,1885.3736882778257
23+
2024-10-01,1921.6889033445455
24+
2024-11-01,1987.2824623188812
25+
2024-12-01,2045.8385281527853
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Date,Sales
2+
2025-01-01,2244.70244431561
3+
2025-02-01,2311.4765510687644
4+
2025-03-01,2390.2794816577234

0 commit comments

Comments
 (0)