16
16
17
17
from ads .common .object_storage_details import ObjectStorageDetails
18
18
from ads .opctl import logger
19
- from ads .opctl .operator .lowcode .anomaly .const import OutputColumns , SupportedMetrics
19
+ from ads .opctl .operator .lowcode .anomaly .const import OutputColumns , SupportedMetrics , SUBSAMPLE_THRESHOLD
20
20
from ads .opctl .operator .lowcode .anomaly .utils import _build_metrics_df , default_signer
21
21
from ads .opctl .operator .lowcode .common .utils import (
22
22
disable_print ,
@@ -79,7 +79,7 @@ def generate_report(self):
79
79
anomaly_output , test_data , elapsed_time
80
80
)
81
81
table_blocks = [
82
- rc .DataTable (df .head (1000 ) if self .spec .subsample_report_data and len (df ) > 1000 else df , label = col , index = True )
82
+ rc .DataTable (df .head (SUBSAMPLE_THRESHOLD ) if self .spec .subsample_report_data and len (df ) > SUBSAMPLE_THRESHOLD else df , label = col , index = True )
83
83
for col , df in self .datasets .full_data_dict .items ()
84
84
]
85
85
data_table = rc .Select (blocks = table_blocks )
@@ -100,9 +100,10 @@ def generate_report(self):
100
100
if self .spec .subsample_report_data :
101
101
non_anomaly_indices = [i for i in range (len (time_col )) if i not in anomaly_indices ]
102
102
# Downsample non-anomalous data if it exceeds the threshold (1000)
103
- if len (non_anomaly_indices ) > 1000 :
104
- downsampled_non_anomaly_indices = non_anomaly_indices [::len (non_anomaly_indices )// 1000 ]
105
- selected_indices = sorted (anomaly_indices + downsampled_non_anomaly_indices )
103
+ if len (non_anomaly_indices ) > SUBSAMPLE_THRESHOLD :
104
+ downsampled_non_anomaly_indices = non_anomaly_indices [::len (non_anomaly_indices )// SUBSAMPLE_THRESHOLD ]
105
+ selected_indices = anomaly_indices + downsampled_non_anomaly_indices
106
+ selected_indices .sort ()
106
107
downsampled_time_col = time_col [selected_indices ]
107
108
108
109
columns = set (df .columns ).difference ({date_column })
0 commit comments