src.fairreckitlib.evaluation.metrics.metric_constants

This module contains metric constants that are used in other modules.

Constants:

KEY_METRIC_PARAM_K: the key that is used for the metric parameter K.
KEY_METRIC_EVALUATION: the key that is used to identify a metric evaluation.
KEY_METRIC_SUBGROUP: the key that is used to identify a metric subgroup.

Enumerations:

MetricCategory: the category of evaluation for a metric.
Metric: the names of various metrics.

This program has been developed by students from the bachelor Computer Science at Utrecht University within the Software Project course. © Copyright Utrecht University (Department of Information and Computing Sciences)

 1"""This module contains metric constants that are used in other modules.
 2
 3Constants:
 4
 5    KEY_METRIC_PARAM_K: the key that is used for the metric parameter K.
 6    KEY_METRIC_EVALUATION: the key that is used to identify a metric evaluation.
 7    KEY_METRIC_SUBGROUP: the key that is used to identify a metric subgroup.
 8
 9Enumerations:
10
11    MetricCategory: the category of evaluation for a metric.
12    Metric: the names of various metrics.
13
14This program has been developed by students from the bachelor Computer Science at
15Utrecht University within the Software Project course.
16© Copyright Utrecht University (Department of Information and Computing Sciences)
17"""
18
19import enum
20
21KEY_METRIC_PARAM_K = 'K'
22KEY_METRIC_EVALUATION = 'evaluation'
23KEY_METRIC_SUBGROUP = 'subgroup'
24
25
26class MetricCategory(enum.Enum):
27    """Metric category of evaluation."""
28
29    ACCURACY = 'Accuracy'
30    RATING = 'Rating'
31    COVERAGE = 'Coverage'
32    DIVERSITY = 'Diversity'
33    NOVELTY = 'Novelty'
34
35
36# Known metrics (some not supported)
37class Metric(enum.Enum):
38    """Known metrics (names)."""
39
40    # Accuracy
41    HIT_RATIO = 'HR@K'
42    NDCG = 'NDCG@K'
43    PRECISION = 'P@K'
44    RECALL = 'R@K'
45    MRR = 'MRR'
46
47    # Coverage
48    ITEM_COVERAGE = 'Item Coverage'
49    USER_COVERAGE = 'User Coverage'
50
51    # Diversity
52    GINI = 'Gini Index'
53    INTRA_LIST_SIMILARITY = 'Intra-List Similarity'
54    SIMILARITY_COS = 'Similarity Cosine'
55    SIMILARITY_EUCLID = 'Similarity Euclidean'
56
57    # Rating
58    RMSE = 'RMSE'
59    MAE = 'MAE'
60    MAPE = 'MAPE'
61    MSE = 'MSE'
class MetricCategory(enum.Enum):
27class MetricCategory(enum.Enum):
28    """Metric category of evaluation."""
29
30    ACCURACY = 'Accuracy'
31    RATING = 'Rating'
32    COVERAGE = 'Coverage'
33    DIVERSITY = 'Diversity'
34    NOVELTY = 'Novelty'

Metric category of evaluation.

ACCURACY = <MetricCategory.ACCURACY: 'Accuracy'>
RATING = <MetricCategory.RATING: 'Rating'>
COVERAGE = <MetricCategory.COVERAGE: 'Coverage'>
DIVERSITY = <MetricCategory.DIVERSITY: 'Diversity'>
NOVELTY = <MetricCategory.NOVELTY: 'Novelty'>
Inherited Members
enum.Enum
name
value
class Metric(enum.Enum):
38class Metric(enum.Enum):
39    """Known metrics (names)."""
40
41    # Accuracy
42    HIT_RATIO = 'HR@K'
43    NDCG = 'NDCG@K'
44    PRECISION = 'P@K'
45    RECALL = 'R@K'
46    MRR = 'MRR'
47
48    # Coverage
49    ITEM_COVERAGE = 'Item Coverage'
50    USER_COVERAGE = 'User Coverage'
51
52    # Diversity
53    GINI = 'Gini Index'
54    INTRA_LIST_SIMILARITY = 'Intra-List Similarity'
55    SIMILARITY_COS = 'Similarity Cosine'
56    SIMILARITY_EUCLID = 'Similarity Euclidean'
57
58    # Rating
59    RMSE = 'RMSE'
60    MAE = 'MAE'
61    MAPE = 'MAPE'
62    MSE = 'MSE'

Known metrics (names).

HIT_RATIO = <Metric.HIT_RATIO: 'HR@K'>
NDCG = <Metric.NDCG: 'NDCG@K'>
PRECISION = <Metric.PRECISION: 'P@K'>
RECALL = <Metric.RECALL: 'R@K'>
MRR = <Metric.MRR: 'MRR'>
ITEM_COVERAGE = <Metric.ITEM_COVERAGE: 'Item Coverage'>
USER_COVERAGE = <Metric.USER_COVERAGE: 'User Coverage'>
GINI = <Metric.GINI: 'Gini Index'>
INTRA_LIST_SIMILARITY = <Metric.INTRA_LIST_SIMILARITY: 'Intra-List Similarity'>
SIMILARITY_COS = <Metric.SIMILARITY_COS: 'Similarity Cosine'>
SIMILARITY_EUCLID = <Metric.SIMILARITY_EUCLID: 'Similarity Euclidean'>
RMSE = <Metric.RMSE: 'RMSE'>
MAE = <Metric.MAE: 'MAE'>
MAPE = <Metric.MAPE: 'MAPE'>
MSE = <Metric.MSE: 'MSE'>
Inherited Members
enum.Enum
name
value