Re: Question - Cluster Analysis
- To: mathgroup at smc.vnet.net
- Subject: [mg89833] Re: [mg89805] Question - Cluster Analysis
- From: DrMajorBob <drmajorbob at att.net>
- Date: Sun, 22 Jun 2008 03:22:45 -0400 (EDT)
- References: <26977856.1214052740543.JavaMail.root@m08>
- Reply-to: drmajorbob at longhorns.com
Here are a few possibilities:
Needs["HierarchicalClustering`"]
data = {{1, 2, 2}, {1, 3, 3}, {2, 4, 2}, {5, 4, 3}, {5, 4, 4}, {7, 6,
7}};
agg = Agglomerate[data];
Reverse@Sort@Cases[{agg}, Cluster[_, _, d_, _, _] :> d, Infinity]
{17, 10, 3, 2, 1}
Flatten@Table[
Cases[{agg}, Cluster[_, _, d_, _, _] :> d, {k}], {k, 1, Depth@agg}]
{17, 10, 3, 1, 2}
Cases[{agg}, Cluster[_, _, d_, _, _] :> d, Infinity]
{2, 3, 1, 10, 17}
Bobby
On Sat, 21 Jun 2008 04:29:23 -0500, Steve Mahoney
<patrick.bernhard at gmx.net> wrote:
> Hello,
>
> I have a question regarding hierarchical cluster analysis. One measure
> to determine the number of clusters is the so called elbow criteria,
> which is just a list of the single distances between the clusters.
>
> These values are inside the results from the Agglomerate function, but I
> am not able to extract them to a list.
>
> data = {{1, 2, 2}, {1, 3, 3}, {2, 4, 2}, {5, 4, 3}, {5, 4, 4}, {7, 6,
> 7}};
>
> Agglomerate[data]
>
> Cluster[Cluster[
> Cluster[Cluster[{1, 2, 2}, {1, 3, 3}, 2, 1, 1], {2, 4, 2}, 3, 2, 1],
> Cluster[{5, 4, 3}, {5, 4, 4}, 1, 1, 1], 10, 3, 2], {7, 6, 7}, 17, 5, 1]
>
> --> now I have to extract the values manually
>
> elbowcriterium = ListLinePlot[{17, 10, 3, 2, 1}]
>
> --> suggesting three clusters
>
> Thanks a lot for a suggestion, how to handle this, which would be really
> helpful for me!
>
>
--
DrMajorBob at longhorns.com