Skip to content

Commit 8dbccae

Browse files
committed
draft commit rcf
1 parent 97c78b0 commit 8dbccae

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ def _build_model(self) -> AnomalyOutput:
3333
# self.outlier_map = {1: 0, -1: 1}
3434

3535
anomaly_output = AnomalyOutput(date_column="index")
36-
# TODO: PDB
3736

3837
# Set tree parameters
3938
num_trees = model_kwargs.get("num_trees", 200)
@@ -42,8 +41,11 @@ def _build_model(self) -> AnomalyOutput:
4241

4342
for target, df in self.datasets.full_data_dict.items():
4443
df_values = df[self.spec.target_column].astype(float).values
44+
45+
# TODO: Update size to log logic
4546
points = np.vstack(list(rrcf.shingle(df_values, size=4)))
4647

48+
# TODO: remove hardcode
4749
sample_size_range = (1, 6)
4850
n = points.shape[0]
4951
avg_codisp = pd.Series(0.0, index=np.arange(n))
@@ -62,16 +64,19 @@ def _build_model(self) -> AnomalyOutput:
6264
np.add.at(index, codisp.index.values, 1)
6365

6466
avg_codisp /= index
67+
# TODO: remove hardcode
6568
avg_codisp.index = df.iloc[(4 - 1) :].index
6669
avg_codisp = (avg_codisp - avg_codisp.min()) / (
6770
avg_codisp.max() - avg_codisp.min()
6871
)
6972

73+
# TODO: use model kwargs for percentile threshold
7074
y_pred = (avg_codisp > np.percentile(avg_codisp, 95)).astype(int)
7175

72-
import pdb
76+
# TODO: rem pdb
77+
# import pdb
7378

74-
pdb.set_trace()
79+
# pdb.set_trace()
7580
print("Done")
7681

7782
# scores = model.score_samples(df)

0 commit comments

Comments
 (0)