Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   Python Cluster (http://www.velocityreviews.com/forums/t955122-python-cluster.html)

subhabangalore@gmail.com 12-04-2012 07:04 PM

Python Cluster
 
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.

Dave Angel 12-04-2012 07:25 PM

Re: Python Cluster
 
On 12/04/2012 02:04 PM, subhabangalore@gmail.com 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


Ian Kelly 12-04-2012 09:02 PM

Re: Python Cluster
 
On Tue, Dec 4, 2012 at 12:04 PM, <subhabangalore@gmail.com> 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/refe...endrogram.html


Miki Tebeka 12-04-2012 09:03 PM

Re: Python Cluster
 
On Tuesday, December 4, 2012 11:04:15 AM UTC-8, subhaba...@gmail.com 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

subhabangalore@gmail.com 12-05-2012 02:36 AM

Re: Python Cluster
 
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, subhaba...@gmail.com 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.


All times are GMT. The time now is 11:35 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.