oracle-ads 2.12.4__py3-none-any.whl → 2.12.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. ads/aqua/common/decorator.py +10 -0
  2. ads/aqua/evaluation/entities.py +12 -2
  3. ads/aqua/evaluation/evaluation.py +1 -1
  4. ads/aqua/extension/aqua_ws_msg_handler.py +2 -0
  5. ads/aqua/extension/base_handler.py +2 -0
  6. ads/aqua/finetuning/constants.py +3 -0
  7. ads/aqua/finetuning/finetuning.py +13 -2
  8. ads/opctl/operator/lowcode/anomaly/model/anomaly_merlion.py +6 -5
  9. ads/opctl/operator/lowcode/anomaly/model/automlx.py +12 -8
  10. ads/opctl/operator/lowcode/anomaly/model/autots.py +6 -3
  11. ads/opctl/operator/lowcode/anomaly/model/base_model.py +19 -7
  12. ads/opctl/operator/lowcode/anomaly/model/isolationforest.py +9 -10
  13. ads/opctl/operator/lowcode/anomaly/model/oneclasssvm.py +10 -11
  14. ads/opctl/operator/lowcode/anomaly/model/randomcutforest.py +6 -2
  15. ads/opctl/operator/lowcode/common/data.py +13 -11
  16. ads/opctl/operator/lowcode/forecast/model/arima.py +14 -12
  17. ads/opctl/operator/lowcode/forecast/model/automlx.py +26 -26
  18. ads/opctl/operator/lowcode/forecast/model/autots.py +16 -18
  19. ads/opctl/operator/lowcode/forecast/model/base_model.py +45 -36
  20. ads/opctl/operator/lowcode/forecast/model/forecast_datasets.py +36 -47
  21. ads/opctl/operator/lowcode/forecast/model/ml_forecast.py +3 -0
  22. ads/opctl/operator/lowcode/forecast/model/neuralprophet.py +30 -46
  23. ads/opctl/operator/lowcode/forecast/model/prophet.py +15 -20
  24. ads/opctl/operator/lowcode/forecast/model_evaluator.py +25 -20
  25. ads/opctl/operator/lowcode/forecast/utils.py +30 -33
  26. ads/opctl/operator/lowcode/pii/model/report.py +11 -7
  27. ads/opctl/operator/lowcode/recommender/model/base_model.py +58 -45
  28. ads/opctl/operator/lowcode/recommender/model/svd.py +47 -29
  29. {oracle_ads-2.12.4.dist-info → oracle_ads-2.12.6.dist-info}/METADATA +5 -5
  30. {oracle_ads-2.12.4.dist-info → oracle_ads-2.12.6.dist-info}/RECORD +33 -33
  31. {oracle_ads-2.12.4.dist-info → oracle_ads-2.12.6.dist-info}/LICENSE.txt +0 -0
  32. {oracle_ads-2.12.4.dist-info → oracle_ads-2.12.6.dist-info}/WHEEL +0 -0
  33. {oracle_ads-2.12.4.dist-info → oracle_ads-2.12.6.dist-info}/entry_points.txt +0 -0
@@ -69,6 +69,16 @@ def handle_exceptions(func):
69
69
  reason=error.message,
70
70
  service_payload=error.args[0] if error.args else None,
71
71
  exc_info=sys.exc_info(),
72
+ aqua_api_details=dict(
73
+ # __qualname__ gives information of class and name of api
74
+ aqua_api_name=func.__qualname__,
75
+ oci_api_name=getattr(
76
+ error, "operation_name", "Unknown OCI Operation"
77
+ ),
78
+ service_endpoint=getattr(
79
+ error, "request_endpoint", "Unknown Request Endpoint"
80
+ )
81
+ )
72
82
  )
73
83
  except (
74
84
  ClientError,
@@ -9,11 +9,12 @@ aqua.evaluation.entities
9
9
  This module contains dataclasses for aqua evaluation.
10
10
  """
11
11
 
12
+ from typing import Any, Dict, List, Optional
13
+
12
14
  from pydantic import Field
13
- from typing import Any, Dict, List, Optional, Union
14
15
 
15
- from ads.aqua.data import AquaResourceIdentifier
16
16
  from ads.aqua.config.utils.serializer import Serializable
17
+ from ads.aqua.data import AquaResourceIdentifier
17
18
 
18
19
 
19
20
  class CreateAquaEvaluationDetails(Serializable):
@@ -87,6 +88,8 @@ class CreateAquaEvaluationDetails(Serializable):
87
88
 
88
89
  class Config:
89
90
  extra = "ignore"
91
+ protected_namespaces = ()
92
+
90
93
 
91
94
  class AquaEvalReport(Serializable):
92
95
  evaluation_id: str = ""
@@ -95,6 +98,7 @@ class AquaEvalReport(Serializable):
95
98
  class Config:
96
99
  extra = "ignore"
97
100
 
101
+
98
102
  class AquaEvalParams(Serializable):
99
103
  shape: str = ""
100
104
  dataset_path: str = ""
@@ -103,6 +107,7 @@ class AquaEvalParams(Serializable):
103
107
  class Config:
104
108
  extra = "allow"
105
109
 
110
+
106
111
  class AquaEvalMetric(Serializable):
107
112
  key: str
108
113
  name: str
@@ -111,6 +116,7 @@ class AquaEvalMetric(Serializable):
111
116
  class Config:
112
117
  extra = "ignore"
113
118
 
119
+
114
120
  class AquaEvalMetricSummary(Serializable):
115
121
  metric: str = ""
116
122
  score: str = ""
@@ -119,6 +125,7 @@ class AquaEvalMetricSummary(Serializable):
119
125
  class Config:
120
126
  extra = "ignore"
121
127
 
128
+
122
129
  class AquaEvalMetrics(Serializable):
123
130
  id: str
124
131
  report: str
@@ -128,6 +135,7 @@ class AquaEvalMetrics(Serializable):
128
135
  class Config:
129
136
  extra = "ignore"
130
137
 
138
+
131
139
  class AquaEvaluationCommands(Serializable):
132
140
  evaluation_id: str
133
141
  evaluation_target_id: str
@@ -139,6 +147,7 @@ class AquaEvaluationCommands(Serializable):
139
147
  class Config:
140
148
  extra = "ignore"
141
149
 
150
+
142
151
  class AquaEvaluationSummary(Serializable):
143
152
  """Represents a summary of Aqua evalution."""
144
153
 
@@ -157,6 +166,7 @@ class AquaEvaluationSummary(Serializable):
157
166
  class Config:
158
167
  extra = "ignore"
159
168
 
169
+
160
170
  class AquaEvaluationDetail(AquaEvaluationSummary):
161
171
  """Represents a details of Aqua evalution."""
162
172
 
@@ -1305,7 +1305,7 @@ class AquaEvaluationApp(AquaApp):
1305
1305
  "id": model_id,
1306
1306
  "name": model.display_name,
1307
1307
  "console_url": console_url,
1308
- "time_created": model.time_created,
1308
+ "time_created": str(model.time_created),
1309
1309
  "tags": tags,
1310
1310
  "experiment": self._build_resource_identifier(
1311
1311
  id=experiment_id,
@@ -78,10 +78,12 @@ class AquaWSMsgHandler:
78
78
  logger.warning(reply["message"])
79
79
  # telemetry may not be present if there is an error while initializing
80
80
  if hasattr(self, "telemetry"):
81
+ aqua_api_details = kwargs.get("aqua_api_details", {})
81
82
  self.telemetry.record_event_async(
82
83
  category="aqua/error",
83
84
  action=str(status_code),
84
85
  value=reason,
86
+ **aqua_api_details
85
87
  )
86
88
  response = AquaWsError(
87
89
  status=status_code,
@@ -98,10 +98,12 @@ class AquaAPIhandler(APIHandler):
98
98
 
99
99
  # telemetry may not be present if there is an error while initializing
100
100
  if hasattr(self, "telemetry"):
101
+ aqua_api_details = kwargs.get("aqua_api_details", {})
101
102
  self.telemetry.record_event_async(
102
103
  category="aqua/error",
103
104
  action=str(status_code),
104
105
  value=reason,
106
+ **aqua_api_details
105
107
  )
106
108
 
107
109
  self.finish(json.dumps(reply))
@@ -15,3 +15,6 @@ class FineTuneCustomMetadata(str, metaclass=ExtendedEnumMeta):
15
15
  SERVICE_MODEL_ARTIFACT_LOCATION = "artifact_location"
16
16
  SERVICE_MODEL_DEPLOYMENT_CONTAINER = "deployment-container"
17
17
  SERVICE_MODEL_FINE_TUNE_CONTAINER = "finetune-container"
18
+
19
+
20
+ ENV_AQUA_FINE_TUNING_CONTAINER = "AQUA_FINE_TUNING_CONTAINER"
@@ -31,7 +31,10 @@ from ads.aqua.constants import (
31
31
  UNKNOWN_DICT,
32
32
  )
33
33
  from ads.aqua.data import AquaResourceIdentifier
34
- from ads.aqua.finetuning.constants import *
34
+ from ads.aqua.finetuning.constants import (
35
+ ENV_AQUA_FINE_TUNING_CONTAINER,
36
+ FineTuneCustomMetadata,
37
+ )
35
38
  from ads.aqua.finetuning.entities import *
36
39
  from ads.common.auth import default_signer
37
40
  from ads.common.object_storage_details import ObjectStorageDetails
@@ -310,6 +313,15 @@ class AquaFineTuningApp(AquaApp):
310
313
  except Exception:
311
314
  pass
312
315
 
316
+ if not is_custom_container and ENV_AQUA_FINE_TUNING_CONTAINER in os.environ:
317
+ ft_container = os.environ[ENV_AQUA_FINE_TUNING_CONTAINER]
318
+ logger.info(
319
+ "Using container set by environment variable %s=%s",
320
+ ENV_AQUA_FINE_TUNING_CONTAINER,
321
+ ft_container,
322
+ )
323
+ is_custom_container = True
324
+
313
325
  ft_parameters.batch_size = ft_parameters.batch_size or (
314
326
  ft_config.get("shape", UNKNOWN_DICT)
315
327
  .get(create_fine_tuning_details.shape_name, UNKNOWN_DICT)
@@ -559,7 +571,6 @@ class AquaFineTuningApp(AquaApp):
559
571
  Dict:
560
572
  A dict of allowed finetuning configs.
561
573
  """
562
-
563
574
  config = self.get_config(model_id, AQUA_MODEL_FINETUNING_CONFIG)
564
575
  if not config:
565
576
  logger.debug(
@@ -4,9 +4,11 @@
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 importlib
7
+ import logging
7
8
 
8
9
  import numpy as np
9
10
  import pandas as pd
11
+ import report_creator as rc
10
12
  from merlion.post_process.threshold import AggregateAlarms
11
13
  from merlion.utils import TimeSeries
12
14
 
@@ -21,6 +23,8 @@ from ads.opctl.operator.lowcode.anomaly.const import (
21
23
  from .anomaly_dataset import AnomalyOutput
22
24
  from .base_model import AnomalyOperatorBaseModel
23
25
 
26
+ logging.getLogger("report_creator").setLevel(logging.WARNING)
27
+
24
28
 
25
29
  class AnomalyMerlionOperatorModel(AnomalyOperatorBaseModel):
26
30
  """Class representing Merlion Anomaly Detection operator model."""
@@ -84,7 +88,7 @@ class AnomalyMerlionOperatorModel(AnomalyOperatorBaseModel):
84
88
  for target, df in self.datasets.full_data_dict.items():
85
89
  data = df.set_index(date_column)
86
90
  data = TimeSeries.from_pd(data)
87
- for model_name, (model_config, model) in model_config_map.items():
91
+ for _, (model_config, model) in model_config_map.items():
88
92
  if self.spec.model == SupportedModels.BOCPD:
89
93
  model_config = model_config(**self.spec.model_kwargs)
90
94
  else:
@@ -115,7 +119,7 @@ class AnomalyMerlionOperatorModel(AnomalyOperatorBaseModel):
115
119
  y_pred = (y_pred.to_pd().reset_index()["anom_score"] > 0).astype(
116
120
  int
117
121
  )
118
- except Exception as e:
122
+ except Exception:
119
123
  y_pred = (
120
124
  scores["anom_score"]
121
125
  > np.percentile(
@@ -135,15 +139,12 @@ class AnomalyMerlionOperatorModel(AnomalyOperatorBaseModel):
135
139
  OutputColumns.SCORE_COL: scores["anom_score"],
136
140
  }
137
141
  ).reset_index(drop=True)
138
- # model_objects[model_name].append(model)
139
142
 
140
143
  anomaly_output.add_output(target, anomaly, score)
141
144
  return anomaly_output
142
145
 
143
146
  def _generate_report(self):
144
147
  """Genreates a report for the model."""
145
- import report_creator as rc
146
-
147
148
  other_sections = [
148
149
  rc.Heading("Selected Models Overview", level=2),
149
150
  rc.Text(
@@ -1,16 +1,21 @@
1
1
  #!/usr/bin/env python
2
- # -*- coding: utf-8 -*--
3
2
 
4
3
  # Copyright (c) 2023, 2024 Oracle and/or its affiliates.
5
4
  # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
6
5
 
6
+ import logging
7
+
7
8
  import pandas as pd
9
+ import report_creator as rc
8
10
 
9
11
  from ads.common.decorator.runtime_dependency import runtime_dependency
10
- from .anomaly_dataset import AnomalyOutput
12
+ from ads.opctl import logger
13
+ from ads.opctl.operator.lowcode.anomaly.const import OutputColumns
11
14
 
15
+ from .anomaly_dataset import AnomalyOutput
12
16
  from .base_model import AnomalyOperatorBaseModel
13
- from ads.opctl.operator.lowcode.anomaly.const import OutputColumns
17
+
18
+ logging.getLogger("report_creator").setLevel(logging.WARNING)
14
19
 
15
20
 
16
21
  class AutoMLXOperatorModel(AnomalyOperatorBaseModel):
@@ -25,16 +30,17 @@ class AutoMLXOperatorModel(AnomalyOperatorBaseModel):
25
30
  ),
26
31
  )
27
32
  def _build_model(self) -> pd.DataFrame:
28
- from automlx import init
29
33
  import logging
30
34
 
35
+ import automlx
36
+
31
37
  try:
32
- init(
38
+ automlx.init(
33
39
  engine="ray",
34
40
  engine_opts={"ray_setup": {"_temp_dir": "/tmp/ray-temp"}},
35
41
  loglevel=logging.CRITICAL,
36
42
  )
37
- except Exception as e:
43
+ except Exception:
38
44
  logger.info("Ray already initialized")
39
45
  date_column = self.spec.datetime_column.name
40
46
  anomaly_output = AnomalyOutput(date_column=date_column)
@@ -73,8 +79,6 @@ class AutoMLXOperatorModel(AnomalyOperatorBaseModel):
73
79
  return anomaly_output
74
80
 
75
81
  def _generate_report(self):
76
- import report_creator as rc
77
-
78
82
  """The method that needs to be implemented on the particular model level."""
79
83
  other_sections = [
80
84
  rc.Heading("Selected Models Overview", level=2),
@@ -1,9 +1,12 @@
1
1
  #!/usr/bin/env python
2
- # -*- coding: utf-8 -*--
3
2
 
4
3
  # Copyright (c) 2023, 2024 Oracle and/or its affiliates.
5
4
  # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
6
5
 
6
+ import logging
7
+
8
+ import report_creator as rc
9
+
7
10
  from ads.common.decorator.runtime_dependency import runtime_dependency
8
11
  from ads.opctl import logger
9
12
  from ads.opctl.operator.lowcode.anomaly.const import OutputColumns
@@ -12,6 +15,8 @@ from ..const import SupportedModels
12
15
  from .anomaly_dataset import AnomalyOutput
13
16
  from .base_model import AnomalyOperatorBaseModel
14
17
 
18
+ logging.getLogger("report_creator").setLevel(logging.WARNING)
19
+
15
20
 
16
21
  class AutoTSOperatorModel(AnomalyOperatorBaseModel):
17
22
  """Class representing AutoTS Anomaly Detection operator model."""
@@ -91,8 +96,6 @@ class AutoTSOperatorModel(AnomalyOperatorBaseModel):
91
96
  return anomaly_output
92
97
 
93
98
  def _generate_report(self):
94
- import report_creator as rc
95
-
96
99
  """The method that needs to be implemented on the particular model level."""
97
100
  other_sections = [
98
101
  rc.Heading("Selected Models Overview", level=2),
@@ -3,6 +3,7 @@
3
3
  # Copyright (c) 2023, 2024 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
+ import logging
6
7
  import os
7
8
  import tempfile
8
9
  import time
@@ -12,6 +13,7 @@ from typing import Tuple
12
13
  import fsspec
13
14
  import numpy as np
14
15
  import pandas as pd
16
+ import report_creator as rc
15
17
  from sklearn import linear_model
16
18
 
17
19
  from ads.common.object_storage_details import ObjectStorageDetails
@@ -33,6 +35,8 @@ from ..const import NonTimeADSupportedModels, SupportedModels
33
35
  from ..operator_config import AnomalyOperatorConfig, AnomalyOperatorSpec
34
36
  from .anomaly_dataset import AnomalyDatasets, AnomalyOutput, TestData
35
37
 
38
+ logging.getLogger("report_creator").setLevel(logging.WARNING)
39
+
36
40
 
37
41
  class AnomalyOperatorBaseModel(ABC):
38
42
  """The base class for the anomaly detection operator models."""
@@ -59,8 +63,8 @@ class AnomalyOperatorBaseModel(ABC):
59
63
  def generate_report(self):
60
64
  """Generates the report."""
61
65
  import matplotlib.pyplot as plt
62
- plt.rcParams.update({'figure.max_open_warning': 0})
63
- import report_creator as rc
66
+
67
+ plt.rcParams.update({"figure.max_open_warning": 0})
64
68
 
65
69
  start_time = time.time()
66
70
  # fallback using sklearn oneclasssvm when the sub model _build_model fails
@@ -84,7 +88,13 @@ class AnomalyOperatorBaseModel(ABC):
84
88
  anomaly_output, test_data, elapsed_time
85
89
  )
86
90
  table_blocks = [
87
- rc.DataTable(df.head(SUBSAMPLE_THRESHOLD) if self.spec.subsample_report_data and len(df) > SUBSAMPLE_THRESHOLD else df, label=col, index=True)
91
+ rc.DataTable(
92
+ df.head(SUBSAMPLE_THRESHOLD)
93
+ if self.spec.subsample_report_data and len(df) > SUBSAMPLE_THRESHOLD
94
+ else df,
95
+ label=col,
96
+ index=True,
97
+ )
88
98
  for col, df in self.datasets.full_data_dict.items()
89
99
  ]
90
100
  data_table = rc.Select(blocks=table_blocks)
@@ -144,7 +154,9 @@ class AnomalyOperatorBaseModel(ABC):
144
154
  else:
145
155
  figure_blocks = None
146
156
 
147
- blocks.append(rc.Group(*figure_blocks, label=target)) if figure_blocks else None
157
+ blocks.append(
158
+ rc.Group(*figure_blocks, label=target)
159
+ ) if figure_blocks else None
148
160
  plots = rc.Select(blocks)
149
161
 
150
162
  report_sections = []
@@ -154,7 +166,9 @@ class AnomalyOperatorBaseModel(ABC):
154
166
  yaml_appendix = rc.Yaml(self.config.to_dict())
155
167
  summary = rc.Block(
156
168
  rc.Group(
157
- rc.Text(f"You selected the **`{self.spec.model}`** model.\n{model_description.text}\n"),
169
+ rc.Text(
170
+ f"You selected the **`{self.spec.model}`** model.\n{model_description.text}\n"
171
+ ),
158
172
  rc.Text(
159
173
  "Based on your dataset, you could have also selected "
160
174
  f"any of the models: `{'`, `'.join(SupportedModels.keys() if self.spec.datetime_column else NonTimeADSupportedModels.keys())}`."
@@ -285,8 +299,6 @@ class AnomalyOperatorBaseModel(ABC):
285
299
  test_metrics: pd.DataFrame,
286
300
  ):
287
301
  """Saves resulting reports to the given folder."""
288
- import report_creator as rc
289
-
290
302
  unique_output_dir = self.spec.output_directory.url
291
303
 
292
304
  if ObjectStorageDetails.is_oci_path(unique_output_dir):
@@ -1,17 +1,21 @@
1
1
  #!/usr/bin/env python
2
- # -*- coding: utf-8 -*--
3
2
 
4
3
  # Copyright (c) 2023, 2024 Oracle and/or its affiliates.
5
4
  # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
6
5
 
6
+ import logging
7
+
7
8
  import numpy as np
8
9
  import pandas as pd
10
+ import report_creator as rc
9
11
 
10
12
  from ads.common.decorator.runtime_dependency import runtime_dependency
13
+ from ads.opctl.operator.lowcode.anomaly.const import OutputColumns
11
14
 
12
- from .base_model import AnomalyOperatorBaseModel
13
15
  from .anomaly_dataset import AnomalyOutput
14
- from ads.opctl.operator.lowcode.anomaly.const import OutputColumns
16
+ from .base_model import AnomalyOperatorBaseModel
17
+
18
+ logging.getLogger("report_creator").setLevel(logging.WARNING)
15
19
 
16
20
 
17
21
  class IsolationForestOperatorModel(AnomalyOperatorBaseModel):
@@ -36,13 +40,9 @@ class IsolationForestOperatorModel(AnomalyOperatorBaseModel):
36
40
  for target, df in self.datasets.full_data_dict.items():
37
41
  model = IsolationForest(**model_kwargs)
38
42
  model.fit(df)
39
- y_pred = np.vectorize(self.outlier_map.get)(
40
- model.predict(df)
41
- )
43
+ y_pred = np.vectorize(self.outlier_map.get)(model.predict(df))
42
44
 
43
- scores = model.score_samples(
44
- df
45
- )
45
+ scores = model.score_samples(df)
46
46
 
47
47
  index_col = df.columns[0]
48
48
 
@@ -59,7 +59,6 @@ class IsolationForestOperatorModel(AnomalyOperatorBaseModel):
59
59
 
60
60
  def _generate_report(self):
61
61
  """Generates the report."""
62
- import report_creator as rc
63
62
 
64
63
  other_sections = [
65
64
  rc.Heading("Selected Models Overview", level=2),
@@ -1,17 +1,21 @@
1
1
  #!/usr/bin/env python
2
- # -*- coding: utf-8 -*--
3
2
 
4
3
  # Copyright (c) 2023, 2024 Oracle and/or its affiliates.
5
4
  # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
6
5
 
6
+ import logging
7
+
7
8
  import numpy as np
8
9
  import pandas as pd
10
+ import report_creator as rc
9
11
 
10
12
  from ads.common.decorator.runtime_dependency import runtime_dependency
13
+ from ads.opctl.operator.lowcode.anomaly.const import OutputColumns
11
14
 
12
- from .base_model import AnomalyOperatorBaseModel
13
15
  from .anomaly_dataset import AnomalyOutput
14
- from ads.opctl.operator.lowcode.anomaly.const import OutputColumns
16
+ from .base_model import AnomalyOperatorBaseModel
17
+
18
+ logging.getLogger("report_creator").setLevel(logging.WARNING)
15
19
 
16
20
 
17
21
  class OneClassSVMOperatorModel(AnomalyOperatorBaseModel):
@@ -36,13 +40,9 @@ class OneClassSVMOperatorModel(AnomalyOperatorBaseModel):
36
40
  for target, df in self.datasets.full_data_dict.items():
37
41
  model = OneClassSVM(**model_kwargs)
38
42
  model.fit(df)
39
- y_pred = np.vectorize(self.outlier_map.get)(
40
- model.predict(df)
41
- )
43
+ y_pred = np.vectorize(self.outlier_map.get)(model.predict(df))
42
44
 
43
- scores = model.score_samples(
44
- df
45
- )
45
+ scores = model.score_samples(df)
46
46
 
47
47
  index_col = df.columns[0]
48
48
 
@@ -54,12 +54,11 @@ class OneClassSVMOperatorModel(AnomalyOperatorBaseModel):
54
54
  ).reset_index(drop=True)
55
55
 
56
56
  anomaly_output.add_output(target, anomaly, score)
57
-
57
+
58
58
  return anomaly_output
59
59
 
60
60
  def _generate_report(self):
61
61
  """Generates the report."""
62
- import report_creator as rc
63
62
 
64
63
  other_sections = [
65
64
  rc.Heading("Selected Models Overview", level=2),
@@ -3,8 +3,11 @@
3
3
  # Copyright (c) 2023, 2024 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
+ import logging
7
+
6
8
  import numpy as np
7
9
  import pandas as pd
10
+ import report_creator as rc
8
11
 
9
12
  from ads.common.decorator.runtime_dependency import runtime_dependency
10
13
  from ads.opctl import logger
@@ -13,6 +16,8 @@ from ads.opctl.operator.lowcode.anomaly.const import OutputColumns
13
16
  from .anomaly_dataset import AnomalyOutput
14
17
  from .base_model import AnomalyOperatorBaseModel
15
18
 
19
+ logging.getLogger("report_creator").setLevel(logging.WARNING)
20
+
16
21
 
17
22
  class RandomCutForestOperatorModel(AnomalyOperatorBaseModel):
18
23
  """
@@ -27,7 +32,7 @@ class RandomCutForestOperatorModel(AnomalyOperatorBaseModel):
27
32
  ),
28
33
  )
29
34
  def _build_model(self) -> AnomalyOutput:
30
- from rrcf import RCTree
35
+ import rrcf
31
36
 
32
37
  model_kwargs = self.spec.model_kwargs
33
38
 
@@ -96,7 +101,6 @@ class RandomCutForestOperatorModel(AnomalyOperatorBaseModel):
96
101
 
97
102
  def _generate_report(self):
98
103
  """Generates the report."""
99
- import report_creator as rc
100
104
 
101
105
  other_sections = [
102
106
  rc.Heading("Selected Models Overview", level=2),
@@ -1,22 +1,21 @@
1
1
  #!/usr/bin/env python
2
- # -*- coding: utf-8 -*--
3
2
 
4
3
  # Copyright (c) 2024 Oracle and/or its affiliates.
5
4
  # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
6
5
 
7
6
  import time
8
- from .transformations import Transformations
7
+ from abc import ABC
8
+
9
+ import pandas as pd
10
+
9
11
  from ads.opctl import logger
10
12
  from ads.opctl.operator.lowcode.common.const import DataColumns
11
- from ads.opctl.operator.lowcode.common.utils import load_data
12
13
  from ads.opctl.operator.lowcode.common.errors import (
13
- InputDataError,
14
14
  InvalidParameterError,
15
- PermissionsError,
16
- DataMismatchError,
17
15
  )
18
- from abc import ABC
19
- import pandas as pd
16
+ from ads.opctl.operator.lowcode.common.utils import load_data
17
+
18
+ from .transformations import Transformations
20
19
 
21
20
 
22
21
  class AbstractData(ABC):
@@ -35,12 +34,15 @@ class AbstractData(ABC):
35
34
  condition = pd.Series(True, index=self.raw_data.index)
36
35
  if category in mapping:
37
36
  for col, val in mapping[category].items():
38
- condition &= (self.raw_data[col] == val)
37
+ condition &= self.raw_data[col] == val
39
38
  data_by_cat = self.raw_data[condition].reset_index(drop=True)
40
- data_by_cat = self._data_transformer._format_datetime_col(data_by_cat) if self.spec.datetime_column else data_by_cat
39
+ data_by_cat = (
40
+ self._data_transformer._format_datetime_col(data_by_cat)
41
+ if self.spec.datetime_column
42
+ else data_by_cat
43
+ )
41
44
  return data_by_cat
42
45
 
43
-
44
46
  def get_dict_by_series(self):
45
47
  if not self._data_dict:
46
48
  for s_id in self.list_series_ids():
@@ -1,23 +1,26 @@
1
1
  #!/usr/bin/env python
2
- # -*- coding: utf-8 -*--
3
2
 
4
3
  # Copyright (c) 2023, 2024 Oracle and/or its affiliates.
5
4
  # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
6
5
 
6
+ import logging
7
+ import traceback
8
+
7
9
  import pandas as pd
8
- import numpy as np
9
10
  import pmdarima as pm
11
+ import report_creator as rc
10
12
  from joblib import Parallel, delayed
11
13
 
12
14
  from ads.opctl import logger
13
-
14
- from ads.opctl.operator.lowcode.forecast.utils import _label_encode_dataframe
15
15
  from ads.opctl.operator.lowcode.common.utils import seconds_to_datetime
16
- from .base_model import ForecastOperatorBaseModel
16
+ from ads.opctl.operator.lowcode.forecast.utils import _label_encode_dataframe
17
+
18
+ from ..const import ForecastOutputColumns, SupportedModels
17
19
  from ..operator_config import ForecastOperatorConfig
18
- import traceback
20
+ from .base_model import ForecastOperatorBaseModel
19
21
  from .forecast_datasets import ForecastDatasets, ForecastOutput
20
- from ..const import ForecastOutputColumns, SupportedModels
22
+
23
+ logging.getLogger("report_creator").setLevel(logging.WARNING)
21
24
 
22
25
 
23
26
  class ArimaOperatorModel(ForecastOperatorBaseModel):
@@ -39,7 +42,7 @@ class ArimaOperatorModel(ForecastOperatorBaseModel):
39
42
  )
40
43
  model_kwargs = self.spec.model_kwargs
41
44
  model_kwargs["alpha"] = 1 - self.spec.confidence_interval_width
42
- if "error_action" not in model_kwargs.keys():
45
+ if "error_action" not in model_kwargs:
43
46
  model_kwargs["error_action"] = "ignore"
44
47
  return model_kwargs
45
48
 
@@ -129,13 +132,14 @@ class ArimaOperatorModel(ForecastOperatorBaseModel):
129
132
  self.errors_dict[s_id] = {
130
133
  "model_name": self.spec.model,
131
134
  "error": str(e),
132
- "error_trace": traceback.format_exc()}
135
+ "error_trace": traceback.format_exc(),
136
+ }
133
137
  logger.warn(f"Encountered Error: {e}. Skipping.")
134
138
  logger.warn(traceback.format_exc())
135
139
 
136
140
  def _build_model(self) -> pd.DataFrame:
137
141
  full_data_dict = self.datasets.get_data_by_series()
138
- self.models = dict()
142
+ self.models = {}
139
143
  self.additional_regressors = self.datasets.get_additional_data_column_names()
140
144
  model_kwargs = self.set_kwargs()
141
145
  self.forecast_output = ForecastOutput(
@@ -154,8 +158,6 @@ class ArimaOperatorModel(ForecastOperatorBaseModel):
154
158
 
155
159
  def _generate_report(self):
156
160
  """The method that needs to be implemented on the particular model level."""
157
- import report_creator as rc
158
-
159
161
  all_sections = []
160
162
  if len(self.models) > 0:
161
163
  sec5_text = rc.Heading("ARIMA Model Parameters", level=2)