Changeset 10995:c18f18cf5624 in orange


Ignore:
Timestamp:
10/08/12 19:24:42 (19 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Children:
10996:a7d40db57958, 11107:250e530a6fd3
Message:

Fixed inverted distribution bars in Optimization Report box.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/OrangeWidgets/Unsupervised/OWKMeans.py

    r10994 r10995  
    206206        # display of clustering results 
    207207        self.optimizationReportBox = OWGUI.widgetBox(self.mainArea) 
    208         tableBox = OWGUI.widgetBox(self.optimizationReportBox, 
    209                                    "Optimization Report") 
    210         self.table = OWGUI.table(tableBox, 
     208        self.tableBox = OWGUI.widgetBox(self.optimizationReportBox, 
     209                                        "Optimization Report") 
     210        self.table = OWGUI.table(self.tableBox, 
    211211                                 selectionMode=QTableWidget.SingleSelection) 
    212212 
     
    399399    def showResults(self): 
    400400        self.table.setRowCount(len(self.optimizationRun)) 
     401        scoring = self.scoringMethods[self.scoring][1] 
     402        minimize = getattr(scoring, "minimize", False) 
     403 
    401404        bestScore = self.bestRun[1].score 
    402405        worstScore = self.optimizationRunSorted[0][1].score 
     406 
     407        if minimize: 
     408            bestScore, worstScore = worstScore, bestScore 
     409 
    403410        scoreSpan = (bestScore - worstScore) or 1 
    404411 
     
    415422            fmt = self.scoreFmt(run.score) 
    416423            item = OWGUI.tableItem(self.table, i, 2, fmt % run.score) 
    417             barRatio = 0.95 * (bestScore - run.score) / scoreSpan 
     424            barRatio = 0.95 * (run.score - worstScore) / scoreSpan 
    418425 
    419426            item.setData(OWGUI.TableBarItem.BarRole, QVariant(barRatio)) 
     
    425432 
    426433        self.table.show() 
     434 
     435        if minimize: 
     436            self.tableBox.setTitle("Optimization Report (smaller is better)") 
     437        else: 
     438            self.tableBox.setTitle("Optimization Report (bigger is better)") 
    427439 
    428440        QTimer.singleShot(0, self.adjustSize) 
Note: See TracChangeset for help on using the changeset viewer.