def __init__(self, parent=None, signalManager=None): OWRpy.__init__(self) self.setRvariableNames(["melt"]) self.require_librarys(["reshape"]) self.data = {} self.RFunctionParam_data = '' self.inputs.addInput("data", "Data Table", signals.RDataFrame.RDataFrame, self.processdata) self.outputs.addOutput("melt Output","Molten Data", signals.RDataFrame.RDataFrame) self.RFunctionParamna_rm_radioButtons = redRradioButtons(self.controlArea, label = "Remove NA's:", buttons = ["TRUE","FALSE"], setChecked = "TRUE") self.RFunctionParammeasure_vars_comboBox = redRcomboBox(self.controlArea, label = "Measure Variables (Values):") self.RFunctionParamvariable_name_lineEdit = redRlineEdit(self.controlArea, label = "New Variable Column Name:", text = 'variable') self.RFunctionParamid_vars_listBox = redRListBox(self.controlArea, label = "id_vars:") self.RFunctionParamid_vars_listBox.setSelectionMode(QAbstractItemView.ExtendedSelection) redRCommitButton(self.bottomAreaRight, "Commit", callback = self.commitFunction) self.RoutputWindow = redRtextEdit(self.controlArea, label = "R Output Window")
def __init__(self, parent=None, signalManager=None): OWRpy.__init__(self) self.require_librarys(["caret"]) self.setRvariableNames(["train", 'tempData']) self.data = {} self.RFunctionParam_data = '' self.inputs.addInput("data", "data", [ signals.RArbitraryList.RArbitraryList, signals.RDataFrame.RDataFrame ], self.processdata) self.outputs.addOutput("train Output", "train Output", signals.RModelFit.RModelFit) self.trainingData = redRcomboBox(self.controlArea, label='Training Data:') self.RFunctionParamcustomArgs_lineEdit = redRlineEdit( self.controlArea, label="customArgs:", text='') #self.RFunctionParamtrControl_lineEdit = redRlineEdit(self.controlArea, label = "trControl:", text = '') self.RFunctionParammethod_comboBox = redRcomboBox( self.controlArea, label="Method:", items=[ "ada", "bagEarth", "bagFDA", "blackboost", "cforest", "ctree", "ctree2", "earth", "enet", "fda", "gamboost", "gaussprPoly", "gaussprRadial", "gaussprLinear", "gbm", "glm", "glmboost", "glmnet", "gpls", "J48", "JRip", "knn", "lars", "lasso", "lda", "Linda", "lm", "lmStepAIC", "LMT", "logitBoost", "lssvmPoly", "lssvmRadial", "lvq", "M5Rules", "mda", "multinom", "nb", "nnet", "nodeHarvest", "OneR", "pam", "pcaNNet", "pcr", "pda", "pda2", "penalized", "pls", "ppr", "qda", "QdaCov", "rda", "rf", "rlm", "rpart", "rvmLinear", "rvmPoly", "rvmRadial", "sda", "sddaLDA", "sddaQDA", "slda", "smda", "sparseLDA", "spls", "stepLDA", "stepQDA", "superpc", "svmPoly", "svmRadial", "svmLinear", "treebag", "vbmpRadial" ]) #self.formula = redRRFormulaEntry(self.controlArea) self.resultVariable = redRcomboBox(self.controlArea, label='Class Data:') self.RFunctionParamform_lineEdit = redRlineEdit(self.controlArea, label="form:", text='') self.RoutputWindow = redRtextEdit(self.controlArea, label="R Output Window") redRCommitButton(self.bottomAreaRight, "Commit", callback=self.commitFunction)
def __init__(self, parent=None, signalManager=None): OWRpy.__init__(self) self.require_librarys(["caret"]) self.setRvariableNames(["findCorrelation"]) self.data = {} self.RFunctionParam_x = '' self.RFunctionParam_data = '' #self.inputs.addInput("x", "Correlation Matrix", signals.RMatrix.RMatrix, self.processx) self.inputs.addInput( "data", "Data Table / Sample List", [signals.RDataFrame.RDataFrame, signals.RList.RList], self.processdata) self.outputs.addOutput("findCorrelation Output", "Reduced Data Table", signals.RDataFrame.RDataFrame) self.outputs.addOutput("findCorrelation Output List", "Reduced Data List", signals.RList.RList) self.trainingData = redRComboBox(self.controlArea, label='Training Data') self.classLabels = redRComboBox(self.controlArea, label='Classes') self.nearZero = redRRadioButtons( self.controlArea, label='Remove Near Zero Variance Predictors?', buttons=['Yes', 'No'], setChecked='Yes', callback=self.nzvShowHide) self.nzvBox = redRWidgetBox(self.controlArea) self.freqCut = redRLineEdit(self.nzvBox, label='Frequency Cut:', text='95/5') self.uniqueCut = redRLineEdit(self.nzvBox, label='Unique Cut:', text='10') self.RFunctionParamcutoff_spinBox = redRSpinBox( self.controlArea, label="Max Correlation Coef (/100):", min=1, max=99, value=90) redRCommitButton(self.bottomAreaRight, "Commit", callback=self.commitFunction) self.RoutputWindow = redRtextEdit(self.controlArea, label="R Output Window")
def __init__(self, parent=None, signalManager=None): OWRpy.__init__(self) self.require_librarys(["caret"]) self.setRvariableNames(["createDataPartition", 'dataOutputList']) self.data = {} self.RFunctionParam_y = '' self.inputs.addInput("y", "Input Vector List", signals.RDataFrame.RDataFrame, self.processy) self.outputs.addOutput("createDataPartition Output","Partition/Resample/Fold List", signals.RList.RList) self.outputs.addOutput("dataOutputList", "Data Output List \n(Subsets of data that matches the partitioning)", signals.RList.RList) self.ListElementCombo = redRcomboBox(self.controlArea, label = 'List Element (Vector):') self.functionCombo = redRcomboBox(self.controlArea, label = 'Function:', items = ['Partition', 'Resample', 'Fold']) self.RFunctionParamp_spinBox = redRSpinBox(self.controlArea, label = "Percentage (Partition):", value = 50, min = 1, max = 100) #self.RFunctionParamlist_radioButtons = redRradioButtons(self.controlArea, label = "list:", buttons = ["TRUE"], setChecked = "") self.RFunctionParamgroups_spinBox = redRSpinBox(self.controlArea, label = "Number of Quantiles (Partition on Numeric Data):", value = 5, min = 1) self.RFunctionParamtimes_spinBox = redRSpinBox(self.controlArea, label = "Number of Partitions (Partition and Resample):", value = 1, min = 1, toolTip = 'Typically higher values are set for resampling because one wants to generate several resamples at once.') self.RFunctionParam_folds_spinBox = redRSpinBox(self.controlArea, label = "Number of Folds (Folds):", value = 10, min = 1) redRCommitButton(self.bottomAreaRight, "Commit", callback = self.commitFunction) self.RoutputWindow = redRtextEdit(self.controlArea, label = "R Output Window")
def __init__(self, parent=None, signalManager=None): OWRpy.__init__(self) self.setRvariableNames(["t.test"]) self.data = {} self.RFunctionParam_y = '' self.RFunctionParam_x = '' self.inputs.addInput("y", "y", signals.RVector.RVector, self.processy) self.inputs.addInput("x", "x", signals.RVector.RVector, self.processx) self.outputs.addOutput("t.test Output", "t.test Output", signals.RModelFit.RModelFit) self.RFunctionParampaired_radioButtons = redRradioButtons( self.controlArea, label="paired:", buttons=["TRUE", "FALSE"], setChecked="FALSE", orientation='horizontal') self.RFunctionParamalternative_checkBox = redRradioButtons( self.controlArea, label="alternative:", buttons=["two.sided", "less", "greater"], setChecked="two.sided", orientation='horizontal') self.RFunctionParamvar_equal_radioButtons = redRradioButtons( self.controlArea, label="var_equal:", buttons=["TRUE", "FALSE"], setChecked="FALSE", orientation='horizontal') self.RFunctionParamconf_level_lineEdit = redRlineEdit( self.controlArea, label="conf_level:", text='0.95') self.RFunctionParammu_lineEdit = redRlineEdit(self.controlArea, label="mu:", text='') redRCommitButton(self.bottomAreaRight, "Commit", callback=self.commitFunction) self.RoutputWindow = redRtextEdit(self.controlArea, label="R Output Window")
def __init__(self, parent=None, signalManager=None): OWRpy.__init__(self) self.setRvariableNames(["table", "propTable"]) self.data = {} self.RFunctionParam_data = '' self.inputs.addInput("data", _("Data Table"), signals.RDataFrame.RDataFrame, self.processdata) self.outputs.addOutput("table Output", _("Table Output"), signals.RDataFrame.RDataFrame) self.outputs.addOutput("propTable", _("Prob Table Output"), signals.RDataFrame.RDataFrame) self.cols = redRListBox(self.controlArea, label=_('Use Columns:'), selectionMode=QAbstractItemView.MultiSelection) self.commit = redRCommitButton(self.bottomAreaRight, _("Commit"), callback=self.commitFunction, processOnInput=True) self.RoutputWindow = redRtextEdit(self.controlArea, label=_("R Output Window"))
def __init__(self, parent=None, signalManager=None): OWRpy.__init__(self) self.setRvariableNames(["predict", 'tempData']) self.data = {} self.RFunctionParam_object = '' self.RFunctionParam_newData = '' self.inputs.addInput("object", "object", signals.RModelFit.RModelFit, self.processobject) self.inputs.addInput("newData", "newData", [ signals.RArbitraryList.RArbitraryList, signals.RDataFrame.RDataFrame ], self.processnewData) self.outputs.addOutput("predict Output", "predict Output", signals.RModelFit.RModelFit) self.testData = redRcomboBox(self.controlArea, label='Test Data:') self.classLabels = redRcomboBox(self.controlArea, label='Class Labels:') redRCommitButton(self.bottomAreaRight, "Commit", callback=self.commitFunction) self.RoutputWindow = redRtextEdit(self.controlArea, label="R Output Window")
def __init__(self, parent=None, signalManager=None): OWRpy.__init__(self) self.setRvariableNames(["cast"]) self.data = {} self.require_librarys(["reshape"]) self.RFunctionParam_data = '' self.inputs.addInput("data", "Molten Data", signals.RDataFrame.RDataFrame, self.processdata) self.outputs.addOutput("cast Output", "Reshaped Data", signals.RDataFrame.RDataFrame) self.RFunctionParamformula_listBox = redRListBox( self.controlArea, label="Reshape Variables:") self.RFunctionParamformula_listBox.setSelectionMode( QAbstractItemView.ExtendedSelection) self.RFunctionParamfun_aggregate_lineEdit = redRcomboBox( self.controlArea, label="Aggregating Function:", items=['NULL', 'mean', 'median', 'mode', 'range']) redRCommitButton(self.bottomAreaRight, "Commit", callback=self.commitFunction) self.RoutputWindow = redRtextEdit(self.controlArea, label="R Output Window")
def __init__(self, parent=None, signalManager=None, title=_("Generic Red-R Widget"), savePosition=True, wantGUIDialog=0, resizingEnabled=1, **args): """ Initialization Parameters: title - The title of the\ widget, including a "&" (for shortcut in about box) wantGraph - displays a save graph button or not """ # if resizingEnabled: QMainWindow.__init__(self, parent, Qt.Window) # else: #QMainWindow.__init__(self, parent, Qt.Dialog | Qt.MSWindowsFixedSizeDialogHint)# | Qt.WindowMinimizeButtonHint) # directories are better defined this way, otherwise .ini files get written in many places #self.__dict__.update(redREnviron.directoryNames) # self.setCaption(title.replace("&","")) # used for widget caption self.captionTitle = self._widgetInfo.widgetName self.progressBarHandler = None # handler for progress bar events self.processingHandler = None # handler for processing events self.widgetStateHandler = None self.widgetState = {"Info": {}, "Warning": {}, "Error": {}} self.windowState = {} self.savePosition = True self.hasBeenShown = False self.hasAdvancedOptions = wantGUIDialog self.setLayout(QVBoxLayout()) self.layout().setMargin(2) self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) topWidgetPart = redRwidgetBox(self, orientation="vertical", margin=0) topWidgetPart.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) self.setCentralWidget(topWidgetPart) self.controlArea = redRwidgetBox(topWidgetPart, orientation="vertical", margin=4) self.controlArea.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.controlArea.setMinimumWidth(300) # topWidgetPart.layout().setAlignment(self.controlArea,Qt.AlignTop | Qt.AlignLeft) bottomArea = redRwidgetBox(topWidgetPart, orientation="horizontal", margin=4) self.bottomAreaLeft = redRwidgetBox(bottomArea, orientation='horizontal') self.bottomAreaCenter = redRwidgetBox(bottomArea, sizePolicy=QSizePolicy( QSizePolicy.Expanding, QSizePolicy.Fixed), orientation='horizontal') self.bottomAreaRight = redRwidgetBox(bottomArea, orientation='horizontal') #start widget GUI ### status bar ### self.statusBar = QStatusBar() self.statusBar.setLayout(QHBoxLayout()) self.statusBar.setSizeGripEnabled(False) self.setStatusBar(self.statusBar) self.RIndicator = redRwidgetLabel(self.statusBar) self.statusBar.addWidget(self.RIndicator) self.setRIndicator(False) self.status = redRStatusLabel(self.statusBar, '') self.status.setStatus(0) self.status.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum) self.statusBar.addPermanentWidget(self.status, 4) #self.statusBar.setStyleSheet("QStatusBar { border-top: 2px solid gray; } ") # self.statusBar.setStyleSheet("QLabel { border-top: 2px solid red; } ") ################ # Notes Dock ### ################ minWidth = 200 self.notesDock = QDockWidget(_('Notes')) self.notesDock.setObjectName('widgetNotes') QObject.connect(self.notesDock, SIGNAL('topLevelChanged(bool)'), self.updateDock) self.notesDock.setFeatures(QDockWidget.DockWidgetMovable | QDockWidget.DockWidgetFloatable) self.notesDock.setMinimumWidth(minWidth) self.notesDock.setAllowedAreas(Qt.RightDockWidgetArea | Qt.TopDockWidgetArea | Qt.BottomDockWidgetArea) self.addDockWidget(Qt.RightDockWidgetArea, self.notesDock) self.notesBox = redRwidgetBox(None, orientation=QVBoxLayout()) self.notesDock.setWidget(self.notesBox) self.notesBox.setMinimumWidth(minWidth) self.notesBox.setMinimumHeight(50) self.notesBox.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) redRwidgetLabel(self.notesBox, label="Notes:", icon=redRStyle.notesIcon) self.notes = redRtextEdit(self.notesBox, label=_('Notes'), displayLabel=False) self.notes.setMinimumWidth(minWidth) self.notes.setMinimumHeight(50) self.notes.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) ################ # R output ### ################ self.RoutputDock = QDockWidget(_('R Output')) self.RoutputDock.setObjectName('RoutputDock') QObject.connect(self.RoutputDock, SIGNAL('topLevelChanged(bool)'), self.updateDock) self.RoutputDock.setFeatures(QDockWidget.DockWidgetMovable | QDockWidget.DockWidgetFloatable) self.RoutputDock.setMinimumWidth(minWidth) self.RoutputDock.setAllowedAreas(Qt.RightDockWidgetArea | Qt.TopDockWidgetArea | Qt.BottomDockWidgetArea) self.addDockWidget(Qt.RightDockWidgetArea, self.RoutputDock) self.ROutputBox = redRwidgetBox(None, orientation=QVBoxLayout()) self.RoutputDock.setWidget(self.ROutputBox) self.ROutputBox.setMinimumHeight(50) redRwidgetLabel(self.ROutputBox, label=_("R code executed in this widget:"), icon=redRStyle.RIcon) self.ROutput = redRtextEdit(self.ROutputBox, label=_('R Output'), displayLabel=False) self.ROutput.setMinimumWidth(minWidth) self.ROutput.setMinimumHeight(50) self.ROutput.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) redRbutton( self.ROutputBox, label=_('Run Selected Code'), callback=self._runSelectedRCode, toolTip= _('You may select any code to execute in the R session. This will override anything that other widgets have done to this point and will be overriden when this widget executes again. Use this with great caution.' )) ### help #### self.helpFile = None if hasattr(self, '_widgetInfo'): (file, ext) = os.path.basename(self._widgetInfo.fullName).split('.') path = os.path.join(redREnviron.directoryNames['libraryDir'], self._widgetInfo.package['Name'], 'help', file + '.html') if os.path.exists(path): self.helpFile = path if not self.helpFile: self.helpFile = 'http://www.red-r.org/documentation' ################ # Status Bar ### ################ self.windowState['documentationState'] = { 'notesBox': True, 'ROutputBox': False } docBox = redRwidgetBox(self.controlArea, orientation='horizontal', spacing=4) self.showNotesButton = redRbutton( docBox, '', toggleButton=True, icon=os.path.join(redREnviron.directoryNames['picsDir'], 'Notes-icon.png'), toolTip=_('Notes'), callback=self.updateDocumentationDock) self.showROutputButton = redRbutton( docBox, '', toggleButton=True, icon=os.path.join(redREnviron.directoryNames['picsDir'], 'R_icon.png'), toolTip=_('R Code'), callback=self.updateDocumentationDock) self.printButton = redRbutton( docBox, "", icon=os.path.join(redREnviron.directoryNames['picsDir'], 'printer_icon.png'), toolTip=_('Print'), callback=self.createReport) self.showHelpButton = redRbutton( docBox, '', icon=os.path.join(redREnviron.directoryNames['picsDir'], 'help_icon.png'), toolTip=_('Help'), callback=self.showHelp) self.includeInReport = redRbutton( docBox, '', icon=os.path.join(redREnviron.directoryNames['picsDir'], 'report_icon.png'), toolTip=_('Include In Report'), toggleButton=True) self.includeInReport.setChecked(True) ############################################### self.statusBar.addPermanentWidget(docBox) # self.statusBar.addPermanentWidget(self.showNotesButton) # self.statusBar.addPermanentWidget(self.showROutputButton) # self.statusBar.addPermanentWidget(self.showHelpButton) # self.statusBar.addPermanentWidget(self.printButton) # self.statusBar.addPermanentWidget(self.includeInReport) self.GUIDialogDialog = None self.windowState['leftDockState'] = False if self.hasAdvancedOptions: self.leftDock = QDockWidget(_('Advanced Options')) self.leftDock.setObjectName('leftDock') self.connect(self.leftDock, SIGNAL('topLevelChanged(bool)'), self.updateDock) self.leftDock.setFeatures(QDockWidget.DockWidgetMovable | QDockWidget.DockWidgetFloatable) self.leftDock.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) self.addDockWidget(Qt.LeftDockWidgetArea, self.leftDock) self.GUIDialog = redRwidgetBox(self.leftDock, orientation='vertical') self.GUIDialog.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) self.leftDock.setWidget(self.GUIDialog) self.leftDockButton = redRbutton(self.bottomAreaLeft, _('Advanced Options'), toggleButton=True, callback=self.showLeftDock) self.statusBar.insertPermanentWidget(2, self.leftDockButton) self.windowState['leftDockState'] = True
def __init__(self, widget): redRdialog.__init__(self, widget, title=_('Package Manager')) self.setMinimumWidth(650) self.packageManager = packageManager ## GUI ## #### set up a screen that will show a listbox of packages that are on the system that should be updated, self.tabsArea = redRtabWidget(self) self.updatesTab = self.tabsArea.createTabPage(name=_('Updates')) self.installedTab = self.tabsArea.createTabPage( name=_('Installed Packages')) self.availableTab = self.tabsArea.createTabPage( name=_('Available Packages')) #### layout of the tabsArea self.treeViewUpdates = redRtreeWidget( self.updatesTab, label=_('Update List'), displayLabel=False, callback=self.updateItemClicked ) ## holds the tree view of all of the packages that need updating self.treeViewUpdates.setHeaderLabels([ _('Package'), _('Author'), _('Summary'), _('Current Version'), _('Current Version Stability'), _('New Version'), _('New Version Stability') ]) #self.treeViewUpdates.setSelectionModel(QItemSelectModel.Rows) self.treeViewUpdates.setSelectionMode( QAbstractItemView.ExtendedSelection) self.infoViewUpdates = redRtextEdit( self.updatesTab, label=_('Update Info'), displayLabel=False) ## holds the info for a package redRbutton(self.updatesTab, _('Install Updates'), callback=self.installUpdates) self.treeViewInstalled = redRtreeWidget( self.installedTab, label=_('Update List'), displayLabel=False, callback=self.installItemClicked) self.treeViewInstalled.setHeaderLabels([ _('Package'), _('Author'), _('Summary'), _('Version'), _('Stability') ]) #self.treeViewInstalled.setSelectionModel(QItemSelectModel.Rows) self.treeViewInstalled.setSelectionMode( QAbstractItemView.ExtendedSelection) self.infoViewInstalled = redRtextEdit(self.installedTab, label=_('Install Info'), displayLabel=False) redRbutton(self.installedTab, _('Remove Packages'), callback=self.uninstallPackages) self.treeViewAvailable = redRtreeWidget( self.availableTab, label=_('Update List'), displayLabel=False, callback=self.availableItemClicked) self.treeViewAvailable.setHeaderLabels([ _('Package'), _('Author'), _('Summary'), _('Version'), _('Stability') ]) #self.treeViewAvailable.setSelectionModel(QItemSelectModel.Rows) self.treeViewAvailable.setSelectionMode( QAbstractItemView.ExtendedSelection) self.infoViewAvailable = redRtextEdit(self.availableTab, label=_('Avaliable Info'), displayLabel=False) redRbutton(self.availableTab, _('Install Packages'), callback=self.installNewPackage) #### buttons and the like buttonArea2 = redRwidgetBox(self, orientation='horizontal') redRbutton(buttonArea2, label=_('Update from Repository'), callback=self.loadPackagesLists) redRwidgetBox(buttonArea2, sizePolicy=QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed), orientation='horizontal') redRbutton(buttonArea2, label=_('Done'), callback=self.accept)