I will make k-means clustering for a segmentation project.But I know that this algorithm is effectable from outliers.Which way should I perform for detecting outliers before doing k-means algorithm? For example should I perform anomaly detection algorithm on the data set to detect outliers and after detecting and excluding outliers ,performing k-means algorithm for more stable clustering? Or Should I detect outliers by using k-means algorithm itself by finding average distances and finding the outliers beyond these distances? What approach should be taken for detecting outliers and making more stable clustering? I need your suggestions.
Detect outlier first, if you data set maybe contain outlier.
Try the isolationForest method, it's fast and efficient to detect the outliers.