danieldux commited on
Commit
00e1647
·
1 Parent(s): 889c3a5

Refactor ISCOHAM class name to ISCO_Hierarchical_Accuracy

Browse files
Files changed (2) hide show
  1. isco_ham.py +2 -31
  2. metric_template_1.py +1 -1
isco_ham.py CHANGED
@@ -35,36 +35,7 @@ _CITATION = """
35
  """
36
 
37
  _DESCRIPTION = """
38
- The ISCO-08 Hierarchical Accuracy Measure is an implementation
39
- of the measure described in [Functional Annotation of Genes Using Hierarchical Text Categorization](https://www.researchgate.net/publication/44046343_Functional_Annotation_of_Genes_Using_Hierarchical_Text_Categorization)
40
- (Kiritchenko, Svetlana and Famili, Fazel. 2005) with the ISCO-08 taxonomy by the International Labour Organization.
41
-
42
- 1. The measure gives credit to partially correct classification,
43
- e.g. misclassification into node $I$ (ISCO unit group "1120")
44
- when the correct category is $G$ (ISCO unit group "1111")
45
- should be penalized less than misclassification into node $D$
46
- (e.g., ISCO unit group "1211") since $I$ is in the same subgraph (ISCO sub-major group "11")
47
- as $G$ and $D$ is not.
48
- 2. The measure punishes distant errors more heavily:
49
- 1. the measure gives higher evaluation for correctly classifying one level down compared to staying at the parent node, e.g. classification into node $E$ (ISCO minor group "111") is better than classification into its parent $C$ (ISCO sub-major group "11") since $E$ is closer to the correct category $G$;
50
- 2. the measure gives lower evaluation for incorrectly classifying one level down comparing to staying at the parent node, e.g. classification into node $F$ (ISCO minor group "112") is worse than classification into its parent $C$ since $F$ is farther away from $G$.
51
-
52
- The features described are accomplished by pairing hierarchical variants of precision ($hP$) and recall ($hR$) to form a hierarchical F1 (hF_β) score where each sample belongs not only to its class (e.g., a unit group level code), but also to all ancestors of the class in a hierarchical graph (i.e., the minor, sub-major, and major group level codes).
53
-
54
- Hierarchical precision can be computed with:
55
- $hP = \frac{| \v{C}_i ∩ \v{C}^′_i|} {|\v{C}^′_i |} = \frac{1}{2}$
56
-
57
- Hierarchical recall can be computed with:
58
- $hR = \frac{| \v{C}_i ∩ \v{C}^′_i|} {|\v{C}_i |} = \frac{1}{2}$
59
-
60
- Combining the two values $hP$ and $hR$ into one hF-measure:
61
- hF_β = \frac{(β^2 + 1) · hP · hR}{(β^2 · hP + hR)}, β ∈ [0, +∞)
62
-
63
- Note:
64
- **TP**: True positive
65
- **TN**: True negative
66
- **FP**: False positive
67
- **FN**: False negative
68
  """
69
 
70
  _KWARGS_DESCRIPTION = """
@@ -103,7 +74,7 @@ ILO_ISCO_CSV_URL = (
103
 
104
 
105
  @evaluate.utils.file_utils.add_start_docstrings(_DESCRIPTION, _KWARGS_DESCRIPTION)
106
- class ISCOHAM(evaluate.Metric):
107
  """The ISCO-08 Hierarchical Accuracy Measure"""
108
 
109
  def _info(self):
 
35
  """
36
 
37
  _DESCRIPTION = """
38
+ The ISCO-08 Hierarchical Accuracy Measure is an implementation of the measure described in [Functional Annotation of Genes Using Hierarchical Text Categorization](https://www.researchgate.net/publication/44046343_Functional_Annotation_of_Genes_Using_Hierarchical_Text_Categorization) (Kiritchenko, Svetlana and Famili, Fazel. 2005) and adapted for the ISCO-08 classification scheme by the International Labour Organization.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  """
40
 
41
  _KWARGS_DESCRIPTION = """
 
74
 
75
 
76
  @evaluate.utils.file_utils.add_start_docstrings(_DESCRIPTION, _KWARGS_DESCRIPTION)
77
+ class ISCO_Hierarchical_Accuracy(evaluate.Metric):
78
  """The ISCO-08 Hierarchical Accuracy Measure"""
79
 
80
  def _info(self):
metric_template_1.py CHANGED
@@ -74,7 +74,7 @@ ILO_ISCO_CSV_URL = (
74
 
75
 
76
  @evaluate.utils.file_utils.add_start_docstrings(_DESCRIPTION, _KWARGS_DESCRIPTION)
77
- class ISCOHAM(evaluate.Metric):
78
  """The ISCO-08 Hierarchical Accuracy Measure"""
79
 
80
  def _info(self):
 
74
 
75
 
76
  @evaluate.utils.file_utils.add_start_docstrings(_DESCRIPTION, _KWARGS_DESCRIPTION)
77
+ class ISCO_Hierarchical_Accuracy(evaluate.Metric):
78
  """The ISCO-08 Hierarchical Accuracy Measure"""
79
 
80
  def _info(self):