(self, agent: Agent, already_runs: List[Any]=None)
| 82 | pass |
| 83 | |
| 84 | def evaluate(self, agent: Agent, already_runs: List[Any]=None) -> Dict[str, Any]: |
| 85 | print(f"Evaluating task '{self.name}' ...") |
| 86 | data = self.get_data() |
| 87 | inputs = data.get_inputs() |
| 88 | targets = data.get_targets() |
| 89 | try: |
| 90 | results = self.predict_all(agent, inputs, already_runs) |
| 91 | except: |
| 92 | results = self.predict_all(agent, inputs) |
| 93 | # print(results) |
| 94 | # print(type(results)) |
| 95 | result_dict = {} |
| 96 | for metric in self.metrics: |
| 97 | result_dict[metric] = self.metrics[metric](results, targets) |
| 98 | print(f"Task '{self.name}' evaluation finished. The results are saved in '{self.get_output_dir()}'") |
| 99 | self.save_runs_all(inputs, results, targets, result_dict) |
| 100 | return result_dict |
| 101 | |
| 102 | def predict_all(self, agent: Agent, inputs: List[T_INPUT], already_runs: List[Any]=None) -> List[T_OUTPUT]: |
| 103 | print(f"Start Predicting All ...") |
no test coverage detected