orange-nmf / orangecontrib / nmf / widgets /

Aleš Erjavec 9b561c4 

Aleš Erjavec 67704ab 

Aleš Erjavec 9b561c4 

<name>Missing Values Indicator</name>
<description>Detection of Missing Values</description>

import numpy as np

#import sys
from OWWidget import *
import OWGUI

NAME = "Missing Values Indicator"
DESCRIPTION = "Detection of Missing Values"
ICON = "icons/MissingIcon.png"

INPUTS = [("Data", ExampleTable, "data")]
OUTPUTS = [("Missing Values Indicator", ExampleTable)]

REPLACES = ["_nmf.widgets.OWMissingValues.OWMissingValues"]

class OWMissingValues(OWWidget):
    settingsList = []
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self, parent, signalManager, 'Missing Values Indicator')
        self.inputs = [("Data", ExampleTable,]
        self.outputs = [("Missing Values Indicator", ExampleTable)]

        # GUI
        box = OWGUI.widgetBox(self.controlArea, "Info")
        self.infoa = OWGUI.widgetLabel(box, 'No data on input yet, waiting to get something.')
        self.infob = OWGUI.widgetLabel(box, '')

        OWGUI.button(self.controlArea, self, "Commit", callback=self.commit)        

    def data(self, dataset):
        if dataset:
            self.dataset = dataset
            self.infoa.setText('%d variables in input data set' % len(dataset[0]))
            self.infob.setText('%d observations in input data set' % len(dataset))
            self.send("Missing Values Indicator", None)
            self.infoa.setText('No data on input yet, waiting to get something.')
    def commit(self):
        # find missing value and report them in indicator matrix
        indic=np.ones([len(self.dataset),len(self.dataset[0])]) #last column of data is the IDs
        for i in range(0,len(self.dataset)):
            for j in range(0,len(self.dataset[0])): 
                if self.dataset[i][j].isSpecial():
        domainX=self.dataset.domain, np.array(self.outputData))       
        for i in range(0,len(self.dataset)):        
        self.send("Missing Values Indicator", self.outputData)     

# Test the widget, run from prompt

if __name__=="__main__":
    appl = QApplication(sys.argv)
    ow = OWMissingValues()
    dataset = orange.ExampleTable('C:/Users/Fajwel/Dropbox/Orange/testMissingData.txt')
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.