leslyarun commited on
Commit
c15140e
1 Parent(s): 1f1f8f8

Update fbeta_score.py

Browse files
Files changed (1) hide show
  1. fbeta_score.py +3 -3
fbeta_score.py CHANGED
@@ -46,7 +46,7 @@ _KWARGS_DESCRIPTION = """
46
  Args:
47
  predictions (`list` of `int`): Predicted labels.
48
  references (`list` of `int`): Ground truth labels.
49
- beta (`float`): Determines the weight of recall in the combined score.
50
  labels (`list` of `int`): The set of labels to include when `average` is not set to `'binary'`, and the order of the labels if `average` is `None`. Labels present in the data can be excluded, for example to calculate a multiclass average ignoring a majority negative class. Labels not present in the data will result in 0 components in a macro average. For multilabel targets, labels are column indices. By default, all labels in `predictions` and `references` are used in sorted order. Defaults to None.
51
  pos_label (`int`): The class to be considered the positive class, in the case where `average` is set to `binary`. Defaults to 1.
52
  average (`string`): This parameter is required for multiclass/multilabel targets. If set to `None`, the scores for each class are returned. Otherwise, this determines the type of averaging performed on the data. Defaults to `'binary'`.
@@ -65,7 +65,7 @@ Examples:
65
 
66
  Example 1-A simple binary example
67
  >>> f_beta = evaluate.load("leslyarun/f_beta")
68
- >>> results = f_beta.compute(references=[0, 1], predictions=[0, 1])
69
  >>> print(results)
70
  {'f_beta_score': 1.0}
71
  """
@@ -93,7 +93,7 @@ class F_Beta(evaluate.Metric):
93
  )
94
 
95
 
96
- def _compute(self, predictions, references, beta, labels=None, pos_label=1, average="binary", sample_weight=None):
97
  score = fbeta_score(
98
  references, predictions, beta, labels=labels, pos_label=pos_label, average=average, sample_weight=sample_weight
99
  )
 
46
  Args:
47
  predictions (`list` of `int`): Predicted labels.
48
  references (`list` of `int`): Ground truth labels.
49
+ beta (`float`): Determines the weight of recall in the combined score. Defaults to 0.5
50
  labels (`list` of `int`): The set of labels to include when `average` is not set to `'binary'`, and the order of the labels if `average` is `None`. Labels present in the data can be excluded, for example to calculate a multiclass average ignoring a majority negative class. Labels not present in the data will result in 0 components in a macro average. For multilabel targets, labels are column indices. By default, all labels in `predictions` and `references` are used in sorted order. Defaults to None.
51
  pos_label (`int`): The class to be considered the positive class, in the case where `average` is set to `binary`. Defaults to 1.
52
  average (`string`): This parameter is required for multiclass/multilabel targets. If set to `None`, the scores for each class are returned. Otherwise, this determines the type of averaging performed on the data. Defaults to `'binary'`.
 
65
 
66
  Example 1-A simple binary example
67
  >>> f_beta = evaluate.load("leslyarun/f_beta")
68
+ >>> results = f_beta.compute(references=[0, 1], predictions=[0, 1], beta=0.5)
69
  >>> print(results)
70
  {'f_beta_score': 1.0}
71
  """
 
93
  )
94
 
95
 
96
+ def _compute(self, predictions, references, beta=0.5, labels=None, pos_label=1, average="binary", sample_weight=None):
97
  score = fbeta_score(
98
  references, predictions, beta, labels=labels, pos_label=pos_label, average=average, sample_weight=sample_weight
99
  )