(self)
| 161 | print(f"Results saved to {final_info_path}") |
| 162 | |
| 163 | async def run(self) -> float: |
| 164 | # Run experiment and return accuracy |
| 165 | print(f"Running {self.mode} experiment on {self.dataset} dataset from index {self.start} to {self.end}") |
| 166 | |
| 167 | # Load test set |
| 168 | testset = load_data(self.dataset, "test")[self.start:self.end] |
| 169 | results = await self.gather_results(testset) |
| 170 | |
| 171 | # Build results |
| 172 | json_obj = [self.construct_entry(result, data) for result, data in zip(results, testset)] |
| 173 | accuracy = sum(entry["score"] for entry in json_obj) / len(json_obj) |
| 174 | |
| 175 | # Save detailed results |
| 176 | detailed_log_file = os.path.join(os.path.dirname(os.path.dirname(__file__)), "detailed_results.json") |
| 177 | save_json(detailed_log_file, json_obj) |
| 178 | print(f"Detailed results saved to {detailed_log_file}") |
| 179 | |
| 180 | # Save final_info.json |
| 181 | self.save_final_info(accuracy) |
| 182 | |
| 183 | # Print result summary |
| 184 | print(f"Unsolved: {round((1-accuracy) * len(json_obj))}") |
| 185 | print(f"Accuracy: {accuracy:.4f}") |
| 186 | print(f"Time taken: {duration_formatter(time.time() - self.timestamp)}") |
| 187 | |
| 188 | return accuracy |
| 189 | |
| 190 | |
| 191 | async def optimize_dataset(dataset: str, model: str, start: int = 0, end: int = -1): |
no test coverage detected