示例#1
0
    def UpdatePlot(self):
        if self.comboPlotX.count() == 0:
            return

        x_ticks = []
        x_label = ''
        selected_index = -1
        if self.comboPlotX.currentText() == 'Normaliaztion':
            selected_index = 0
            x_ticks = [
                instance.GetName()
                for instance in self._fae.GetNormalizerList()
            ]
            x_label = 'Normalization Method'
        elif self.comboPlotX.currentText() == 'Dimension Reduction':
            selected_index = 1
            x_ticks = [
                instance.GetName()
                for instance in self._fae.GetDimensionReductionList()
            ]
            x_label = 'Dimension Reduction Method'
        elif self.comboPlotX.currentText() == 'Feature Selector':
            selected_index = 2
            x_ticks = [
                instance.GetName()
                for instance in self._fae.GetFeatureSelectorList()
            ]
            x_label = 'Feature Selecotr Method'
        elif self.comboPlotX.currentText() == 'Classifier':
            selected_index = 4
            x_ticks = [
                instance.GetName()
                for instance in self._fae.GetClassifierList()
            ]
            x_label = 'Classifier Method'
        elif self.comboPlotX.currentText() == 'Feature Number':
            selected_index = 3
            x_ticks = list(map(int, self._fae.GetFeatureNumberList()))
            x_label = 'Feature Number'

        max_axis_list = [0, 1, 2, 3, 4]
        max_axis_list.remove(selected_index)
        max_axis = tuple(max_axis_list)

        index = self._UpdatePlotButtons(selected_index)

        show_data = []
        show_data_std = []
        name_list = []

        if self.comboPlotY.currentText() == 'AUC':
            if self.checkPlotCVTrain.isChecked():
                temp = deepcopy(self._fae.GetAUCMetric()['train'])
                auc_std = deepcopy(self._fae.GetAUCstdMetric()['train'])
                if self.checkPlotMaximum.isChecked():
                    show_data.append(np.max(temp, axis=max_axis).tolist())
                else:
                    show_data.append(temp[tuple(index)].tolist())
                    show_data_std.append(auc_std[tuple(index)].tolist())
                name_list.append('CV Train')
            if self.checkPlotCVValidation.isChecked():
                temp = deepcopy(self._fae.GetAUCMetric()['val'])
                auc_std = deepcopy(self._fae.GetAUCstdMetric()['val'])
                if self.checkPlotMaximum.isChecked():
                    show_data.append(np.max(temp, axis=max_axis).tolist())
                else:
                    show_data.append(temp[tuple(index)].tolist())
                    show_data_std.append(auc_std[tuple(index)].tolist())
                name_list.append('CV Validation')
            if self.checkPlotTrain.isChecked():
                temp = deepcopy(self._fae.GetAUCMetric()['all_train'])
                auc_std = deepcopy(self._fae.GetAUCstdMetric()['all_train'])
                if self.checkPlotMaximum.isChecked():
                    show_data.append(np.max(temp, axis=max_axis).tolist())
                else:
                    show_data.append(temp[tuple(index)].tolist())
                    show_data_std.append(auc_std[tuple(index)].tolist())
                name_list.append('Train')
            if self.checkPlotTest.isChecked():
                temp = deepcopy(self._fae.GetAUCMetric()['test'])
                auc_std = deepcopy(self._fae.GetAUCstdMetric()['test'])
                if temp.size > 0:
                    if self.checkPlotMaximum.isChecked():
                        show_data.append(np.max(temp, axis=max_axis).tolist())
                    else:
                        show_data.append(temp[tuple(index)].tolist())
                        show_data_std.append(auc_std[tuple(index)].tolist())
                    name_list.append('Test')

        if len(show_data) > 0:
            if selected_index == 3:
                DrawCurve(x_ticks,
                          show_data,
                          show_data_std,
                          xlabel=x_label,
                          ylabel=self.comboPlotY.currentText(),
                          name_list=name_list,
                          is_show=False,
                          fig=self.canvasPlot.getFigure())
            else:
                DrawBar(x_ticks,
                        show_data,
                        ylabel=self.comboPlotY.currentText(),
                        name_list=name_list,
                        is_show=False,
                        fig=self.canvasPlot.getFigure())

        self.canvasPlot.draw()
示例#2
0
    def UpdatePlot(self):
        if (not self.__is_ui_ready) or self.__is_clear:
            return

        if self.comboPlotX.count() == 0:
            return

        x_ticks = []
        x_label = ''
        selected_index = -1
        if self.comboPlotX.currentText() == 'Normaliaztion':
            selected_index = 0
            x_ticks = [
                instance.GetName() for instance in self._fae.normalizer_list
            ]
            x_label = 'Normalization Method'
        elif self.comboPlotX.currentText() == 'Dimension Reduction':
            selected_index = 1
            x_ticks = [
                instance.GetName()
                for instance in self._fae.dimension_reduction_list
            ]
            x_label = 'Dimension Reduction Method'
        elif self.comboPlotX.currentText() == 'Feature Selector':
            selected_index = 2
            x_ticks = [
                instance.GetName()
                for instance in self._fae.feature_selector_list
            ]
            x_label = 'Feature Selecotr Method'
        elif self.comboPlotX.currentText() == 'Classifier':
            selected_index = 4
            x_ticks = [
                instance.GetName() for instance in self._fae.classifier_list
            ]
            x_label = 'Classifier Method'
        elif self.comboPlotX.currentText() == 'Feature Number':
            selected_index = 3
            x_ticks = list(map(int, self._fae.feature_selector_num_list))
            x_label = 'Feature Number'

        max_axis_list = [0, 1, 2, 3, 4]
        max_axis_list.remove(selected_index)
        max_axis = tuple(max_axis_list)

        index = self._UpdatePlotButtons(selected_index)

        show_data = []
        show_data_std = []
        name_list = []

        if self.comboPlotY.currentText() == 'AUC':
            if self.checkPlotCVTrain.isChecked():
                temp = deepcopy(self._fae.GetAuc()[CV_TRAIN])
                auc_std = deepcopy(self._fae.GetAucStd()[CV_TRAIN])
                show_data.append(temp[tuple(index)].tolist())
                show_data_std.append(auc_std[tuple(index)].tolist())
                name_list.append(CV_TRAIN)
            if self.checkPlotCVValidation.isChecked():
                temp = deepcopy(self._fae.GetAuc()[CV_VAL])
                auc_std = deepcopy(self._fae.GetAucStd()[CV_VAL])
                show_data.append(temp[tuple(index)].tolist())
                show_data_std.append(auc_std[tuple(index)].tolist())
                name_list.append(CV_VAL)
            if self.checkPlotTrain.isChecked():
                temp = deepcopy(self._fae.GetAuc()[TRAIN])
                auc_std = deepcopy(self._fae.GetAucStd()[TRAIN])
                show_data.append(temp[tuple(index)].tolist())
                show_data_std.append(auc_std[tuple(index)].tolist())
                name_list.append(TRAIN)
            if self.checkPlotTest.isChecked():
                temp = deepcopy(self._fae.GetAuc()[TEST])
                auc_std = deepcopy(self._fae.GetAucStd()[TEST])
                if temp.size > 0:
                    show_data.append(temp[tuple(index)].tolist())
                    show_data_std.append(auc_std[tuple(index)].tolist())
                    name_list.append(TEST)

        if len(show_data) > 0:
            if selected_index == 3:
                DrawCurve(x_ticks,
                          show_data,
                          show_data_std,
                          xlabel=x_label,
                          ylabel=self.comboPlotY.currentText(),
                          name_list=name_list,
                          is_show=False,
                          one_se=self.checkPlotOneSE.isChecked(),
                          fig=self.canvasPlot.getFigure())
            else:
                DrawBar(x_ticks,
                        show_data,
                        ylabel=self.comboPlotY.currentText(),
                        name_list=name_list,
                        is_show=False,
                        fig=self.canvasPlot.getFigure())

        self.canvasPlot.draw()