Prediction averaging aggregates detector scores across multiple parameter values or detectors, typically by computing a mean. It reduces dependence on one potentially poor configuration and can make outlier rankings more robust. section 8.1.1
A practical workflow is:
- Run one detector with several parameter values, such as KNN with k = 5, 10, 20, 50, and 100, and collect its scores. section 8.1.1
- Normalize scores from different detectors before combining them, using MinMaxScaler so their scales are comparable. section 8.1.1
- Average the resulting scores and inspect the ranking rather than treating every flagged point as automatically meaningful. section 8.1.1
KNN across parameter values
A KNN detector can fit once for each selected k, store each decision-score vector in a pandas dataframe, and combine the rows into one score column. Averaging several imperfect k values can outperform relying on one estimated optimum. section 8.1.1
Listing 8.2 Averaging over multiple detectors
scaler = MinMaxScaler()
for col_name in scores_df.columns:
scores_df[col_name] = \
scaler.fit_transform(np.array(scores_df[col_name]).reshape(-1, 1))
scores_df['Avg Score'] = scores_df.sum(axis=1)
Shows the implementation pattern for scaling detector scores and creating a combined score. section 8.1.1

