Orange Forum • View topic - Automate the generation of SOM visualization graph

Automate the generation of SOM visualization graph

A place to ask questions about methods in Orange and how they are used and other general support.

Automate the generation of SOM visualization graph

Postby ppl » Tue May 11, 2010 5:46

Hi,

I'm trying to run SOM on different datasets. I intend to do this in code:

Code: Select all
import orange
import orngSOM
som = orngSOM.SOMLearner(map_shape=(10, 20), initialize=orngSOM.InitializeLinear)
map = som(orange.ExampleTable("C:/Python25/Lib/site-packages/orange/doc/datasets/iris.tab"))

 etc.



I'm looking for an example that automaticly generates the graph in canvas using OWSOMVisualizer and save it in an image file.

Is this possible?

Thanks,
ppl

Postby Ales » Tue May 11, 2010 9:44

Try something like this
Code: Select all
from OWWidget import *  #Qt related stuff
from OWSOMVisualizer import OWSOMVisualizer
from OWDlgs import OWChooseImageSizeDlg
app = QApplication([])
som_widget  = OWSOMVisualizer()

som_widget.setSomClassifier(map)

OWChooseImageSizeDlg(som_widget.scene).saveImage("som.png") # can also save to svg

Postby ppl » Tue May 11, 2010 17:08

Awesome!

This is exactly what I wanted to do.

Thanks,
ppl


Return to Questions & Support