Skip to content

Commit

Permalink
replace the target label to reference the target column rather then t…
Browse files Browse the repository at this point in the history
…he series id
  • Loading branch information
codeloop committed May 10, 2024
1 parent d79695d commit 5153ed3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ads/opctl/operator/lowcode/anomaly/model/base_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,11 +320,11 @@ def _fallback_build_model(self):
# Iterate over the full_data_dict items
for target, df in self.datasets.full_data_dict.items():
est = linear_model.SGDOneClassSVM(random_state=42)
est.fit(df[target].values.reshape(-1, 1))
est.fit(df[self.spec.target_column].fillna(0).values.reshape(-1, 1))
y_pred = np.vectorize(self.outlier_map.get)(
est.predict(df[target].values.reshape(-1, 1))
est.predict(df[self.spec.target_column].fillna(0).values.reshape(-1, 1))
)
scores = est.score_samples(df[target].values.reshape(-1, 1))
scores = est.score_samples(df[self.spec.target_column].fillna(0).values.reshape(-1, 1))

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

0 comments on commit 5153ed3

Please sign in to comment.