pyplt.gui.experiment.preflearning package

Submodules

pyplt.gui.experiment.preflearning.backprop_menu module

class pyplt.gui.experiment.preflearning.backprop_menu.BackpropMenu(parent, on_resize_fn)

Bases: tkinter.Frame

GUI menu for specifying parameters of the Backpropagation algorithm.

Extends the class tkinter.Frame.

Initializes the frame widget and its contents.

Parameters:
  • parent (tkinter widget) – the parent widget of this frame widget.
  • on_resize_fn (function) – the function called when the parent window is resized by the user. This is required by this class so that the window is resized accordingly whenever the widgets for a hidden layer are added to or removed from the BackpropMenu.
get_params()

Get the values for the Backpropagation algorithm parameters as specified by the user via the GUI.

The parameter values are returned in the form of a dict where the keys match the keywords of the arguments that would be passed to the corresponding pyplt.plalgorithms.base.PLAlgorithm constructor.

Returns:a dict containing the values for the following parameters in order:
  • ann_topology: the topology of the neurons in the network
  • learn_rate: the learning rate
  • error_threshold: the error threshold
  • epochs: the number of epochs
  • activation_functions: the activation functions for each neuron layer in the network
Return type:dict (size 7)

pyplt.gui.experiment.preflearning.evaluator_menus module

class pyplt.gui.experiment.preflearning.evaluator_menus.HoldoutMenu(parent)

Bases: tkinter.Frame

GUI menu for specifying parameters of the Holdout evaluation method.

Extends the class tkinter.Frame.

Initializes the frame widget and its contents.

Parameters:parent (tkinter window) – the parent widget of this frame widget.
get_params()

Get the values for the Holdout method parameters as specified by the user via the GUI.

The parameter values are returned in the form of a dict where the keys match the keywords of the arguments that would be passed to the corresponding pyplt.util.enums.EvaluatorType constructor.

Returns:a dict containing the values for the following parameters in order:
  • test_proportion - the fractional proportion of data to be used as test data (the rest is to be used as training data) (default 0.3).
Return type:dict (size 1) of float
class pyplt.gui.experiment.preflearning.evaluator_menus.KFCVMenu(parent, parent_window, files_tab, on_resize_fn)

Bases: tkinter.Frame

GUI menu for specifying parameters of the KFoldCrossValidation evaluation method.

Extends the class tkinter.Frame.

Initializes the frame widget and its contents.

Parameters:
  • parent (tkinter widget) – the parent widget of this frame widget.
  • parent_window (tkinter.Toplevel) – the window which will contain this tab (frame) widget.
  • files_tab (pyplt.gui.experiment.dataset.loading.DataLoadingTab) – the Load Data tab.
  • on_resize_fn (function) – the function called when the parent window is resized by the user. This is required by this class so that the window is resized accordingly whenever widgets are added to or removed from the KFCVMenu procedurally.
get_params()

Get the values for the K-Fold Cross Validation method parameters as specified by the user via the GUI.

The parameter values are returned in the form of a dict where the keys match the keywords of the arguments that would be passed to the corresponding pyplt.util.enums.EvaluatorType constructor.

Returns:a dict containing the values for the following parameters in order:
  • k - the number of folds to uniformly split the data into when using the automatic approach (default 3).
  • test_folds - an array specifying the fold index for each sample in the dataset when using the manual approach (default None). The entry test_folds[i] specifies the index of the test set that sample i belongs to. It is also possible to exclude sample i from any test set (i.e., include sample i in every training set) by setting test_folds[i] to -1. If test_folds is None, the automatic approach is assumed and only the k parameter is to be considered. Otherwise, the manual approach is to be assumed and only the test_folds parameter is to be considered.
Return type:dict (size 2) containing: * k - int or None * test_folds - numpy.ndarray or None
Raises:MissingManualFoldsException – if the user chooses to specify folds manually for cross validation but fails to load the required file containing the fold IDs.

pyplt.gui.experiment.preflearning.pltab module

class pyplt.gui.experiment.preflearning.pltab.PLFrame(parent, parent_window, files_tab, preproc_tab, fs_tab)

Bases: tkinter.Frame

Frame widget that is visible whenever the Preference Learning tab is in the ‘unlocked’ state.

Extends the class tkinter.Frame.

Initializes the frame widget and its contents.

Parameters:
get_algorithm()

Get the preference learning algorithm type chosen by the user.

Returns:the preference learning algorithm chosen by the user.
Return type:pyplt.util.enums.PLAlgo
get_algorithm_params()

Get the parameters of the preference learning algorithm chosen by the user (if applicable).

Returns:the parameters of the preference learning algorithm chosen by the user (if applicable).
Return type:list
get_evaluator()

Get the evaluation method type chosen by the user.

Returns:the evaluation method type chosen by the user.
Return type:pyplt.util.enums.EvaluatorType
get_evaluator_params()

Get the parameters of the evaluation method chosen by the user (if applicable).

Returns:the parameters of the evaluation method chosen by the user (if applicable).
Return type:list
run_exp()

Trigger the execution of the experiment in a separate thread from the main (GUI) thread.

A pyplt.gui.experiment.progresswindow.ProgressWindow widget is also initialized to keep a progress log and progress bar of the experiment execution process.

Threading is carried out using the threading.Thread class.

class pyplt.gui.experiment.preflearning.pltab.PLTab(parent, parent_window, files_tab, preproc_tab, fs_tab)

Bases: pyplt.gui.util.tab_locking.LockableTab

GUI tab for the preference learning and evaluation stage of setting up an experiment.

Extends the class pyplt.gui.util.tab_locking.LockableTab which, in turn, extends the tkinter.Frame class.

Initializes the PLTab object.

Parameters:
get_evaluator()

Get the evaluation method type chosen by the user via the PLFrame.

Returns:the evaluation method type chosen by the user.
Return type:pyplt.util.enums.EvaluatorType
get_evaluator_params()

Get the parameters of the evaluation method chosen by the user (if applicable).

Returns:the parameters of the evaluation method chosen by the user (if applicable).
Return type:list
get_normal_frame()

Return a PLFrame widget for when the tab is in the ‘unlocked’ state.

The PLFrame widget is instantiated only once on the first occasion that the tab is ‘unlocked’.

Returns:the PLFrame widget that is visible whenever the tab is in the ‘unlocked’ state.
Return type:pyplt.gui.experiment.preflearning.pltab.PLFrame
get_pl_algorithm()

Get the preference learning algorithm type chosen by the user via the PLFrame.

Returns:the preference learning algorithm type chosen by the user.
Return type:pyplt.util.enums.PLAlgo
get_pl_algorithm_params()

Get the parameters of the preference learning algorithm chosen by the user (if applicable).

Returns:the parameters of the preference learning algorithm chosen by the user (if applicable).
Return type:list
run_experiment()

Call the method which triggers the execution of the experiment.

pyplt.gui.experiment.preflearning.ranknet_menu module

class pyplt.gui.experiment.preflearning.ranknet_menu.RankNetMenu(parent, on_resize_fn)

Bases: tkinter.Frame

GUI menu for specifying parameters of the RankNet algorithm.

Extends the class tkinter.Frame.

Initializes the frame widget and its contents.

Parameters:
  • parent (tkinter widget) – the parent widget of this frame widget.
  • on_resize_fn (function) – the function called when the parent window is resized by the user. This is required by this class so that the window is resized accordingly whenever the widgets for a hidden layer are added to or removed from the BackpropMenu.
get_params()

Get the values for the Backpropagation algorithm parameters as specified by the user via the GUI.

The parameter values are returned in the form of a dict where the keys match the keywords of the arguments that would be passed to the corresponding pyplt.plalgorithms.base.PLAlgorithm constructor.

Returns:a dict containing the values for the following parameters in order:
  • ann_topology: the topology of the neurons in the network
  • learn_rate: the learning rate
  • epochs: the number of epochs
  • hidden_activation_functions: the activation functions for each hidden layer in the network
  • batch_size: the number of samples per gradient update.
Return type:dict (size 7)

pyplt.gui.experiment.preflearning.ranksvm_menu module

class pyplt.gui.experiment.preflearning.ranksvm_menu.RankSVMMenu(parent)

Bases: tkinter.Frame

GUI menu for specifying parameters of the RankSVM algorithm.

Extends the class tkinter.Frame.

Initializes the frame widget and its contents.

Parameters:parent (tkinter widget) – the parent widget of this frame widget.
get_params()

Get the values for the RankSVM algorithm parameters as specified by the user via the GUI.

The parameter values are returned in the form of a dict where the keys match the keywords of the arguments that would be passed to the corresponding pyplt.plalgorithms.base.PLAlgorithm constructor.

Returns:a dict containing the values for the following parameters in order:
  • kernel: the kernel name
  • gamma: the gamma kernel parameter value
  • degree: the degree kernel parameter value
Return type:dict (size 3)

Module contents

This package contains GUI-based modules that manage the preference learning stage of setting up an experiment.