K-means clustering to separate temperature vertical profiles I have temperature measurements from weather stations in a mountainous region and I want to obtain a vertical profile from these data at any given time.
In a simple case one can just plot all values in a temperature vs height chart and apply a linear/polynomial/fancy regression to obtain a curve and therefore an estimate of the lapse rate dT/dz.
In some cases, though, the weather changes abruptly and temperature will differ widely between, say, the eastern and western parts of the region. In such case the cloud of values in the above-mentioned plot will be quite messy and a regression won't be of help - R^2 will be quite low.
I was thinking of using a clustering algorithm in these cases, to split values into two groups (e.g. west and east), each having its own vertical profile, which would then (ideally) be suitable for applying regression. The algorithm could use information about each value's geographical position (lat-lon), which is hidden in the temp vs height plot, to figure out to which group each value belongs.
Can I achieve something like this using k-means? Any suggestion is welcome.
here is my 2 cents: k-means is an unsupervised method and therefore it's best suited if you wanted to explore the optimal number of clusters the temperature can be split, this could be useful to see that maybe there is more regions other than east or west were the temperature is different like north and south and you could use a silhouette score or elbow curve to find the optimal number of clusters.
But, what you describe here is a supervised classification problem where you already have the labels(east and west) and want to separate the temperature accordingly, depending on the type of data I would recommend a classification algorithm such as k-nearest neighbors
you could use k-means with a fixed number of clusters, in this case 2, but it would not be as effective as a supervised algorithm