rtac.ac_functionalities.logs

This module contains functions for logging the data between instances/tournaments as well as stats about toournaments and results.

Classes

AbstractLogs(scenario)

Class with all functions and loggers concerning logging and loading RTAC and tournament data.

NewRotatingFileHandler(filename[, mode, ...])

Overwriting logging.handlers.RotatingFileHandler in order to log to the same line in the file.

RTACLogs(scenario)

Class with all functions and loggers concerning logging and loading RTAC and tournament data for ReACTR implementation.

class rtac.ac_functionalities.logs.AbstractLogs(scenario: Namespace)[source]

Bases: ABC

Class with all functions and loggers concerning logging and loading RTAC and tournament data.

Parameters:

scenario (argparse.Namespace) – Namespace containing all settings for the RTAC.

general_log(message: str) None[source]

Log message.

Parameters:

message (str) – Any message provided as a string.

Return type:

None

init_rtac_logs() None[source]

Initializes loggers for realtime algorithm configuration data that are shared by all methods.

Return type:

None

abstract load_data() Any[source]

Loads the data of either last logged, or first tournament.

rtac_log(rtac_data: RTACData | RTACDatapp, tourn_stats: TournamentStats) None[source]

Logs for realtime algorithm configuration data concerning all methods.

Parameters:
  • rtac_data (RTACData | RTACDatapp) – Object containing data and objects necessary throughout the rtac modules.

  • tourn_stats (TournamentStats) – Object containing statistics about the previous tournament.

Return type:

None

scenario_log(scenario: Namespace) None[source]

Save RTAC scenario.

Parameters:

scenario (argparse.Namespace) – Namespace containing all settings for the RTAC.

Return type:

None

class rtac.ac_functionalities.logs.NewRotatingFileHandler(filename, mode='w', maxBytes=0, backupCount=0)[source]

Bases: RotatingFileHandler

Overwriting logging.handlers.RotatingFileHandler in order to log to the same line in the file.

class rtac.ac_functionalities.logs.RTACLogs(scenario: Namespace)[source]

Bases: AbstractLogs

Class with all functions and loggers concerning logging and loading RTAC and tournament data for ReACTR implementation.

init_ranking_logs() None[source]

Initializes loggers for data concerning ReACTR.

Return type:

None

load_data(tourn_nr: int | None = None) tuple[dict[str, rtac.ac_functionalities.rtac_data.Configuration], dict[str, Any], dict[str, rtac.ac_functionalities.rtac_data.Configuration], int, Optional[Any]][source]

Loads data necessary for resuming the algorithm configuration from last logged state of ReACTR.

Parameters:

tourn_nr (int | None) – Either int to load logs of tournament nr. tourn_nr or None if loading tournament nr. 0 for experimental mode.

Returns:

  • pool : dict[str, Configuration], Configuration pool.

  • assessment : dict[str, Any], Scores/ Skills, confidences of logged tournament.

  • contender_dict : dict[str, Configuration], List of contending Configurations from logged tournament.

  • tourn_nr : int, Number of logged tournament.

  • bandit_models : dict[str, Any], All objects needed for CPPL model employment.

Return type:

tuple

parse_array(val: str) int | float[source]

Helper function for loading logs of nd.arrays.

Parameters:

val (str) – Loaded string to decode and transform.

Returns:

Decoded and transformed form of val.

Return type:

int or float

Raises:

ValueError – If val could not be parsed.

ranking_log(pool: dict[str, rtac.ac_functionalities.rtac_data.Configuration], assessment: dict[str, Any], tourn_nr: int, contender_dict: dict[str, rtac.ac_functionalities.rtac_data.Configuration], **kwargs) None[source]

Logs data concerning RAC method.

Parameters:
  • pool (dict[str, Configuration]) – Dictionary with configuration id as key and configuration as value with scenario.contenders == #items.

  • assessment (dict[str, Any]) – Dictionary with configuration id as key and assessment depending on the AC method used, e.g., trueskill scores, or bandit model.

  • tourn (nr : int) – Number of tournament after which logs are done.

  • contender_dict (dict[str, Configuration]) – Dictionary with configuration id as key and configuration as value: contenders of the previous tournament.

  • **kwargs

    Additional keyword arguments. Possible keys include:

    • standard_scaler sklearn.preprocessing.StandardScaler

    • min_max_scaler sklearn.preprocessing.MinMaxScaler

    • pca_obj_params sklearn.decomposition.PCA

Return type:

None