Multiobjective Metrics - API Reference¶
Auto-generated documentation for multiobjective metric classes.
warprec.evaluation.metrics.multiobjective.euclideandistance.EucDistance
¶
Bases: TopKMetric
Computes the Euclidean Distance between the model's performance and an Utopia Point (Ideal Point).
Usually, a lower Euclidean Distance indicates a better performance as it is closer to the ideal objectives.
Attributes:
| Name | Type | Description |
|---|---|---|
utopia_tensor |
Tensor
|
Tensor of utopia points of sub metrics. |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
k
|
int
|
The number of top recommendations to consider (cutoff). |
required |
num_users
|
int
|
Number of users in the training set. |
required |
num_items
|
int
|
Number of items in the training set. |
required |
metric_names
|
List[str]
|
List of sub metrics to compute. |
required |
utopia_points
|
List[float]
|
List of utopia points of the sub metrics. |
required |
*args
|
Any
|
Additional arguments to pass to the parent class. |
()
|
dist_sync_on_step
|
bool
|
Torchmetrics parameter. |
False
|
**kwargs
|
Any
|
Additional keyword arguments to pass to the parent class. |
{}
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If the provided lists have different lengths. |
Source code in warprec/evaluation/metrics/multiobjective/euclideandistance.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | |
name
property
¶
Generates a dynamic name for the metric identifying its components, utopia points, and directions.
compute()
¶
Computes the Euclidean distance for each user towards the Utopia Point.
Source code in warprec/evaluation/metrics/multiobjective/euclideandistance.py
update(preds, user_indices, **kwargs)
¶
Updates the metric state with the new batch of predictions.
Source code in warprec/evaluation/metrics/multiobjective/euclideandistance.py
warprec.evaluation.metrics.multiobjective.hypervolume.Hypervolume
¶
Bases: TopKMetric
Computes the multi-objective Hypervolume (HV) metric based on a list of individual metrics.
The Hypervolume measures the volume of the objective space dominated by the model's performance relative to a reference (nadir) point. In this implementation, it is calculated as the product of the distances between the scores and the nadir points.
Attributes:
| Name | Type | Description |
|---|---|---|
nadir_tensor |
Tensor
|
Tensor of nadir points of sub metrics. |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
k
|
int
|
The number of top recommendations to consider (cutoff). |
required |
num_users
|
int
|
Number of users in the training set. |
required |
num_items
|
int
|
Number of items in the training set. |
required |
metric_names
|
List[str]
|
List of sub metrics to compute. |
required |
nadir_points
|
List[float]
|
List of nadir points of the sub metrics. |
required |
higher_is_better
|
List[bool]
|
List of booleans that defines wether a sub metric wants to be maximized. |
required |
*args
|
Any
|
Additional arguments to pass to the parent class. |
()
|
dist_sync_on_step
|
bool
|
Torchmetrics parameter. |
False
|
**kwargs
|
Any
|
Additional keyword arguments to pass to the parent class. |
{}
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If the provided lists have different lengths. |
Source code in warprec/evaluation/metrics/multiobjective/hypervolume.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | |
name
property
¶
Generates a dynamic name for the metric identifying its components, nadir points, and directions.
compute()
¶
Computes the Hypervolume for each user.
HV is calculated as the product of positive distances from the nadir point across all defined objectives.
Source code in warprec/evaluation/metrics/multiobjective/hypervolume.py
update(preds, user_indices, **kwargs)
¶
Updates the metric state with the new batch of predictions.