Calculations

class lib.gui.analysis.stats.Calculations(session_id, display: str = 'loss', loss_keys: list[str] | str = 'loss', selections: list[str] | str = 'raw', avg_samples: int = 500, smooth_amount: float = 0.9, flatten_outliers: bool = False)

Bases: object

Class that performs calculations on the GlobalSession raw data for the given session id.

Parameters:
  • session_id (int or None) – The session id number for the selected session from the Analysis tab. Should be None if all sessions are being calculated

  • display ({"loss", "rate"}, optional) – Whether to display a graph for loss or training rate. Default: “loss”

  • loss_keys (list, optional) – The list of loss keys to display on the graph. Default: [“loss”]

  • selections (list, optional) – The selected annotations to display. Default: [“raw”]

  • avg_samples (int, optional) – The number of samples to use for performing moving average calculation. Default: 500.

  • smooth_amount (float, optional) – The amount of smoothing to apply for performing smoothing calculation. Default: 0.9.

  • flatten_outliers (bool, optional) – True if values significantly away from the average should be excluded, otherwise False. Default: False

Attributes Summary

iterations

The number of iterations in the data set.

start_iteration

The starting iteration number of a limit has been set on the amount of data.

stats

The final calculated statistics

Methods Summary

refresh()

Refresh the stats

set_iterations_limit(limit)

Set the number of iterations to display in the calculations.

set_smooth_amount(amount)

Set the amount of smoothing to apply to smoothed graph.

update_selections(selection, option)

Update the type of selected data.

Attributes Documentation

iterations

The number of iterations in the data set.

Type:

int

start_iteration

The starting iteration number of a limit has been set on the amount of data.

Type:

int

stats

The final calculated statistics

Type:

dict

Methods Documentation

refresh() Calculations | None

Refresh the stats

Return type:

Calculations | None

set_iterations_limit(limit: int) None

Set the number of iterations to display in the calculations.

If a value greater than 0 is passed, then the latest iterations up to the given limit will be calculated.

Parameters:

limit (int) – The number of iterations to calculate data for. 0 to calculate for all data

Return type:

None

set_smooth_amount(amount: float) None

Set the amount of smoothing to apply to smoothed graph.

Parameters:

amount (float) – The amount of smoothing to apply to smoothed graph

Return type:

None

update_selections(selection: str, option: bool) None

Update the type of selected data.

Parameters:
  • selection (str) – The selection to update (as can exist in _selections)

  • option (bool) – True if the selection should be included, False if it should be removed

Return type:

None

property iterations: int

The number of iterations in the data set.

Type:

int

refresh() Calculations | None

Refresh the stats

Return type:

Calculations | None

set_iterations_limit(limit: int) None

Set the number of iterations to display in the calculations.

If a value greater than 0 is passed, then the latest iterations up to the given limit will be calculated.

Parameters:

limit (int) – The number of iterations to calculate data for. 0 to calculate for all data

Return type:

None

set_smooth_amount(amount: float) None

Set the amount of smoothing to apply to smoothed graph.

Parameters:

amount (float) – The amount of smoothing to apply to smoothed graph

Return type:

None

property start_iteration: int

The starting iteration number of a limit has been set on the amount of data.

Type:

int

property stats: dict[str, ndarray]

The final calculated statistics

Type:

dict

update_selections(selection: str, option: bool) None

Update the type of selected data.

Parameters:
  • selection (str) – The selection to update (as can exist in _selections)

  • option (bool) – True if the selection should be included, False if it should be removed

Return type:

None