plot_functions.plot_matrix#

plot_functions.plot_matrix(Matrix: ndarray, C: ndarray, PLOT_TYPE: str, USE_COLOURS: bool, ALGORITHM_PARAMETERS: dict[str, Any]) None#

Plots all adjustable elements of a matrix at each iteration.

Either the “theta” matrices (the matrices in the unconstrained space), the “transition” matrices (the transition matrices in the stochastic matrix space) or the “gradient” matrices (the estimated gradient) can be plotted.

Parameters:
  • Matrix (np.ndarray) – The matrix that is plotted.

  • C (np.ndarray) – The binary adjustment matrix.

  • PLOT_TYPE (str) – Either “theta”, “transition” or “gradient”, depending on the type of matrix that is plotted.

  • USE_COLOURS (bool) – Whether specific colours that make it easier to recognize the nodes should be used (True) or not (False). Only possible if networks are used of at most size 5x5.

  • ALGORITHM_PARAMETERS (dict[str, Any]) – The algorithm parameters. The parameters SAVE_OUTPUT, INSTANCE_OUTPUT_DIRECTORY and CURRENT_INSTANCE_NAME are at least necessary. See main.py for parameter explanations. Note that INSTANCE_OUTPUT_DIRECTORY and CURRENT_INSTANCE_NAME are set in the methods of run_algorithm.py.

Raises:

Exception – If an invalid PLOT_TYPE is provided (not “theta”, “transition” or “gradient”).