carate.statistics package
Submodules
carate.statistics.analysis module
Module to perform analysis of runs.
- author:
Julian M. Kleber
- carate.statistics.analysis.get_avg(step_list: List[float]) float[source]
The get_avg function takes a list of floats and returns the average value.
- Parameters:
step_list:List[float] – Used to Tell the function that it will be taking a list of
floats as an argument. :return: The mean of the step_list.
- Doc-author:
Julian M. Kleber
- carate.statistics.analysis.get_max(step_list: List[float]) float[source]
The get_max function takes a list of floats and returns the maximum value in that list.
- Parameters:
step_list:List[float] – Used to Tell the function that step_list is a list of floats.
- Returns:
The maximum value in the list.
- Doc-author:
Julian M. Kleber
- carate.statistics.analysis.get_max_average(result_list: List[float], key_val: str) List[float][source]
The get_max_average function takes a list of floats and returns the average of the max values in that list.
- Parameters:
step_list:List[float] – Used to Determine the step size for each run.
key_val:str – Used to Specify the key value of the dictionary that is being unpacked.
- Return list:
[avg, std]The best average reward for each run.
- Doc-author:
Julian M. Kleber
- carate.statistics.analysis.get_min(step_list: List[float]) float[source]
The get_min function takes a list of floats and returns the minimum value in that list.
- Parameters:
step_list:List[float] – Used to Specify the type of parameter that is being passed
into the function. :return: The minimum value in the step_list.
- Doc-author:
Julian M. Kleber
- carate.statistics.analysis.get_min_average(result_list: List[float], key_val: str) List[float][source]
The get_min_average function takes a list of floats and returns the average of the minimal values in that list.
Returns: List[float]: A list containing only the best averages for each run in step_list.
- Parameters:
step_list:List[float] – Used to Determine the step size for each run.
key_val:str – Used to Specify the key value of the dictionary that is being unpacked.
- Return list:
[avg, std]The best average reward for each run.
- Doc-author:
Julian M. Kleber
- carate.statistics.analysis.get_min_max_avg_cv_run(result: List[Dict[str, List[float]]], key_val: str) Tuple[List[float]][source]
The get_min_max_avg_cv_run function takes in a list of dictionaries, and a key value. It then unpacks the values associated with that key into three lists: max_val, min_val, avg_val. These lists are returned as a tuple.
- Parameters:
result:List[Dict[str – Used to Store the result of each iteration.
float]] – Used to Store the results of the cross validation.
key_val:str – Used to Specify which key in the dictionary to use for the unpacking.
- Returns:
The max, min and average value of the key_val parameter.
- Doc-author:
Julian M. Kleber
- carate.statistics.analysis.get_stacked_list(path_to_directory: str, num_cv: int, json_name: str) List[Dict[str, float]][source]
The get_stacked_list function takes in a path to a directory, the name of the column that we want to stack, and the number of cross-validation folds. It then returns a list of dictionaries that contain all of our stacked results.
- Parameters:
path_to_directory:str – Used to Specify the directory where the json files are stored.
column_name:str – Used to Specify the column name of the dataframe in which we
want to get. :param num_cv:int: Used to Specify the number of cross validation runs. :param json_name:str: Used to Specify the name of the json file that will be parsed. :return: A list of dictionaries, where each dictionary is the accuracy for a single cv.
- Doc-author:
Julian M. Kleber
- carate.statistics.analysis.load_result_json(path_to_json: str) Dict[str, Any][source]
The load_result_json function takes in a path to a json file and returns the contents of that json file as a dictionary.The function also parses the “Acc” key in the dictionary, which contains lists of tuples containing train and test accuracy values. The function then separates these tuples into two separate lists, one for train accuracy values and one for test accuracy values. These new lists are added to the original dictionary under keys “Acc_train” and “Acc_val”, respectively.
- Parameters:
path_to_json:str – Used to Specify the path to the json file.
- Returns:
A dictionary with the following keys:.
- Doc-author:
Julian M. Kleber
- carate.statistics.analysis.unpack_run(result_list: List[Dict[str, float]], key_val: str) List[List[float]][source]
The unpack_run function takes a list of dictionaries and returns a list of lists. The input is the output from the run_experiment function, which is a list of dictionaries. Each dictionary contains two keys: ‘params’ and ‘val’. The value associated with the key ‘params’ is another dictionary containing all parameters used in that particular experiment. The value associated with the key ‘val’ is an array containing all values returned by each call to f(x).
- Parameters:
result_list:List[Dict[str – Used to Specify the type of the input parameter.
float]] – Used to Specify the type of data that is expected to be returned by the function.
- Returns:
A list of lists, where each sublist is the result of a run.
- Doc-author:
Trelent