Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Clustering

  • To: mathgroup at smc.vnet.net
  • Subject: [mg127994] Re: Clustering
  • From: Bob Hanlon <hanlonr357 at gmail.com>
  • Date: Fri, 7 Sep 2012 04:59:50 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <20120906081314.D511E683B@smc.vnet.net>

data1 = {10996160116271, 10996160121402, 10996159625418,
   10996162114125, 10996160124050, 10996162119731, 10996162119161,
   10996162119412, 10996159624663, 10996159625205, 10996162082868,
   10996159624249, 10996162084724, 10996162091672, 10996162117101,
   10996162100233, 10996162119612, 10996163806869, 10996162119594,
   10996160176675, 10996160176687, 10996160176724, 10996160176645,
   10996162120528, 10996160157953, 10996160147558, 10996160159628,
   10996160158103, 10996160153768, 10996160158093, 10996160147558,
   10996162118276, 10996162119018, 10996163808057, 10996163808139,
   10996163807032, 10996162122560, 10996162068604, 10996162127032,
   10996162119426, 10996162119433, 10996162119039, 10996162119429,
   10996162118843, 10996162119436, 10996162120269, 10996162119583,
   10996162120271, 10996162120255, 10996162119663, 10996162064880,
   10996162120272, 10996162120224, 10996162119666, 10996163810937,
   10996162118985, 10996162119234, 10996160158214, 10996163810862,
   10996162119390, 10996162119218, 10996162119211, 10996162119144,
   10996162119264, 10996162119046, 10996162119267, 10996162120316,
   10996162119425, 10996162119536, 10996162119071, 10996162119346,
   10996162120402, 10996162119091, 10996162119030, 10996162119499,
   10996162115558, 10996162119337, 10996162119035, 10996162119534,
   10996162117042, 10996162119215, 10996162119393, 10996162118962,
   10996159624797, 10996162120344, 10996162119377, 10996162120222,
   10996162120223, 10996162119407, 10996162120246, 10996162120279,
   10996162120326, 10996162119994, 10996162120057, 10996162120294,
   10996162119880, 10996162119513, 10996162119803, 10996160145836,
   10996160136827, 10996162068121, 10996162078289, 10996159618487,
   10996159623760, 10996159624293, 10996160180483, 10996159624759,
   10996162118806, 10996160181693, 10996159623760, 10996159624411,
   10996160116463, 10996159618114, 10996160162419, 10996160160562,
   10996160121379, 10996160125728, 10996160168867, 10996160142681,
   10996160168532, 10996160168551, 10996160150082, 10996159625337,
   10996159625454};

ListPlot[data1,
 PlotRange -> All, ImageSize -> 300,
 Frame -> True, Axes -> False]

clu = FindClusters[data1, Method -> "Agglomerate"];

clu4 = FindClusters[data1, 4, Method -> "Agglomerate"];

clu === clu4

True

ListPlot[clu,
 PlotRange -> All, ImageSize -> 300,
 Frame -> True, Axes -> False]

curveColor[n_Integer] :=
  Hue[Mod[2/3 - 2 + Sqrt[5]*(n - 1), 1], 0.6, 0.6];

Clear[plt]

plt[v_, color_: curveColor[1]] := ListPlot[
  Sort[v] - Median[v],
  PlotRange -> All, ImageSize -> 300,
  Frame -> True, Axes -> False,
  PlotStyle -> color]

plt[data1]

n = 1; Column[plots =
  (plt[#, curveColor[n++]] & /@ clu)]

Show[plots]

ListPlot[
 Sort[#] - Median[#] & /@ clu,
 PlotRange -> All, ImageSize -> 300,
 Frame -> True, Axes -> False]


Bob Hanlon


On Thu, Sep 6, 2012 at 4:13 AM, Nigel King
<nigel.king at cambiumnetworks.com> wrote:
> Hi All,
> The following short program has some data which looks visually as though =
it would separate into 4 groups by the use of the command FindClusters. You=
 can see the use of that command in the lines below but, the data has not s=
eparated as I would have expected. I realise that I do not know how to use =
the various clustering components of mathematica to do this. Any insight wo=
uld be useful.
>
> Thanks
>
> Nigel King
>
>
> data1 = {10996160116271, 10996160121402, 10996159625418, 10996162114125=
,
>    10996160124050, 10996162119731, 10996162119161, 10996162119412,
>    10996159624663, 10996159625205, 10996162082868, 10996159624249,
>    10996162084724, 10996162091672, 10996162117101, 10996162100233,
>    10996162119612, 10996163806869, 10996162119594, 10996160176675,
>    10996160176687, 10996160176724, 10996160176645, 10996162120528,
>    10996160157953, 10996160147558, 10996160159628, 10996160158103,
>    10996160153768, 10996160158093, 10996160147558, 10996162118276,
>    10996162119018, 10996163808057, 10996163808139, 10996163807032,
>    10996162122560, 10996162068604, 10996162127032, 10996162119426,
>    10996162119433, 10996162119039, 10996162119429, 10996162118843,
>    10996162119436, 10996162120269, 10996162119583, 10996162120271,
>    10996162120255, 10996162119663, 10996162064880, 10996162120272,
>    10996162120224, 10996162119666, 10996163810937, 10996162118985,
>    10996162119234, 10996160158214, 10996163810862, 10996162119390,
>    10996162119218, 10996162119211, 10996162119144, 10996162119264,
>    10996162119046, 10996162119267, 10996162120316, 10996162119425,
>    10996162119536, 10996162119071, 10996162119346, 10996162120402,
>    10996162119091, 10996162119030, 10996162119499, 10996162115558,
>    10996162119337, 10996162119035, 10996162119534, 10996162117042,
>    10996162119215, 10996162119393, 10996162118962, 10996159624797,
>    10996162120344, 10996162119377, 10996162120222, 10996162120223,
>    10996162119407, 10996162120246, 10996162120279, 10996162120326,
>    10996162119994, 10996162120057, 10996162120294, 10996162119880,
>    10996162119513, 10996162119803, 10996160145836, 10996160136827,
>    10996162068121, 10996162078289, 10996159618487, 10996159623760,
>    10996159624293, 10996160180483, 10996159624759, 10996162118806,
>    10996160181693, 10996159623760, 10996159624411, 10996160116463,
>    10996159618114, 10996160162419, 10996160160562, 10996160121379,
>    10996160125728, 10996160168867, 10996160142681, 10996160168532,
>    10996160168551, 10996160150082, 10996159625337, 10996159625454};
> clu = FindClusters[data1, 4, Method -> "Optimize"];
> plt[v_] :=
>  ListPlot[Sort[v] - Median[v], PlotRange -> All, ImageSize -> 300,
>   Frame -> True, Axes -> False]
> plt[data1]
> Map[plt, c1u] // Column=
>
>



  • References:
    • Clustering
      • From: Nigel King <nigel.king@cambiumnetworks.com>
  • Prev by Date: Re: Transforming/expanding a list
  • Next by Date: Re: Mathematica Prove[...] Command Possible?
  • Previous by thread: Clustering
  • Next by thread: Re: Clustering