output package

Submodules

output.aggregate_csv module

aggregate_csv.py

Module encapsulating the functionality of merging runs that differ only in id.

output.aggregate_csv.aggregate_csv(files_to_join, output_path)

Joins multiple CSVs and produces the aggregate dataframe according to calculate_statistics(). It is assumed that each csv corresponds to a set of runs. Each CSV must have the same column structure.

Parameters
  • files_to_join (List[str]) – The list of files to join.

  • output_path (str) – path to the produced aggregate dataframe, including filename and ‘.csv’ extension.

Returns

None

output.aggregate_csv.calculate_statistics(df)
Obtains a dataframe which ‘merges’ runs that share the same configuration but different 'id'.

For each output variable (as in, one that uses the prefix experiment.prefixes.OUTPUT_PREFIX), a few summary statistics are calculated:

  • A string with the comma-separated values.

  • The mean of the attribute.

  • The standard deviation of the attribute.

  • The median of the attribute.

  • The minimum value of the attribute.

  • The maximum value of the attribute.

Parameters

df (pd.Dataframe) – The original dataframe

Returns

A dataframe with statistics about runs that share same configuration.

Return type

pd.Dataframe

output.aggregate_csv.debug(msg)
output.aggregate_csv.info(msg)

output.folders module

Created on 25 de mar de 2019

@author: klaus

output.folders.CSV_FOLDER = '/home/klaus/eclipse-workspace/NoisyGSSL/results/csvs'

Path to the general results folder.

output.folders.PLOT_FOLDER = '/home/klaus/eclipse-workspace/NoisyGSSL/results/python_plotly'

Path to the folder destined for plot output.

output.folders.RESULTS_FOLDER = '/home/klaus/eclipse-workspace/NoisyGSSL/results'

Path to the general results folder.

output.folders.get_top_dir()

output.plot_core module

plot_core.py

Module related to output and plotting procedures.

output.plot_core.authenticate_plotly()

Authenticates plotly for online usage, if possible (Executed when this module is loaded).

The username and api_key are expected to be respectively, the 1st and 2nd lines of the auth.txt file located on the same directory as this module.

output.plot_core.color_scale_continuous(Y, palette='coolwarm', num_palette=70)

Gets the color values for a continuous palette.

output.plot_core.color_scale_discrete(Y, palette='bright')

Gets the color values for a discrete palette.

output.plot_core.plotGraph(X, W, labeledIndexes, vertex_opt, plot_filepath=None, online=False, interactive=False, title='', plot_size=[1000, 1000], edge_width=0.5, labeled_only=False)

Plots a GSSL graph.

Creates a plot showing vertices connected by edges from the affinity matrix in 2D/3D. A number of different configurations is possible by the use of a vertexplotOpt object.

Parameters
  • X (NDArray[float].shape[N,D]) – A 2D or 3D matrix containing the vertex positions.

  • W (NDArray[float].shape[N,N]) – Optional. The affinity matrix defining the graph.

  • vertex_opt (vertexOptObject) – The size/color/group vertex configuration object.

  • title (string, default = '') – The title to be printed above the image.

  • online (bool, default = False) – whether to create an online plot

  • interactive (bool, default = False) – whether to open an interactive plot on the browser

  • plot_size (List[int].shape[2], default = [1000,1000]) – size of the canvas for the plotting operation.

  • edge_width (float, default = 0.5) – thickness of the edges.

Raises

ValueErrorif X.shape[1] not in [2, 3]

Returns

None

class output.plot_core.vertexplotOpt(Y, mode='discrete', palette=None, size=1.5, labeledIndexes=None, change_unlabeled_color=True, UNLABELED_SIZE_MULTIPLIER=0.2)

Bases: object

A class specifying properties of vertices when plotting graphs with labeled and unlabeled data.

DEFAULT_CONSTANT_COLOR = array([0, 0, 0])
DEFAULT_UNLABELED_COLOR = array([ 64, 81, 172])
__init__(Y, mode='discrete', palette=None, size=1.5, labeledIndexes=None, change_unlabeled_color=True, UNLABELED_SIZE_MULTIPLIER=0.2)

Initializes the vertex options.

Parameters
  • Y (NDArray[float].shape[N]) – array from which the color information is extracted.

  • mode (str) – either ‘discrete’,’continuous’ or ‘constant’.Determines the number of colors and the kind of plot to be created.

  • palette (str) – Optional. A string specifying a color pallete.

  • size (Union[float, NDArray[float].shape[N])) – Either a float specifying the size of all points, or an float array specifying the individual sizes. specifying the size of each point individually. Default is 1.5

  • labeledIndexes (NDArray[bool].shape[N]) – Optional. Indices to be marked as labeled. Unlabeled points are set to a default unlabeled color, and are given a smaller size.

output.plots module

Created on 28 de mar de 2019

@author: klaus

output.plots.plot_all_indexes(X, Y, labeledIndexes, W=None, plot_filepath=None, title='True classes', mode='discrete', palette=None)
output.plots.plot_labeled_indexes(X, Y, labeledIndexes, W=None, title='labeled indexes', plot_filepath=None, mode='discrete', palette=None)

Module contents