Evaluate the metric with raw approxes and labels. Parameters ---------- label : list or numpy.ndarrays or pandas.DataFrame or pandas.Series Object labels. approx : list or numpy.ndarrays or pandas.DataFrame or pandas.Series Object ap
(
self,
label,
approx,
weight=None,
group_id=None,
group_weight=None,
subgroup_id=None,
pairs=None,
thread_count=-1
)
| 58 | raise NotImplementedError('Should be overridden by the child class.') |
| 59 | |
| 60 | def eval( |
| 61 | self, |
| 62 | label, |
| 63 | approx, |
| 64 | weight=None, |
| 65 | group_id=None, |
| 66 | group_weight=None, |
| 67 | subgroup_id=None, |
| 68 | pairs=None, |
| 69 | thread_count=-1 |
| 70 | ): |
| 71 | """ |
| 72 | Evaluate the metric with raw approxes and labels. |
| 73 | |
| 74 | Parameters |
| 75 | ---------- |
| 76 | label : list or numpy.ndarrays or pandas.DataFrame or pandas.Series |
| 77 | Object labels. |
| 78 | |
| 79 | approx : list or numpy.ndarrays or pandas.DataFrame or pandas.Series |
| 80 | Object approxes. |
| 81 | |
| 82 | weight : list or numpy.ndarray or pandas.DataFrame or pandas.Series, optional (default=None) |
| 83 | Object weights. |
| 84 | |
| 85 | group_id : list or numpy.ndarray or pandas.DataFrame or pandas.Series, optional (default=None) |
| 86 | Object group ids. |
| 87 | |
| 88 | group_weight : list or numpy.ndarray or pandas.DataFrame or pandas.Series, optional (default=None) |
| 89 | Group weights. |
| 90 | |
| 91 | subgroup_id : list or numpy.ndarray, optional (default=None) |
| 92 | subgroup id for each instance. |
| 93 | If not None, giving 1 dimensional array like data. |
| 94 | |
| 95 | pairs : list or numpy.ndarray or pandas.DataFrame or string or pathlib.Path |
| 96 | The pairs description. |
| 97 | If list or numpy.ndarrays or pandas.DataFrame, giving 2 dimensional. |
| 98 | The shape should be Nx2, where N is the pairs' count. The first element of the pair is |
| 99 | the index of winner object in the training set. The second element of the pair is |
| 100 | the index of loser object in the training set. |
| 101 | If string or pathlib.Path, giving the path to the file with pairs description. |
| 102 | |
| 103 | thread_count : int, optional (default=-1) |
| 104 | Number of threads to work with. |
| 105 | If -1, then the number of threads is set to the number of CPU cores. |
| 106 | |
| 107 | Returns |
| 108 | ------- |
| 109 | metric results : list with metric values. |
| 110 | """ |
| 111 | if len(label) > 0 and not isinstance(label[0], _ARRAY_TYPES): |
| 112 | label = [label] |
| 113 | if len(approx) == 0: |
| 114 | approx = [[]] |
| 115 | if not isinstance(approx[0], _ARRAY_TYPES): |
| 116 | approx = [approx] |
| 117 | return _catboost._eval_metric_util( |