DeepMTP.utils package

Submodules

DeepMTP.utils.data_utils module

Compatibility façade for the historical data utility module.

New code should import from the focused data-loading, preparation, splitting, feature, and interaction modules.

DeepMTP.utils.eval_utils module

class DeepMTP.utils.eval_utils.InverseTransformer(*args, **kwargs)

Bases: Protocol

Minimal scaler interface needed by the evaluation utilities.

inverse_transform(values: Any) → Any

Return values transformed back to their original scale.

DeepMTP.utils.eval_utils.base_evaluator(rows: DataFrame, problem_mode: str, metrics: Sequence[str], idx: Any, train_true_value: Mapping[Any, float] | None = None, verbose: bool = False, threshold: float = 0.5, progress: EvaluationProgressObserver | None = None) → dict[str, float]

The function that actually calculates the different metrics

Parameters:
  • true_values_arr (numpy.array) – An array with the true values.

  • pred_values_arr (numpy.array) – An array with the predicted values.

  • problem_mode (str) – The type of task of the given problem. Possible values are classification and regression.

  • metrics (list) – The performance metrics that will be calculated.

  • idx (int) – The id of the instance of target.

  • train_true_value (numpy.array, optional) – The true values per target. This is used when calculating the RRMSE score. Defaults to None.

  • threshold (float) – The threshold used to binarize the predictions

Returns:

a dictionary with the results per metric

Return type:

dict

DeepMTP.utils.eval_utils.get_epilepsy_specific_metrics(y_true: Sequence[int], y_pred: Sequence[int], metrics: Sequence[str] | None = None) → dict[str, float]

Function that calculates specific metrics used in Epilepsy prediction tasks

Parameters:
  • y_true (numpy.array) – An array with the true values.

  • y_pred (_type_) – An array with the predicted values.

  • metrics (list, optional) – A list with metric names that have to be calculated. Defaults to [ ‘sensitivity’, ‘false_alarm_rate_per_hour’, ‘positive_predictive_value’, ‘f1_score_epilepsy_version’, ].

Returns:

a dictionary with the results per metric

Return type:

dict

DeepMTP.utils.eval_utils.get_performance_results(mode: str, epoch_id: int, instances_arr: Sequence[Any], targets_arr: Sequence[Any], true_values_arr: Sequence[Any], pred_values_arr: Sequence[Any], validation_setting: str, problem_mode: str, metrics: Sequence[str], averaging: Sequence[str], slices_arr: Sequence[Any] | None = None, verbose: bool = False, per_target_verbose: bool = False, per_instance_verbose: bool = False, top_k: int | None = None, return_detailed_macro: bool = False, train_true_value: Mapping[Any, float] | None = None, scaler_per_target: InverseTransformer | Mapping[Any, InverseTransformer] | None = None, progress: EvaluationProgressObserver | None = None, classification_mode: str | None = None, num_classes: int | None = None, multiclass_average: str | None = None, class_probabilities_arr: Sequence[Any] | None = None) → dict[str, float]

Calculates all the metrics using different averaging schemes

Parameters:
  • mode (str) – The mode during which the calculation of metrics is requested. Possible values are train, val, test.

  • epoch_id (int) – The id of the current epoch.

  • instances_arr (numpy.array) – An array with the instance ids. This is used when instance averaging is needed.

  • targets_arr (numpy.array) – An array with the target ids. This is used when macro-averaging is needed.

  • true_values_arr (numpy.array) – An array with the true values.

  • pred_values_arr (numpy.array) – An array with the predicted values.

  • validation_setting (str) – The validation setting of the current problem. This is used to determine if some averaging methods make sense to be calculated given the validation setting.

  • problem_mode (str) – The type of task of the given problem. Possible values are classification and regression.

  • metrics (list) – The performance metrics that will be calculated.

  • averaging (list) – The averaging strategy that will be used to calculate the metric.

  • slices_arr (np.array, optional) – An array with the slice ids. Slice-aware evaluation is not implemented and non-None values are rejected. Defaults to None.

  • verbose (bool, optional) – Whether or not to print useful info in the terminal. Defaults to False.

  • per_target_verbose (bool, optional) – Whether or not to print useful info per target in the terminal. Defaults to False.

  • per_instance_verbose (bool, optional) – Whether or not to print useful info per instance in the terminal. Defaults to False.

  • top_k (int, optional) – The number of top-performing instances or targets used to calculate grouped metrics. Requires macro or instance averaging. Defaults to None.

  • return_detailed_macro (bool, optional) – Whether to include per-target metrics in addition to macro averages. Requires macro averaging. Defaults to False.

  • train_true_value (_type_, optional) – The training mean for every target, required when calculating macro RRMSE. Defaults to None.

  • scaler_per_target (_type_, optional) – One global scaler for setting A or a scaler for every target in settings B-D. Supported for regression scores only. Defaults to None.

  • progress (EvaluationProgressObserver, optional) – Receives requested verbose evaluation details instead of writing them directly.

Raises:

AttributeError – only when the problem setting is A, but a macro or instance wise averaging is requested

Returns:

A dictionary with key:value pairs of metric_name: metric_value

Return type:

dict

DeepMTP.utils.eval_utils.instance_wise_pred_inverse_transformation(row: Series, scaler_per_instance: Mapping[Any, InverseTransformer]) → float

Inverse-transform one prediction with its instance-specific scaler.

DeepMTP.utils.eval_utils.instance_wise_true_inverse_transformation(row: Series, scaler_per_instance: Mapping[Any, InverseTransformer]) → float

Inverse-transform one true value with its instance-specific scaler.

DeepMTP.utils.eval_utils.target_wise_pred_inverse_transformation(row: Series, scaler_per_target: Mapping[Any, InverseTransformer]) → float

Inverse-transform one prediction with its target-specific scaler.

DeepMTP.utils.eval_utils.target_wise_true_inverse_transformation(row: Series, scaler_per_target: Mapping[Any, InverseTransformer]) → float

Inverse-transform one true value with its target-specific scaler.

DeepMTP.utils.model_utils module

class DeepMTP.utils.model_utils.EarlyStopping(use_early_stopping: bool, patience: int = 7, delta: float = 0.0, metric_to_track: str = 'loss', verbose: bool = False)

Bases: object

Early stops the training if validation loss doesn’t improve after a given patience.

get_best_epoch() → int | None
get_best_model() → nn.Module | None
get_best_optimizer_state_dict() → dict[str, Any] | None
get_best_performance_results() → dict[str, float] | None
get_best_score() → float | None
class DeepMTP.utils.model_utils.EarlyStoppingUpdate(status: Literal['initialized', 'improved', 'patience_incremented'], counter: int, patience: int, best_epoch: int | None, should_stop: bool)

Bases: object

Describe the state transition produced by one validation result.

best_epoch: int | None
counter: int
patience: int
should_stop: bool
status: Literal['initialized', 'improved', 'patience_incremented']

DeepMTP.utils.utils module

class DeepMTP.utils.utils.BaseExperimentInfo(config: Any, budget: int | float)

Bases: object

A class used to keep track of all relevant info of a given experiment. This is mainly used by the HPO methods.

get_budget() → int | float
get_config() → Any
update_score(score: float) → None
DeepMTP.utils.utils.generate_config(validation_setting: str | None = None, general_architecture_version: str = 'dot_product', problem_mode: str | None = None, learning_rate: float = 0.001, decay: float = 0, batch_norm: bool | str = False, dropout_rate: float = 0, dropout_rate_instance_branch: float | None = None, dropout_rate_target_branch: float | None = None, momentum: float = 0.9, weighted_loss: bool = False, compute_mode: str = 'cuda:0', num_workers: int = 1, train_batchsize: int = 512, val_batchsize: int = 512, num_epochs: int = 100, random_seed: int | None = 2, metrics: Sequence[str] | None = None, metrics_average: Sequence[str] | None = None, top_k: int | None = None, patience: int = 10, delta: float = 0, evaluate_train: bool = False, evaluate_val: bool = False, verbose: bool = False, results_verbose: bool = False, eval_instance_verbose: bool = False, eval_target_verbose: bool = False, return_results_per_target: bool = False, use_early_stopping: bool = True, use_tensorboard_logger: bool = False, wandb_project_name: str | None = None, wandb_project_entity: str | None = None, wandb_mode: str | None = None, wandb_run_name: str | None = None, wandb_group: str | None = None, wandb_job_type: str = 'train', wandb_tags: Sequence[str] | None = None, wandb_notes: str | None = None, wandb_watch: str | None = 'gradients', wandb_watch_log_freq: int = 1000, wandb_log_graph: bool = False, wandb_log_code: bool = False, wandb_log_model_artifact: bool = False, wandb_model_artifact_name: str | None = None, wandb_model_artifact_aliases: Sequence[str] | None = None, wandb_input_artifacts: Sequence[str] | None = None, wandb_registry_name: str | None = None, wandb_registry_collection: str | None = None, wandb_log_predictions: bool = False, wandb_prediction_table_max_rows: int = 1000, results_path: str = './results/', experiment_name: str | None = None, save_model: bool = True, checkpoint_format: str = 'full', data_preparation_state: Mapping[str, Any] | None = None, metric_to_optimize_early_stopping: str = 'loss', metric_to_optimize_best_epoch_selection: str = 'loss', instance_branch_architecture: str | None = None, use_instance_features: bool = False, instance_branch_input_dim: int | None = None, instance_branch_tabular_schema: Mapping[str, Any] | None = None, instance_train_transforms: Any = None, instance_inference_transforms: Any = None, target_branch_architecture: str | None = None, use_target_features: bool = False, target_branch_input_dim: int | None = None, target_branch_tabular_schema: Mapping[str, Any] | None = None, target_train_transforms: Any = None, target_inference_transforms: Any = None, comb_mlp_nodes_reducing_factor: int = 2, comb_mlp_nodes_per_layer: list[int] | int | None = None, comb_mlp_layers: int | None = None, embedding_size: int = 100, eval_every_n_epochs: int = 10, load_pretrained_model: bool = False, pretrained_model_path: str = '', running_hpo: bool = False, additional_info: Mapping[str, Any] | None = None, instance_branch_params: Mapping[str, Any] | None = None, target_branch_params: Mapping[str, Any] | None = None, hpo_results_path: str = './', loss: str | None = None, classification_mode: str | None = None, num_classes: int | None = None, multiclass_average: str | None = None, gradient_accumulation_steps: int = 1, gradient_clip_norm: float | None = None) → dict[str, Any]

Creates a dictionary that is used to configure the neural network. Contains some base logic that checks if some of the parameters make sense. It has to be updated each time a new feature is added.

Parameters:
  • validation_setting (str, optional) – The validation setting of the given problem. The possible values are A, B, C, D. Defaults to None.

  • general_architecture_version (str, optional) – Enables a specific version of the general neural network architecture. Available options are: “mlp” for the mlp version, “dot_product” for the dot product version, “kronecker”: for the kronecker product version. Default value if “dot_product”

  • problem_mode (str, optional) – The type of task for the given problem. The possible values are classification or regression. Defaults to None.

  • classification_mode (str, optional) – Use “binary” (default for classification) or “multiclass”. Multiclass mode requires num_classes.

  • num_classes (int, optional) – Number of mutually exclusive classes. Required and at least three for multiclass classification.

  • multiclass_average (str, optional) – Class averaging for multiclass precision, recall, F1, AUROC, and AUPR. Available values are “micro”, “macro”, and “weighted”. Defaults to “macro”.

  • loss (str, optional) – The training objective. Binary classification supports “binary_cross_entropy_with_logits” (default) and explicit legacy “binary_cross_entropy”. Multiclass classification uses “cross_entropy”. Regression supports “mean_squared_error” (default), “mean_absolute_error”, and “huber”. Defaults to the stable objective for the configured task.

  • learning_rate (float, optional) – The learning rate that will be used during training. Defaults to 0.001.

  • decay (float, optional) – The weight decay (L2 penalty) used by the Adam optimizer . Defaults to 0.

  • batch_norm (bool, optional) – The option to use batch normalization between the fully connected layers in the two branches. Defaults to False.

  • dropout_rate (float, optional) – The amount of dropout used in the layers of the two branches. Defaults to 0.

  • dropout_rate_instance_branch (float, optional) – The amount of dropout used in the layers of the instance branch, Can be used when assymetric overfitting between branches is observed. Defaults to 0.

  • dropout_rate_target_branch (float, optional) – The amount of dropout used in the layers of the target branch. Can be used when assymetric overfitting between branches is observed. Defaults to 0.

  • momentum (float, optional) – The momentum used by the optimizer. Defaults to 0.9.

  • weighted_loss (bool, optional) – Enables the use of class weights in the loss. Defaults to False.

  • compute_mode (str, optional) – The specific device that will be used during training. The possible values can be one the available gpus or the cpu(please dont). Defaults to ‘cuda:0’.

  • num_workers (int, optional) – The number of sub-processes to use for data loading. Larger values usually improve performance but after a point training speed will become worse. Defaults to 1.

  • train_batchsize (int, optional) – The number of samples that comprise a batch from the training set. Defaults to 512.

  • val_batchsize (int, optional) – The number of samples that comprise a batch from the validation and test sets. Defaults to 512.

  • num_epochs (int, optional) – The max number of epochs allowed for training. Defaults to 100.

  • gradient_accumulation_steps (int, optional) – Number of training microbatches whose observation-weighted gradients are combined before each optimizer step. Defaults to 1.

  • gradient_clip_norm (float, optional) – Positive finite global gradient norm limit applied immediately before each optimizer step, or None to disable clipping. Defaults to None.

  • random_seed (int, optional) – The seed used for isolated model initialization and training-data shuffling. Use None for nondeterministic behavior. Defaults to 2.

  • metrics (list, optional) – The performance metrics that will be calculated. For classification tasks the available metrics are [‘hamming_loss’, ‘auroc’, ‘f1_score’, ‘aupr’, ‘accuracy’, ‘recall’, ‘precision’] while for regression tasks the available metrics are [‘RMSE’, ‘MSE’, ‘MAE’, ‘R2’]. Defaults to [‘hamming_loss’, ‘auroc’, ‘f1_score’, ‘aupr’, ‘accuracy’, ‘recall’, ‘precision’].

  • metrics_average (list, optional) – The averaging strategy that will be used to calculate the metric. The available options are [‘macro’, ‘micro’, ‘instance’]. Defaults to [‘macro’, ‘micro’].

  • top_k (int, optional) – The number of top predictions used to calculate grouped top-k metric versions. Requires macro or instance averaging.

  • patience (int, optional) – The number of epochs that the network is allowed to continue training for while observing worse overall performance. Defaults to 10.

  • delta (float, optional) – The delta used during early stopping

  • evaluate_train (bool, optional) – Whether or not to calculate performance metrics over the training set. Defaults to False.

  • evaluate_val (bool, optional) – Whether or not to calculate performance metrics over the validation set. Defaults to False.

  • verbose (bool, optional) – Whether or not to print useful info about the training process in the terminal. Defaults to False.

  • results_verbose (bool, optional) – Whether or not to print useful info about the calculation of the performance metrics in the terminal. Defaults to False.

  • return_results_per_target (bool, optional) – Whether or not to return metrics per target. Defaults to False.

  • use_early_stopping (bool, optional) – Whether or not to use early stopping while training. Defaults to True.

  • use_tensorboard_logger (bool, optional) – Whether or not to log results in Tensorboard. Defaults to False.

  • wandb_project_name (str, optional) – The name of the wandb project that the results of an experiment will be logged. Defaults to None.

  • wandb_project_entity (str, optional) – The user name of the wandb account. Defaults to None.

  • wandb_mode (str, optional) – W&B mode: online, offline, disabled, or None to use the SDK/environment default.

  • wandb_run_name (str, optional) – W&B display name for the run.

  • wandb_group (str, optional) – W&B run group used to compare related runs.

  • wandb_job_type (str, optional) – W&B job type. Defaults to train.

  • wandb_tags (sequence, optional) – Searchable W&B run tags.

  • wandb_notes (str, optional) – Free-form W&B run notes.

  • wandb_watch (str, optional) – Model monitoring level: gradients, parameters, all, or None. Defaults to gradients.

  • wandb_watch_log_freq (int, optional) – Positive model-monitoring interval. Defaults to 1000.

  • wandb_log_graph (bool, optional) – Include the model graph when monitoring. Defaults to False.

  • wandb_log_code (bool, optional) – Upload project source files through Run.log_code. Defaults to False.

  • wandb_log_model_artifact (bool, optional) – Publish every saved DeepMTP checkpoint, config, and summary as a versioned model Artifact.

  • wandb_model_artifact_name (str, optional) – Explicit W&B model Artifact name. Defaults to a normalized experiment-directory name.

  • wandb_model_artifact_aliases (sequence, optional) – Artifact aliases. Defaults to ["latest", "best"].

  • wandb_input_artifacts (sequence, optional) – Online W&B Artifact references to mark as run inputs and capture data lineage.

  • wandb_registry_name (str, optional) – Existing W&B Registry name for linking a saved model Artifact. Requires online mode.

  • wandb_registry_collection (str, optional) – Registry collection paired with wandb_registry_name.

  • wandb_log_predictions (bool, optional) – Log a bounded test-prediction Table and classification charts. Defaults to False.

  • wandb_prediction_table_max_rows (int, optional) – Maximum rows sampled into the W&B prediction Table. Defaults to 1000.

  • results_path (str, optional) – The path the all relevant information will be saved to. Defaults to ‘./results/’.

  • experiment_name (str, optional) – The name of the current experiment. This name will be used to local save and the wandb save. Defaults to None.

  • save_model (bool, optional) – Whether or not to save the model of the epoch with the best validation performance. Defaults to True.

  • checkpoint_format (str, optional) – Save full resumable checkpoints or compact foundation_adapter inference/warm-start artifacts. Defaults to full.

  • data_preparation_state (mapping, optional) – Previously captured split provenance and fitted dense-scaler state. Normally populated automatically from the outputs of data_process.

  • metric_to_optimize_early_stopping (str, optional) – The metric that will be used for tracking by the early stopping routine. The value can be the loss or one of the available performance metrics.. Defaults to ‘loss’.

  • metric_to_optimize_best_epoch_selection (str, optional) – The validation metric that will be used to determine the best configuration. The value can be the loss or one of the available performance metrics.. Defaults to ‘loss’.

  • instance_branch_architecture (str, optional) – The type of architecture used in the instance branch: MLP for dense side features, SPARSE for high-dimensional SciPy or PyTorch sparse features, GRAPH for PyTorch Geometric graphs, SEQUENCE for token IDs, TABULAR for explicit numeric and categorical columns, COMPOSITE for multiple named encoders, CONV for images, EMBEDDING for zero-based entity IDs, or CUSTOM for a user-supplied branch. Defaults to None.

  • use_instance_features (bool, optional) – Whether or not the instance features will be used. Defaults to False.

  • instance_branch_input_dim (int, optional) – The input dimension of the instance branch, or the number of instance IDs for an EMBEDDING branch. Defaults to None.

  • instance_branch_tabular_schema (mapping, optional) – Numeric columns, categorical vocabularies, missing-value policies, normalization, and optional feature gating for an instance TABULAR branch.

  • instance_branch_nodes_reducing_factor (int, optional) – The factor that will be used to create a smooth bottleneck in the instance branch. Not currently implemented. Defaults to 2.

  • instance_branch_nodes_per_layer (list, optional) – Defines the number of nodes in the MLP version of the instance branch. if list, each element defines the number of nodes in the corresponding layer. If int, the same number of nodes is used instance_branch_layers times. Defaults to [10, 10, 10].

  • instance_branch_layers (int, optional) – The number of layers in the MLP version of the instance branch. (Only used if instance_branch_nodes_per_layer is int). Defaults to None.

  • instance_train_transforms (_type_, optional) – The Pytorch compatible transforms that can be used on the training samples. Useful when using images with convolutional architectures. Defaults to None.

  • instance_inference_transforms (_type_, optional) – The Pytorch compatible transforms that can be used on the validation and test samples. Useful when using images with convolutional architectures. Defaults to None.

  • instance_branch_conv_architecture (str, optional) – The convolutional architecture used in the instance branch: ‘resnet’ or ‘VGG’. Defaults to ‘resnet’.

  • instance_branch_conv_architecture_version (str, optional) – The ResNet version used in the instance branch: ‘resnet18’ or ‘resnet101’. Defaults to ‘resnet101’.

  • instance_branch_conv_architecture_dense_layers (int, optional) – The number of replacement dense layers for a ResNet instance branch: 1 or 2. Defaults to 1.

  • instance_branch_conv_architecture_last_layer_trained (str, optional) – The earliest trainable ResNet block in the instance branch: ‘last’ or ‘layer4’ through ‘layer1’. Defaults to ‘last’.

  • instance_branch_conv_pretrained (bool, optional) – Whether to initialize an instance convolutional branch with torchvision’s default pretrained weights. Set to False to construct the model without a network download. Defaults to True.

  • target_branch_architecture (str, optional) – The type of architecture used in the target branch: MLP for dense side features, SPARSE for high-dimensional SciPy or PyTorch sparse features, GRAPH for PyTorch Geometric graphs, SEQUENCE for token IDs, TABULAR for explicit numeric and categorical columns, COMPOSITE for multiple named encoders, CONV for images, EMBEDDING for zero-based entity IDs, or CUSTOM for a user-supplied branch. Defaults to None.

  • use_target_features (bool, optional) – Whether or not the target features will be used. Defaults to False.. Defaults to False.

  • target_branch_input_dim (int, optional) – The input dimension of the target branch, or the number of target IDs for an EMBEDDING branch. Defaults to None.

  • target_branch_tabular_schema (mapping, optional) – Numeric columns, categorical vocabularies, missing-value policies, normalization, and optional feature gating for a target TABULAR branch.

  • target_branch_nodes_reducing_factor (int, optional) – The factor that will be used to create a smooth bottleneck in the target branch. Not currently implemented. Defaults to 2.

  • target_branch_nodes_per_layer (list, optional) – Defines the number of nodes in the MLP version of the target branch. if list, each element defines the number of nodes in the corresponding layer. If int, the same number of nodes is used target_branch_layers times. Defaults to [10, 10, 10].

  • target_branch_layers (_type_, optional) – The number of layers in the MLP version of the target branch. (Only used if target_branch_nodes_per_layer is int). Defaults to None.

  • target_train_transforms (_type_, optional) – The Pytorch compatible transforms that can be used on the training samples. Useful when using images with convolutional architectures. Defaults to None.

  • target_inference_transforms (_type_, optional) – The Pytorch compatible transforms that can be used on the validation and test samples. Useful when using images with convolutional architectures. Defaults to None.

  • target_branch_conv_architecture (str, optional) – The convolutional architecture used in the target branch: ‘resnet’ or ‘VGG’. Defaults to ‘resnet’.

  • target_branch_conv_architecture_version (str, optional) – The ResNet version used in the target branch: ‘resnet18’ or ‘resnet101’. Defaults to ‘resnet101’.

  • target_branch_conv_architecture_dense_layers (int, optional) – The number of replacement dense layers for a ResNet target branch: 1 or 2. Defaults to 1.

  • target_branch_conv_architecture_last_layer_trained (str, optional) – The earliest trainable ResNet block in the target branch: ‘last’ or ‘layer4’ through ‘layer1’. Defaults to ‘last’.

  • target_branch_conv_pretrained (bool, optional) – Whether to initialize a target convolutional branch with torchvision’s default pretrained weights. Set to False to construct the model without a network download. Defaults to True.

  • comb_mlp_nodes_reducing_factor (int, optional) – The factor that will be used to create a smooth bottleneck in the combination MLP. (Only used if general_architecture_version in “mlp”). Not currently implemented. Defaults to 2.

  • comb_mlp_nodes_per_layer (list or int, optional) – Positive layer widths for the combination branch. If a list is provided, each element defines one layer. If an int is provided, the width is repeated comb_mlp_layers times. Used only when general_architecture_version is “mlp”. Defaults to [10, 10, 10].

  • comb_mlp_layers (int, optional) – The positive number of repeated combination layers, required when comb_mlp_nodes_per_layer is an int. Used only when general_architecture_version is “mlp”. Defaults to None.

  • embedding_size (int, optional) – The branch output size for dot-product models and for each EMBEDDING branch. Defaults to 100.

  • eval_every_n_epochs (int, optional) – The interval that indicates when the performance metrics are computed. Defaults to 10.

  • load_pretrained_model (bool, optional) – Whether or not a pretrained model will be loaded. Defaults to False.

  • pretrained_model_path (str, optional) – The path to the .pt file with the pretrained model (Only used if load_pretrained_model == True). Defaults to ‘’.

  • running_hpo (bool, optional) – Whether or not the base model will by used by an hpo method. This is used to adjust the prints. Defaults to False.

  • additional_info (dict, optional) – A dictionary that holds all other relevant info. Can be used as log adittional info for an experiment in wandb. Defaults to {}.

  • eval_instance_verbose (str, optional) – Printing of instance-wise warnings when evaluating performance metrics.

  • eval_target_verbose (str, optional) – Printing of target-wise warnings when evaluating performance metrics.

  • hpo_results_path (str, optional) – The directory the HPO results will be stored.

Returns:

A dictionary with the config that will be used by the model to adjust the architecture and all other training-related information

Return type:

dict

DeepMTP.utils.utils.get_default_batch_norm() → bool

To return the default batch_norm value

Returns:

The value False

Return type:

float

DeepMTP.utils.utils.get_default_dropout_rate() → float

To return the default dropout rate

Returns:

The value 0

Return type:

int

DeepMTP.utils.utils.get_default_inference_transform() → Any

To return the default transformation pipeline for a resnet during inference

Returns:

A transformation pipeline

Return type:

torchvision.transforms

DeepMTP.utils.utils.get_default_train_transform() → Any

To return the default transformation pipeline for a resnet during training

Returns:

A transformation pipeline

Return type:

torchvision.transforms

DeepMTP.utils.utils.get_optimization_direction(metric_name: str) → Literal['max', 'min']

Determines if the goal is to maximize or minimize based on the name of the metric

Parameters:

metric_name (sting) – the name of the metric

Returns:

max if the goal is go maximize or min if the goal is to mimize

Return type:

string

Module contents