# Which machine learning algorithm to choose?

I want to choose an unsupervised algorithm which learns to predict $n$ outputs from the data, for eg. 4 coordinates (pixels) in an image. What algorithm should I choose? I think it's a 2-class classification to divide the set of points in the image as belonging to output (1) or not (0), maybe logistic regression to give the probabilities of a point being the output point. But I am confused because classification algorithms are part of supervised algorithms where we have labelled data. Should I use clustering to find 2 groups of points that can be output or not? Maybe anomaly detection to find the 4 odd points out?

## 2 Answers

If you want to use an unsupervised method i.e if your data is not labelled with classes, then something like k-means clustering may be your best bet to find patterns in the data.

Alternatively, if you want to do anomaly detection, 2 possible options are

1. Assuming your data is normally distributed, you could fit a Gaussian to your data and calculate the Probability Density Function (PDF). Once you have the PDF, you can set a threshold probability, below which a data point could be classified as an anomaly
2. If you have enough data, use a Variational Autoencoder neural network. Very roughly speaking, you train this on all the data you deem to be “normal” (the neural network learns how to reconstruct the input data in the output), and then when anomalous cases are passed to the network, it can’t reconstruct it. If the network can’t reconstruct it accurately, the data is an anomaly.

Since you don't have any available labeled data, it is not easy to perform a supervised learning algorithm or at least a semi-supervised learning algorithm. The latter could be very useful in case that you could available a small dataset of labeled data.

One solution could be to perform a clustering algorithm first excluding the target feature, for example k-means for k equal to 2 and then train a model taking into account the cluster pseudo-labels. But you will not still be able to identify which of these two clusters is the class "1" or which one is the class "2".

You can have a reasonable solution only including a few labeled data, otherwise you can just perform some cluster analysis.