Python Cluster

Discussion in 'Python' started by subhabangalore@gmail.com, Dec 4, 2012.

  1. Guest

    Dear Group,

    I am trying to use the cluster module as,
    >>> from cluster import *
    >>> data = [12,34,23,32,46,96,13]
    >>> cl = HierarchicalClustering(data, lambda x,y: abs(x-y))
    >>> cl.getlevel(10)

    [[96], [46], [12, 13, 23, 34, 32]]
    >>> cl.getlevel(5)

    [[96], [46], [12, 13], [23], [34, 32]]

    but now I want to visualize it if any one suggest how may I use visualization(like matplotlib or pyplot etc.) to see the data?

    Thanking in advance,
    Regards,
    Subhabrata.
    , Dec 4, 2012
    #1
    1. Advertising

  2. Dave Angel Guest

    On 12/04/2012 02:04 PM, wrote:
    > Dear Group,
    >
    > I am trying to use the cluster module as,
    >>>> from cluster import *


    No such module in the stdlib.

    Start by showing what OS, what Python version, and what external
    libraries you've installed and are using, and only then can you ask a
    meaningful question.



    --

    DaveA
    Dave Angel, Dec 4, 2012
    #2
    1. Advertising

  3. Ian Kelly Guest

    On Tue, Dec 4, 2012 at 12:04 PM, <> wrote:

    > Dear Group,
    >
    > I am trying to use the cluster module as,
    > >>> from cluster import *
    > >>> data = [12,34,23,32,46,96,13]
    > >>> cl = HierarchicalClustering(data, lambda x,y: abs(x-y))
    > >>> cl.getlevel(10)

    > [[96], [46], [12, 13, 23, 34, 32]]
    > >>> cl.getlevel(5)

    > [[96], [46], [12, 13], [23], [34, 32]]
    >
    > but now I want to visualize it if any one suggest how may I use
    > visualization(like matplotlib or pyplot etc.) to see the data?
    >


    You mean like a dendrogram? Scipy has support for that. It uses
    matplotlib to do the actual plotting.

    http://docs.scipy.org/doc/scipy/reference/generated/scipy.cluster.hierarchy.dendrogram.html
    Ian Kelly, Dec 4, 2012
    #3
  4. Miki Tebeka Guest

    On Tuesday, December 4, 2012 11:04:15 AM UTC-8, wrote:
    > >>> cl = HierarchicalClustering(data, lambda x,y: abs(x-y))

    > but now I want to visualize it if any one suggest how may I use visualization(like matplotlib or pyplot etc.) to see the data?

    One option is to use a scatter plot with different color per cluster. See the many examples in http://matplotlib.org/gallery.html.

    HTH,
    --
    Miki
    Miki Tebeka, Dec 4, 2012
    #4
  5. Guest

    On Wednesday, December 5, 2012 2:33:56 AM UTC+5:30, Miki Tebeka wrote:
    > On Tuesday, December 4, 2012 11:04:15 AM UTC-8, wrote:
    >
    > > >>> cl = HierarchicalClustering(data, lambda x,y: abs(x-y))

    >
    > > but now I want to visualize it if any one suggest how may I use visualization(like matplotlib or pyplot etc.) to see the data?

    >
    > One option is to use a scatter plot with different color per cluster. See the many examples in http://matplotlib.org/gallery.html.
    >
    >
    >
    > HTH,
    >
    > --
    >
    > Miki


    Thanks Miki. Good Gallery I think it'd do. We can plot as we feel. Regards,Subhabrata.
    , Dec 5, 2012
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Uwe Schmitt

    python + cluster computing

    Uwe Schmitt, Jul 9, 2003, in forum: Python
    Replies:
    1
    Views:
    380
    Tim Churches
    Jul 9, 2003
  2. Gurpreet Sachdeva

    Python on Linux Cluster

    Gurpreet Sachdeva, Dec 23, 2004, in forum: Python
    Replies:
    1
    Views:
    357
    Irmen de Jong
    Dec 23, 2004
  3. uli
    Replies:
    2
    Views:
    342
  4. abhinav
    Replies:
    1
    Views:
    432
    Armin Steinhoff
    Feb 19, 2006
  5. Asaf Hayman
    Replies:
    4
    Views:
    310
    Jason Scheirer
    Nov 18, 2008
Loading...

Share This Page