Arcana Utils

Submodules

arcana.utils.utils module

Helper functions for the arcana package.

arcana.utils.utils.align_and_truncate_samples(all_predictions, all_target_data_list)

Align and truncate the samples in the array of predictions and list of targets.

Parameters:
  • all_predictions (np.ndarray) – Array of predictions

  • all_target_data_list (list) – List of targets

Returns:
  • truncated_all_predictions (np.ndarray) – Truncated array of predictions

  • truncated_all_targets (np.ndarray) – Truncated array of targets

arcana.utils.utils.create_dir(directory)

Checks if a directory is present, if not creates one at the given location :param directory: Location where the directory should be created :type directory: str

Returns:

str – Location of the directory

arcana.utils.utils.handle_tensor(obj)

Handle the tensor objects

Parameters:

obj (torch.Tensor) – tensor object

arcana.utils.utils.pad_array_to_length(arr, target_length)

Pads an array with NaN values up to the target length.

arcana.utils.utils.prepare_folder_structure(test_id)

Prepare the folder structure for the results

Parameters:

test_id (str) – ID of the test

arcana.utils.utils.prepare_optuna_folder_structure(trial_path)

Prepare the folder structure for the results

Parameters:

test_id (str) – ID of the test

arcana.utils.utils.save_optuna_fig(save_path, plot_type)

Save the figure

Parameters:
  • save_path (str) – path to the directory

  • plot_type (str) – type of the plot

arcana.utils.utils.save_plots(path, name: str | None = None)

Save plots to a directory

Parameters:
  • path (str) – path to the directory

  • name (str, optional) – name of the plot. Defaults to None.

arcana.utils.utils.save_test_data(model, model_folder, test_data, test_lengths)

Save the test data and the test lengths

Parameters:
  • model (torch.nn.Module) – the model

  • model_folder (str) – the path to the model folder

  • test_data (torch.Tensor) – the test data

  • test_lengths (torch.Tensor) – the test lengths

arcana.utils.utils.standardize_dataset(data: DataFrame) DataFrame

Standardize data

Parameters:

data (pd.DataFrame) – dataframe with the data

Returns:
  • scaled_data (pd.DataFrame) – dataframe with the scaled data

  • scaler (sklearn.preprocessing.MinMaxScaler) – scaler used to scale the data

Module contents