# Testing if a sample fits into an existing cluster

I have a sample of data I'd like to create a model from, which would create N clusters. After the fitting to clusters, I'd like to test various samples against the existing clusters, seeing if the samples fit any of the clusters, and if not see it as an "anomaly". I started working on it using DBScan (scikit), my data splits into 3 clusters but I can't find any function/method to test the specific sample against current results, without "refitting". Is there any other model that would fit my needs? or am I missing something when using DBScan?

For DBSCAN one would typically compute the distance to each Core point in a cluster, and find the smallest distance. DBSCAN already has a distance threshold eps used during fitting. But to allow tuning sensitivity of the anomaly detection without redoing the clustering, you may want to use a threshold of eps*ratio, where ratio is a new hyperparamter.