A hyperparameter is a configuration value chosen before model training or algorithm execution. It controls how a detector behaves rather than being learned from the data. section 14.3.3 section 6.1
In outlier detection, hyperparameters can determine neighborhood size, cluster density, distance calculations, or other detector behavior. Their values can materially change which records are flagged. section 4.11 section 14.3.3
Common tuning targets include:
- DBSCAN's eps parameter, which changes cluster membership and the number of flagged outliers. section 4.11
- KNN's k parameter, which can make nearest-neighbor detection sensitive to the selected neighborhood size. section 4.11
- The number of clusters and the distance metric used by clustering-based or distance-based detectors. section 14.3.3
A useful selection process evaluates several values rather than trusting defaults or one apparently optimal setting. AUROC can compare detectors and tune preprocessing, feature engineering, and hyperparameters when labeled or doped data are available. Prefer a range of values that performs well, because synthetic anomalies and real anomalies may differ. section 8.5.3 section 6.1
Varying DBSCAN eps
On baseball data, default DBSCAN parameters flag more records than is useful. Setting eps to 2.0 produces 1,255 inliers and 85 outliers. Running DBSCAN across eps values from 0.1 through 4.9 and summing each row's outlier flags produces a more parameter-robust score. section 4.11
Listing 4.5 Looping through the eps parameter for DBSCAN
df['DBSCAN Score'] = [0] * len(df)
for eps in np.arange(0.1, 5.0, 0.1):
df['DBSCAN Score'] += \
np.where(DBSCAN(eps=eps).fit_predict(df) < 0, 1, 0)
sns.histplot(df['DBSCAN Score'])
plt.show()
Shows a concise parameter sweep that converts binary DBSCAN results across eps values into numeric robustness scores. section 4.11


















