Main Window

@author: L. Calvo-Bartolome

class src.graphical_user_interface.main_window.MainWindow(project_folder, source_folder, tm, widget, stdout, stderr)

Bases: QMainWindow

Class representing the main window of the application.

__init__(project_folder, source_folder, tm, widget, stdout, stderr)

Initializes the application’s main window based on the parameters received from the application’s starting window.

Parameters
  • project_folder (pathlib.Path) – Path to the application project

  • source_folder (pathlib.Path) – Path to the folder containing the data sources

  • tm (TaskManager) – TaskManager object associated with the project

  • widget (QtWidgets.QStackedWidget) – Window to which the application’s main window is attached to

  • stdout (sys.stdout) – Output file object

  • stderr (sys.stderr) – Standard Error file object

append_text_evaluate(text)

Method to redirect the stdout and stderr in the “text_edit_results_eval_pu_classifier” while the evaluation of a PU model is being performed.

append_text_retrain_reval(text)

Method to redirect the stdout and stderr in the “text_edit_results_reval_retrain” while the retraining of a PU model is being performed.

append_text_train(text)

Method to redirect the stdout and stderr in the “text_logs_train_pu_model” while the training of a PU model is being performed.

center()

Centers the window at the middle of the screen at which the application is being executed.

clicked_change_predicted_class(checkbox)

Method to control the checking or unchecking of the QCheckboxes that represented the predicted class that the user has associated to each of the documents to annotate.

clicked_evaluate_PU_model()

Method that controls the actions that are carried out when the button “eval_pu_classifier_push_button” is clicked by the user.

clicked_get_labels()

Method for performing the getting of the labels according to the method selected for it.

clicked_get_labels_option()

Method to control the functionality associated with the selection of each of the QRadioButtons associated with the labels’ getting. Only one QRadioButton can be selected at a time.

clicked_give_feedback()

Method that controls the actions that are carried out when the button “give_feedback_push_button” is clicked by the user.

clicked_load_corpus()

Method to control the selection of a new corpus by double-clicking one of the items of the corpus list within the selected source folder, as well as its loading as dataframe into the TaskManager object. Important is that the corpus cannot be changed inside the same project, so if a corpus was used before me must keep the same one.

clicked_load_labels()

Method for controlling the loading of the labels into the session. It is equivalent to the “_get_labelset_list” method from the TaskManager class

clicked_reevaluate_model()

Method that controls the actions that are carried out when the button “retrain_model_push_button” is clicked by the user.

clicked_reset_labels()

Method for controlling the resetting of the current session’s labels.

clicked_retrain_model()

Method that controls the actions that are carried out when the button “retrain_model_push_button” is clicked by the user.

clicked_train_PU_model()

Method that controls the actions that are carried out when the button “train_pu_model_push_button” is clicked by the user.

clicked_update_ndocs_al()

Updates the AL parameter that is going to be used for the resampling of the documents to be labelled based on the value specified by the user and shows the id, title, abstract and predicted class (if available) of each of the documents in a QTextEdit widget.

configure_import_labels_buttons()

Makes visible only radio buttons that corresponds with the functions that are available for each of the corpus

do_after_evaluate_pu_model()

Method to be executed after the evaluation of the PU model has been completed.

do_after_give_feedback()

Method to be executed after annotating the labels given by the user in their corresponding positions

do_after_import_labels()

Function to be executed after the labels’ importing has been completed.

do_after_load_corpus()

Method to be executed after the loading of the corpus has been completed.

do_after_reevaluate_model()

Method to be executed once the reevaluation of the model based on the feedback of the user has been completed.

do_after_retrain_model()

Method to be executed once the retraining of the model based on the feedback of the user has been completed.

do_after_train_classifier()

Method to be executed after the training of the classifier has been completed.

execute_evaluate_pu_model()

Method to control the execution of the evaluation of a classifier on a secondary thread while the MainWindow execution is maintained in the main thread.

execute_give_feedback()

Method to control the annotation of a selected subset of documents based on the labels introduced by the user on a secondary thread while the MainWindow execution is maintained in the main thread.

execute_import_labels()

Imports the labels by invoking the corresponding method in the Task Manager object associated with the GUI.

execute_load_corpus()

Method to control the execution of the loading of a corpus on a secondary thread while the MainWindow execution is maintained in the main thread.

execute_reevaluate_model()

Method to control the execution of the reevaluation of a classifier on a secondary thread while the MainWindow execution is maintained in the main thread.

execute_retrain_model()

Method to control the execution of the retraining of a classifier on a secondary thread while the MainWindow execution is maintained in the main thread.

execute_train_classifier()

Method to control the execution of the training of a classifier on a secondary thread while the MainWindow execution is maintained in the main thread.

init_feedback_elements()

Method for showing the documents to be annotated in the FEEDBACK TAB. The number of documents that is shown depends on the value assigned to self.n_docs_al; the remaining widgets that exist for showing documents until Constants.MAX_N_DOCS are hided while they are not used. The widgets that represent the document are displayed as empty spaces until the conditions for the annotation of the documents are met, i.e. a corpus and a set of labels have been selected

init_ndocs_al()

Initializes the AL parameter in the text edit within the third tab of the main GUI window, i.e. n_docs. The default configuration of this parameter is read from the configuration file ‘/config/parameters.default.yaml’.

init_params_train_pu_model()

Initializes the classifier parameters in the parameters’ table within the second tab of the main GUI window, i.e. max_imbalance and nmax. The default configuration of these parameters is read from the configuration file ‘/config/parameters.default.yaml’.

init_ui()

Configures the elements of the GUI window that are not configured in the UI, i.e. icon of the application, the application’s title, and the position of the window at its opening.

reset_params_train_pu_model()

Resets the PU model training parameters to its default value based on the values that were read initially from the configuration file

show_corpora()

List all corpora contained in the source folder selected by the user.

show_labels()

Method for showing the labels associated with the selected corpus.

show_sampled_docs_for_labeling()

Visualizes the documents from which the user is going to give feedback for the updating of a model.

update_params_train_pu_model()

Updates the classifier parameters that are going to be used for the training of the PU model based on the values read from the table within the second tab of the main GUI window that have been specified by the user.