Skip to content

Commit 9b9b33c

Browse files
committed
adding series_id in inliers, outliers
1 parent f17b49b commit 9b9b33c

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def __init__(self, spec: AnomalyOperatorSpec):
4949
The anomaly operator spec.
5050
"""
5151
self._data = AnomalyData(spec)
52+
self.data_with_all_cols = self._data.get_data_with_all_cols()
5253
self.data = self._data.get_data_long()
5354
self.full_data_dict = self._data.get_dict_by_series()
5455
if spec.validation_data is not None:

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,15 +272,15 @@ def _save_report(
272272
f2.write(f1.read())
273273

274274
if self.spec.generate_inliers:
275-
inliers = anomaly_output.get_inliers(self.datasets.data)
275+
inliers = anomaly_output.get_inliers(self.datasets.data_with_all_cols)
276276
write_data(
277277
data=inliers,
278278
filename=os.path.join(unique_output_dir, self.spec.inliers_filename),
279279
format="csv",
280280
storage_options=storage_options,
281281
)
282282

283-
outliers = anomaly_output.get_outliers(self.datasets.data)
283+
outliers = anomaly_output.get_outliers(self.datasets.data_with_all_cols)
284284
write_data(
285285
data=outliers,
286286
filename=os.path.join(unique_output_dir, self.spec.outliers_filename),

ads/opctl/operator/lowcode/common/data.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,14 @@ def __init__(self, spec: dict, name="input_data"):
2424
self.data = None
2525
self._data_dict = dict()
2626
self.name = name
27+
self.data_with_all_cols = None
2728
self.load_transform_ingest_data(spec)
2829

30+
31+
def get_data_with_all_cols(self):
32+
return self.data_with_all_cols.reset_index(drop=False)
33+
34+
2935
def get_dict_by_series(self):
3036
if not self._data_dict:
3137
for s_id in self.list_series_ids():
@@ -65,7 +71,10 @@ def _load_data(self, data_spec, **kwargs):
6571
def _transform_data(self, spec, raw_data, **kwargs):
6672
transformation_start_time = time.time()
6773
self._data_transformer = self.Transformations(spec, name=self.name)
68-
data = self._data_transformer.run(raw_data)
74+
self.data_with_all_cols = self._data_transformer.run(raw_data)
75+
data = self.data_with_all_cols
76+
if spec.target_category_columns:
77+
data = data.drop(spec.target_category_columns, axis=1)
6978
transformation_end_time = time.time()
7079
logger.info(
7180
f"{self.name} transformations completed in {transformation_end_time - transformation_start_time} seconds"

ads/opctl/operator/lowcode/common/transformations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def _set_series_id_column(self, df):
8585
df[DataColumns.Series] = merge_category_columns(
8686
df, self.target_category_columns
8787
)
88-
df = df.drop(self.target_category_columns, axis=1)
88+
#df = df.drop(self.target_category_columns, axis=1)
8989
return df
9090

9191
def _format_datetime_col(self, df):

0 commit comments

Comments
 (0)