Skip to content

Commit 5fe8c49

Browse files
authored
BUG: Fallback model referencing target series rather than the target column (#832)
2 parents 9b52ad7 + f5b0421 commit 5fe8c49

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,11 +320,11 @@ def _fallback_build_model(self):
320320
# Iterate over the full_data_dict items
321321
for target, df in self.datasets.full_data_dict.items():
322322
est = linear_model.SGDOneClassSVM(random_state=42)
323-
est.fit(df[target].values.reshape(-1, 1))
323+
est.fit(df[self.spec.target_column].fillna(0).values.reshape(-1, 1))
324324
y_pred = np.vectorize(self.outlier_map.get)(
325-
est.predict(df[target].values.reshape(-1, 1))
325+
est.predict(df[self.spec.target_column].fillna(0).values.reshape(-1, 1))
326326
)
327-
scores = est.score_samples(df[target].values.reshape(-1, 1))
327+
scores = est.score_samples(df[self.spec.target_column].fillna(0).values.reshape(-1, 1))
328328

329329
anomaly = pd.DataFrame(
330330
{date_column: df[date_column], OutputColumns.ANOMALY_COL: y_pred}

0 commit comments

Comments
 (0)