source: orange/orange/OrangeWidgets/Unsupervised/OWNetClustering.py @ 8155:3b3c8228397c

Revision 8155:3b3c8228397c, 1.8 KB checked in by miha <miha.stajdohar@…>, 3 years ago (diff)

Deleted the header text, made the widgets obsolete.

Line 
1"""
2THIS WIDGET IS OBSOLETE; USE OWNxClustering.py
3"""
4
5import orange
6import orngNetwork
7import OWGUI
8
9from OWWidget import *
10
11class OWNetClustering(OWWidget):
12   
13    settingsList = ['method', 'iterationHistory', "autoApply"]
14   
15    def __init__(self, parent=None, signalManager=None):
16        OWWidget.__init__(self, parent, signalManager, 'Network Clustering')
17       
18        self.inputs = [("Network", orngNetwork.Network, self.setNetwork, Default)]
19        self.outputs = [("Network", orngNetwork.Network)]
20       
21        self.net = None
22        self.method = 0
23        self.iterationHistory = 0
24        self.autoApply = 0
25       
26        self.loadSettings()
27       
28        ribg = OWGUI.radioButtonsInBox(self.controlArea, self, "method", [], "Method", callback = self.cluster)
29        OWGUI.appendRadioButton(ribg, self, "method", "Label propagation clustering (Raghavan et al., 2007)", callback = self.cluster)
30        OWGUI.checkBox(OWGUI.indentedBox(ribg), self, "iterationHistory", "Append clustering data on each iteration", callback = self.cluster)
31        self.info = OWGUI.widgetLabel(self.controlArea, ' ')
32        autoApplyCB = OWGUI.checkBox(self.controlArea, self, "autoApply", "Commit automatically")
33        OWGUI.button(self.controlArea, self, "Commit", callback=self.cluster)
34       
35    def setNetwork(self, net):
36        self.net = net
37        if self.autoApply:
38            self.cluster()
39       
40    def cluster(self):
41        self.info.setText(' ')
42       
43        if self.net == None:
44            self.send("Network", None)
45            return
46       
47        labels = self.net.clustering.labelPropagation(results2items=1, resultHistory2items=self.iterationHistory)
48        self.info.setText('%d clusters found' % len(set(labels)))       
49        self.send("Network", self.net)
Note: See TracBrowser for help on using the repository browser.