Exemple #1
0
    def UpdateContribution(self):
        if not self.checkContributionShow.isChecked():
            return

        if self.radioContributionFeatureSelector.isChecked():
            file_name = self.comboContributionFeatureSelector.currentText() + '_sort.csv'
            file_path = self._SearchSpecificFile(file_name, int(self._fae.GetFeatureNumberList()[0]))
            if file_path:
                df = pd.read_csv(file_path, index_col=0)

                feature_name = list(df.index)
                value = list(np.abs(df.iloc[:, 0]))

                GeneralFeatureSort(feature_name, value, max_num=self.spinFeatureSelectorFeatureNumber.value(),
                                   is_show=False, fig=self.canvasFeature.getFigure())
        elif self.radioContributionClassifier.isChecked():
            specific_name = self.comboContributionClassifier.currentText() + '_coef.csv'
            file_path = self._SearchSpecificFile(specific_name, self.spinClassifierFeatureNumber.value())
            if file_path:
                df = pd.read_csv(file_path, index_col=0)
                feature_name = list(df.index)
                value = list(np.abs(df.iloc[:, 0]))
                try:
                    SortRadiomicsFeature(feature_name, value, is_show=False, fig=self.canvasFeature.getFigure())
                except:
                    GeneralFeatureSort(feature_name, value,
                                       is_show=False, fig=self.canvasFeature.getFigure())


        self.canvasFeature.draw()
Exemple #2
0
    def UpdateContribution(self):
        if not self.checkContributionShow.isChecked():
            return

        if self.radioContributionFeatureSelector.isChecked():
            file_name = self.comboContributionFeatureSelector.currentText() + '_sort.csv'
            file_path = self._SearchSpecificFile(int(self._fae.GetFeatureNumberList()[0]), file_name)
            if file_path:
                df = pd.read_csv(file_path, index_col=0)

                feature_name = list(df.index)
                value = list(np.abs(df.iloc[:, 0]))

                #add positive and negatiove info for coef
                processed_feature_name = list(df.index)
                original_value = list(df.iloc[:, 0])
                for index in range(len(original_value)):
                    if original_value[index] > 0:
                        processed_feature_name[index] = processed_feature_name[index] + 'P'
                    else:
                        processed_feature_name[index] = processed_feature_name[index] + 'N'


                GeneralFeatureSort(processed_feature_name, value, max_num=self.spinFeatureSelectorFeatureNumber.value(),
                                   is_show=False, fig=self.canvasFeature.getFigure())
        elif self.radioContributionClassifier.isChecked():
            specific_name = self.comboContributionClassifier.currentText() + '_coef.csv'
            feature_selector_name = self.comboContributionFeatureSelector.currentText()
            file_path = self._SearchSpecificFile(self.spinClassifierFeatureNumber.value(), specific_name, feature_selector_name)
            if file_path:
                df = pd.read_csv(file_path, index_col=0)
                feature_name = list(df.index)
                value = list(np.abs(df.iloc[:, 0]))

                #add positive and negatiove info for coef
                processed_feature_name = list(df.index)
                original_value = list(df.iloc[:, 0])
                for index in range(len(original_value)):
                    if original_value[index] > 0:
                        processed_feature_name[index] = processed_feature_name[index] + ' P'
                    else:
                        processed_feature_name[index] = processed_feature_name[index] + ' N'

                try:
                    SortRadiomicsFeature(processed_feature_name, value, is_show=False, fig=self.canvasFeature.getFigure())
                except:
                    GeneralFeatureSort(processed_feature_name, value,
                                       is_show=False, fig=self.canvasFeature.getFigure())


        self.canvasFeature.draw()
    def UpdateContribution(self):
        if not self.checkContributionShow.isChecked():
            return

        one_result_folder_name = self.comboContributionNormalization.currentText() + '_' + \
                            self.comboContributionDimension.currentText() + '_' + \
                            self.comboContributionFeatureSelector.currentText() + '_' + \
                            str(self.spinContributeFeatureNumber.value()) + '_' + \
                            self.comboContributionClassifier.currentText()
        one_result_folder = os.path.join(self._root_folder,
                                         one_result_folder_name)
        # This is compatible witht the previous version
        if not os.path.exists(one_result_folder):
            one_result_folder_name = self.comboContributionNormalization.currentText() + '_Cos_' + \
                                     self.comboContributionFeatureSelector.currentText() + '_' + \
                                     str(self.spinContributeFeatureNumber.value()) + '_' + \
                                     self.comboContributionClassifier.currentText()
            one_result_folder = os.path.join(self._root_folder,
                                             one_result_folder_name)

        if self.radioContributionFeatureSelector.isChecked():
            file_name = self.comboContributionFeatureSelector.currentText(
            ) + '_sort.csv'
            file_path = os.path.join(one_result_folder, file_name)

            if not os.path.exists(file_path):
                file_name = self.comboContributionFeatureSelector.currentText(
                ).lower() + '_sort.csv'
                file_path = os.path.join(one_result_folder, file_name)

            if file_path:

                df = pd.read_csv(file_path, index_col=0)
                value = list(np.abs(df.iloc[:, 0]))

                #add positive and negatiove info for coef
                processed_feature_name = list(df.index)
                original_value = list(df.iloc[:, 0])
                for index in range(len(original_value)):
                    if original_value[index] > 0:
                        processed_feature_name[
                            index] = processed_feature_name[index] + ' P'
                    else:
                        processed_feature_name[
                            index] = processed_feature_name[index] + ' N'

                GeneralFeatureSort(
                    processed_feature_name,
                    value,
                    max_num=self.spinContributeFeatureNumber.value(),
                    is_show=False,
                    fig=self.canvasFeature.getFigure())

        elif self.radioContributionClassifier.isChecked():
            specific_name = self.comboContributionClassifier.currentText(
            ) + '_coef.csv'
            file_path = os.path.join(one_result_folder, specific_name)

            if not os.path.exists(file_path):
                specific_name = self.comboContributionClassifier.currentText(
                ).lower() + '_coef.csv'
                file_path = os.path.join(one_result_folder, specific_name)

            if file_path:
                df = pd.read_csv(file_path, index_col=0)
                feature_name = list(df.index)
                value = list(np.abs(df.iloc[:, 0]))

                #add positive and negatiove info for coef
                processed_feature_name = list(df.index)
                original_value = list(df.iloc[:, 0])
                for index in range(len(original_value)):
                    if original_value[index] > 0:
                        processed_feature_name[
                            index] = processed_feature_name[index] + ' P'
                    else:
                        processed_feature_name[
                            index] = processed_feature_name[index] + ' N'

                try:
                    SortRadiomicsFeature(processed_feature_name,
                                         value,
                                         is_show=False,
                                         fig=self.canvasFeature.getFigure())
                except:
                    GeneralFeatureSort(processed_feature_name,
                                       value,
                                       is_show=False,
                                       fig=self.canvasFeature.getFigure())

        self.canvasFeature.draw()