(self, prediction: List[Dict], target: List[None])
| 277 | super().__init__(**kwargs) |
| 278 | |
| 279 | def metric(self, prediction: List[Dict], target: List[None]): |
| 280 | files = [] |
| 281 | for item in self.data_config["files"]: |
| 282 | file = item["problem_file"] |
| 283 | if file.endswith(".json") or file.endswith(".jsonl"): |
| 284 | if file in self.data_config["ignore"]: |
| 285 | continue |
| 286 | file_configs = [config for config in prediction if (config and config["file"] == file)] |
| 287 | print("File:", file, "Total:", len(file_configs), "Pass:", len([config for config in file_configs if "result" in config and config["result"]])) |
| 288 | files.append({ |
| 289 | "file": file, |
| 290 | "total": len(file_configs), |
| 291 | "pass": len([config for config in file_configs if "result" in config and config["result"]]), |
| 292 | "wrong": len([config for config in file_configs if "result" not in config or not config["result"]]), |
| 293 | }) |
| 294 | files[-1]["acc"] = files[-1]["pass"] / files[-1]["total"] if files[-1]["total"] else 0 |
| 295 | overall = { |
| 296 | "total": len([config for config in prediction if config]), |
| 297 | "pass": len([config for config in prediction if (config and "result" in config and config["result"])]), |
| 298 | } |
| 299 | overall["wrong"] = overall["total"] - overall["pass"] |
| 300 | overall["acc"] = overall["pass"] / overall["total"] if overall["total"] else 0 |
| 301 | return { |
| 302 | "files": files, |
| 303 | "overall": overall, |
| 304 | } |
| 305 | |
| 306 | @property |
| 307 | def metrics(self) -> Dict[str, Callable[[Dict, None], Any]]: |
nothing calls this directly
no outgoing calls
no test coverage detected