def join_cluster(self): eval_cluster_bool = self.evaluateClusteringCheckBox.isChecked() table_object = self.clusterInformationTable.selectedItems() clusters_to_join = [] if table_object: for i in range(0, len(table_object)): temp_table_object = table_object[i].text() if 'noise' in str(temp_table_object): helper.error_message(self.error_dialog, 'Can not join noise cluster') con = False break else: if 'red only' in str(temp_table_object): temp_table_object = self.data.red_only_cluster_idx clusters_to_join.append(temp_table_object) clusters_to_join[i] = int(clusters_to_join[i]) con = True if con: self.data.join_clusters_together(clusters_to_join, self.clusterOnData.currentIndex(), evaluate_cluster=eval_cluster_bool) self.giniCoeff.setText(str(self.data.gini)) self.shannonEntropy.setText(str(self.data.shannon)) view.update_cluster_table(self.clusterInformationTable, self.data.tab_cluster_data) self.update_plots() else: helper.error_message(self.error_dialog, 'No clusters selected')
def split_cluster(self): eval_cluster_bool = self.evaluateClusteringCheckBox.isChecked() cluster_to_split = self.clusterInformationTable.selectedItems() if cluster_to_split: if len(cluster_to_split) > 1: helper.error_message(self.error_dialog, 'Warning: This function can only split one cluster at ' 'a time and chose the first selected cluster') cluster_to_split = cluster_to_split[0].text() if 'noise' in str(cluster_to_split): helper.error_message(self.error_dialog, 'Can not split noise cluster') else: if 'red only' in str(cluster_to_split): cluster_to_split = self.data.red_only_cluster_idx cluster_to_split = int(cluster_to_split) self.data.split_cluster_in_two(cluster_to_split, self.clusterOnData.currentIndex(), evaluate_cluster=eval_cluster_bool) self.giniCoeff.setText(str(self.data.gini)) self.shannonEntropy.setText(str(self.data.shannon)) view.update_cluster_table(self.clusterInformationTable, self.data.tab_cluster_data) self.update_plots() else: helper.error_message(self.error_dialog, 'No cluster selected')
def evaluate_clusters(self): eval_cluster_bool = self.evaluateClusteringCheckBox.isChecked() if eval_cluster_bool: data = self.data.get_data_to_cluster_on(self.clusterOnData.currentIndex()) self.data.evaluate_cluster_solution(data) self.data.make_tabulated_cluster_data() view.update_cluster_table(self.clusterInformationTable, self.data.tab_cluster_data)
def cluster_data(self): # auto cluster the data eval_cluster_bool = self.evaluateClusteringCheckBox.isChecked() self.data.auto_cluster(self.clusterOnData.currentIndex(), int(self.clusterMinClusterSize.text()), int(self.clusterMinSamples.text()), evaluate_cluster=eval_cluster_bool) self.giniCoeff.setText(str(self.data.gini)) self.shannonEntropy.setText(str(self.data.shannon)) view.update_cluster_table(self.clusterInformationTable, self.data.tab_cluster_data) # self.data.decision_graph(self.clusterOnData.currentIndex()) self.update_plots()