Warm-up the predictions cache by making some model calls.
(self,
rate: float,
progress_indicator: Optional[ProgressIndicator] = None)
| 809 | self._models[model], datasets_to_validate[dataset], report_all) |
| 810 | |
| 811 | def _warm_start(self, |
| 812 | rate: float, |
| 813 | progress_indicator: Optional[ProgressIndicator] = None): |
| 814 | """Warm-up the predictions cache by making some model calls.""" |
| 815 | assert rate >= 0 and rate <= 1 |
| 816 | for model, model_info in self._info['models'].items(): |
| 817 | for dataset_name in model_info['datasets']: |
| 818 | logging.info("Warm-start of model '%s' on dataset '%s'", model, |
| 819 | dataset_name) |
| 820 | all_examples: list[IndexedInput] = self._get_dataset([], dataset_name) |
| 821 | if rate < 1: |
| 822 | examples = random.sample(all_examples, int(len(all_examples) * rate)) |
| 823 | logging.info('Partial warm-start: running on %d/%d examples.', |
| 824 | len(examples), len(all_examples)) |
| 825 | else: |
| 826 | examples = all_examples |
| 827 | _ = self._get_preds(data={'inputs': examples}, |
| 828 | model=model, |
| 829 | progress_indicator=progress_indicator) |
| 830 | |
| 831 | def _warm_projections(self, interpreters: list[str]): |
| 832 | """Pre-compute UMAP/PCA projections with default arguments.""" |
no test coverage detected