GlobalSession

class lib.gui.analysis.stats.GlobalSession

Bases: object

Holds information about a loaded or current training session by accessing a model’s state file and Tensorboard logs. This class should not be accessed directly, rather through lib.gui.analysis.Session

Attributes Summary

batch_sizes

The batch sizes for each session_id for the model.

full_summary

List of dictionaries containing summary statistics for each session id.

have_session_data

True if session data is available otherwise False

is_loaded

True if session data is loaded otherwise False

is_training

True if the loaded session is the currently training model, otherwise False

logging_disabled

True if logging is disabled for the currently training session otherwise False.

model_filename

The full model filename

session_ids

The sorted list of all existing session ids in the state file

Methods Summary

clear()

Clear the currently loaded session.

get_loss(session_id)

Obtain the loss values for the given session_id.

get_loss_keys(session_id)

Obtain the loss keys for the given session_id.

get_timestamps(-> dict[int, ~numpy.ndarray])

Obtain the time stamps keys for the given session_id.

initialize_session(model_folder, model_name)

Initialize a Session.

stop_training()

Clears the internal training flag.

Attributes Documentation

batch_sizes

The batch sizes for each session_id for the model.

Type:

dict

full_summary

List of dictionaries containing summary statistics for each session id.

Type:

list

have_session_data

True if session data is available otherwise False

Type:

bool

is_loaded

True if session data is loaded otherwise False

Type:

bool

is_training

True if the loaded session is the currently training model, otherwise False

Type:

bool

logging_disabled

True if logging is disabled for the currently training session otherwise False.

Type:

bool

model_filename

The full model filename

Type:

str

session_ids

The sorted list of all existing session ids in the state file

Type:

list

Methods Documentation

clear() None

Clear the currently loaded session.

Return type:

None

get_loss(session_id: int | None) dict[str, ndarray]

Obtain the loss values for the given session_id.

Parameters:

session_id (int or None) – The session ID to return loss for. Pass None to return loss for all sessions.

Returns:

Loss names as key, numpy.ndarray as value. If No session ID was provided all session’s losses are collated

Return type:

dict

get_loss_keys(session_id: int | None) list[str]

Obtain the loss keys for the given session_id.

Parameters:

session_id (int or None) – The session ID to return the loss keys for. Pass None to return loss keys for all sessions.

Returns:

The loss keys for the given session. If None is passed as session_id then a unique list of all loss keys for all sessions is returned

Return type:

list

get_timestamps(session_id: None) dict[int, ndarray]
get_timestamps(session_id: int) ndarray

Obtain the time stamps keys for the given session_id.

Parameters:

session_id (int or None) – The session ID to return the time stamps for. Pass None to return time stamps for all sessions.

Returns:

If a session ID has been given then a single numpy.ndarray will be returned with the session’s time stamps. Otherwise a ‘dict’ will be returned with the session IDs as key with numpy.ndarray of timestamps as values

Return type:

dict[int] or numpy.ndarray

initialize_session(model_folder: str, model_name: str, is_training: bool = False) None

Initialize a Session.

Load’s the model’s state file, and sets the paths to any underlying Tensorboard logs, ready for access on request.

Parameters:
  • model_folder (str,) – If loading a session manually (e.g. for the analysis tab), then the path to the model folder must be provided. For training sessions, this should be passed through from the launcher

  • model_name (str, optional) – If loading a session manually (e.g. for the analysis tab), then the model filename must be provided. For training sessions, this should be passed through from the launcher

  • is_training (bool, optional) – True if the session is being initialized for a training session, otherwise False. Default: False

Return type:

None

stop_training() None

Clears the internal training flag. To be called when training completes.

Return type:

None

property batch_sizes: dict[int, int]

The batch sizes for each session_id for the model.

Type:

dict

clear() None

Clear the currently loaded session.

Return type:

None

property full_summary: list[dict]

List of dictionaries containing summary statistics for each session id.

Type:

list

get_loss(session_id: int | None) dict[str, ndarray]

Obtain the loss values for the given session_id.

Parameters:

session_id (int or None) – The session ID to return loss for. Pass None to return loss for all sessions.

Returns:

Loss names as key, numpy.ndarray as value. If No session ID was provided all session’s losses are collated

Return type:

dict

get_loss_keys(session_id: int | None) list[str]

Obtain the loss keys for the given session_id.

Parameters:

session_id (int or None) – The session ID to return the loss keys for. Pass None to return loss keys for all sessions.

Returns:

The loss keys for the given session. If None is passed as session_id then a unique list of all loss keys for all sessions is returned

Return type:

list

get_timestamps(session_id: None) dict[int, ndarray]
get_timestamps(session_id: int) ndarray

Obtain the time stamps keys for the given session_id.

Parameters:

session_id (int or None) – The session ID to return the time stamps for. Pass None to return time stamps for all sessions.

Returns:

If a session ID has been given then a single numpy.ndarray will be returned with the session’s time stamps. Otherwise a ‘dict’ will be returned with the session IDs as key with numpy.ndarray of timestamps as values

Return type:

dict[int] or numpy.ndarray

property have_session_data: bool

True if session data is available otherwise False

Type:

bool

initialize_session(model_folder: str, model_name: str, is_training: bool = False) None

Initialize a Session.

Load’s the model’s state file, and sets the paths to any underlying Tensorboard logs, ready for access on request.

Parameters:
  • model_folder (str,) – If loading a session manually (e.g. for the analysis tab), then the path to the model folder must be provided. For training sessions, this should be passed through from the launcher

  • model_name (str, optional) – If loading a session manually (e.g. for the analysis tab), then the model filename must be provided. For training sessions, this should be passed through from the launcher

  • is_training (bool, optional) – True if the session is being initialized for a training session, otherwise False. Default: False

Return type:

None

property is_loaded: bool

True if session data is loaded otherwise False

Type:

bool

property is_training: bool

True if the loaded session is the currently training model, otherwise False

Type:

bool

property logging_disabled: bool

True if logging is disabled for the currently training session otherwise False.

Type:

bool

property model_filename: str

The full model filename

Type:

str

property session_ids: list[int]

The sorted list of all existing session ids in the state file

Type:

list

stop_training() None

Clears the internal training flag. To be called when training completes.

Return type:

None