@@ -33,7 +33,6 @@ def _build_model(self) -> AnomalyOutput:
33
33
# self.outlier_map = {1: 0, -1: 1}
34
34
35
35
anomaly_output = AnomalyOutput (date_column = "index" )
36
- # TODO: PDB
37
36
38
37
# Set tree parameters
39
38
num_trees = model_kwargs .get ("num_trees" , 200 )
@@ -42,8 +41,11 @@ def _build_model(self) -> AnomalyOutput:
42
41
43
42
for target , df in self .datasets .full_data_dict .items ():
44
43
df_values = df [self .spec .target_column ].astype (float ).values
44
+
45
+ # TODO: Update size to log logic
45
46
points = np .vstack (list (rrcf .shingle (df_values , size = 4 )))
46
47
48
+ # TODO: remove hardcode
47
49
sample_size_range = (1 , 6 )
48
50
n = points .shape [0 ]
49
51
avg_codisp = pd .Series (0.0 , index = np .arange (n ))
@@ -62,16 +64,19 @@ def _build_model(self) -> AnomalyOutput:
62
64
np .add .at (index , codisp .index .values , 1 )
63
65
64
66
avg_codisp /= index
67
+ # TODO: remove hardcode
65
68
avg_codisp .index = df .iloc [(4 - 1 ) :].index
66
69
avg_codisp = (avg_codisp - avg_codisp .min ()) / (
67
70
avg_codisp .max () - avg_codisp .min ()
68
71
)
69
72
73
+ # TODO: use model kwargs for percentile threshold
70
74
y_pred = (avg_codisp > np .percentile (avg_codisp , 95 )).astype (int )
71
75
72
- import pdb
76
+ # TODO: rem pdb
77
+ # import pdb
73
78
74
- pdb .set_trace ()
79
+ # pdb.set_trace()
75
80
print ("Done" )
76
81
77
82
# scores = model.score_samples(df)
0 commit comments