<div dir="ltr">Hi all,<div><br></div><div>I followed the pathway of using R and its hierarchical clustering tools.</div><div>For all interested, I came up with following code that creates clusters</div><div>with a user-specified minimum distance between the cluster means.</div>
<div>So this code does not specify the number of clusters a priori.</div><div><br></div><div><div>x <- runif(100,0,150)</div><div>y <- runif(100,0,150)</div><div>df <- data.frame(x,y)</div><div>plot(df)</div><div>
<br></div><div>hc <- hclust(dist(df,method = "euclidean"), method="average")</div><div>plot(hc)</div><div><br></div><div>df$memb <- cutree(hc, h = 60)</div><div><br></div><div>cent <- NULL</div>
<div>for(k in 1:length(unique(df$memb))){</div><div>  cent <- rbind(cent, colMeans(df[df$memb == k, , drop = FALSE]))</div><div>}</div><div>cent <- as.data.frame(cent)</div><div>summary(dist(cent))</div><div><br></div>
<div>plot(df$x,df$y,col=df$memb)</div><div>points(cent$x,cent$y,pch=15)</div></div><div><br></div><div>Of course this could also be used with a distance matrix provided</div><div>by any GRASS output (v.distance or distance along a network etc.)</div>
<div><br></div><div>Most probably there are also similar libraries for hierachical clustering</div><div>and cutting cluster dendrogramms available for python. Maybe together</div><div>with Pietro's approach, its worth considering to write a short add-on, if this</div>
<div>is also of interest to other users.</div><div><br></div><div>Thanks for all your hints!</div><div><br></div><div>cheers,</div><div>Johannes</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jul 9, 2014 at 6:11 PM, Pietro <span dir="ltr"><<a href="mailto:peter.zamb@gmail.com" target="_blank">peter.zamb@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Johannes,<br>
<div><div class="h5"><br>
On Tue, Jul 8, 2014 at 1:58 PM, Johannes Radinger<br>
<<a href="mailto:johannesradinger@gmail.com">johannesradinger@gmail.com</a>> wrote:<br>
> I've a point vector containing more than 500 points.<br>
> Some of these points are spatially clumped while<br>
> others are single independent points (from viewing the<br>
> map). Now I am wondering if there is any tool in<br>
> GRASS (or maybe other spatial-statistical software<br>
> like R) that can be used to group the data so that each<br>
> point clump is assigned to a group and each single group to its<br>
> own group. Of course, this needs a criterion where<br>
> to distinguish between groups/clusters. I'd like to have<br>
> groups that are separated by a distance of at least 5 km.<br>
><br>
> Is there any recommendation of a simple or more<br>
> advanced procedure to do that?<br>
<br>
</div></div>I play a bit with some machine learning algorithm, the code is:<br>
<br>
<a href="https://gist.github.com/zarch/f849df450d622f9eadee" target="_blank">https://gist.github.com/zarch/f849df450d622f9eadee</a><br>
<br>
you can see the results apply to the vector map "points_of_interest"<br>
present in the North Carolina mapset, here:<br>
<br>
<a href="https://plus.google.com/115946523992149326262/posts/2R9HfQh6UvQ" target="_blank">https://plus.google.com/115946523992149326262/posts/2R9HfQh6UvQ</a><br>
<br>
cheers<br>
<span class="HOEnZb"><font color="#888888"><br>
Pietro<br>
</font></span></blockquote></div><br></div>