Rodrigo Ferreira Rodrigues commited on
Commit
1b88c4f
·
1 Parent(s): 808d8e3

Correcting input types

Browse files
Files changed (2) hide show
  1. coord_eval.py +2 -10
  2. tests.py +4 -4
coord_eval.py CHANGED
@@ -45,14 +45,11 @@ Returns:
45
  accuracy: 1 if coordinates predicted are d distant from gold ones, O otherwise.
46
  Examples:
47
  >>> my_new_module = evaluate.load("rfr2003/coord_eval")
48
- >>> results = my_new_module.compute(references=["(12.7, 67.8)", "(16.7, 89.6)"], predictions=[[12.7, 67.8], [10.9, 80.6]], d=20)
49
  >>> print(results)
50
  {'coord_accuracy': 0.5}
51
  """
52
 
53
- # TODO: Define external resources urls if needed
54
- BAD_WORDS_URL = "http://url/to/external/resource/bad_words.txt"
55
-
56
 
57
  @evaluate.utils.file_utils.add_start_docstrings(_DESCRIPTION, _KWARGS_DESCRIPTION)
58
  class Coord_eval(evaluate.Metric):
@@ -69,13 +66,8 @@ class Coord_eval(evaluate.Metric):
69
  # This defines the format of each prediction and reference
70
  features=datasets.Features({
71
  'generations': datasets.Value('string'),
72
- 'golds': datasets.Value('float32'),
73
  }),
74
- # Homepage of the module for documentation
75
- homepage="http://module.homepage",
76
- # Additional links to the codebase or references
77
- codebase_urls=["http://github.com/path/to/codebase/of/new_module"],
78
- reference_urls=["http://path.to.reference.url/new_module"]
79
  )
80
 
81
  def _download_and_prepare(self, dl_manager):
 
45
  accuracy: 1 if coordinates predicted are d distant from gold ones, O otherwise.
46
  Examples:
47
  >>> my_new_module = evaluate.load("rfr2003/coord_eval")
48
+ >>> results = my_new_module.compute(generations=["(12.7, 67.8)", "(16.7, 89.6)"], golds=[[12.7, 67.8], [10.9, 80.6]], d=20)
49
  >>> print(results)
50
  {'coord_accuracy': 0.5}
51
  """
52
 
 
 
 
53
 
54
  @evaluate.utils.file_utils.add_start_docstrings(_DESCRIPTION, _KWARGS_DESCRIPTION)
55
  class Coord_eval(evaluate.Metric):
 
66
  # This defines the format of each prediction and reference
67
  features=datasets.Features({
68
  'generations': datasets.Value('string'),
69
+ 'golds': datasets.Sequence(datasets.Value('float32')),
70
  }),
 
 
 
 
 
71
  )
72
 
73
  def _download_and_prepare(self, dl_manager):
tests.py CHANGED
@@ -1,13 +1,13 @@
1
  test_cases = [
2
  {
3
- "predictions": ["(12.7, 67.8)", "(16.7, 89.6)"],
4
- "references": [[12.7, 67.8], [10.9, 80.6]],
5
  "d": 20,
6
  "result": {"coord_accuracy": 0.5}
7
  },
8
  {
9
- "predictions": ["(12.7, 67.8)", "(16.7, 89.6)"],
10
- "references": [[12.7, 67.8], [10.9, 80.6]],
11
  "d": 1000000,
12
  "result": {"coord_accuracy": 1}
13
  },
 
1
  test_cases = [
2
  {
3
+ "generations": ["(12.7, 67.8)", "(16.7, 89.6)"],
4
+ "golds": [[12.7, 67.8], [10.9, 80.6]],
5
  "d": 20,
6
  "result": {"coord_accuracy": 0.5}
7
  },
8
  {
9
+ "generations": ["(12.7, 67.8)", "(16.7, 89.6)"],
10
+ "golds": [[12.7, 67.8], [10.9, 80.6]],
11
  "d": 1000000,
12
  "result": {"coord_accuracy": 1}
13
  },