Finds the n_instances most informative point in the data provided by calling the query_strategy function. Args: X_pool: Pool of unlabeled instances to retrieve most informative instances from return_metrics: boolean to indicate, if the corresponding query me
(self, X_pool, return_metrics: bool = False, *query_args, **query_kwargs)
| 295 | return data_hstack([learner.transform_without_estimating(X) for learner in self.learner_list]) |
| 296 | |
| 297 | def query(self, X_pool, return_metrics: bool = False, *query_args, **query_kwargs) -> Union[Tuple, modALinput]: |
| 298 | """ |
| 299 | Finds the n_instances most informative point in the data provided by calling the query_strategy function. |
| 300 | |
| 301 | Args: |
| 302 | X_pool: Pool of unlabeled instances to retrieve most informative instances from |
| 303 | return_metrics: boolean to indicate, if the corresponding query metrics should be (not) returned |
| 304 | *query_args: The arguments for the query strategy. For instance, in the case of |
| 305 | :func:`~modAL.disagreement.max_disagreement_sampling`, it is the pool of samples from which the query. |
| 306 | strategy should choose instances to request labels. |
| 307 | **query_kwargs: Keyword arguments for the query strategy function. |
| 308 | |
| 309 | Returns: |
| 310 | Return value of the query_strategy function. Should be the indices of the instances from the pool chosen to |
| 311 | be labelled and the instances themselves. Can be different in other cases, for instance only the instance to |
| 312 | be labelled upon query synthesis. |
| 313 | query_metrics: returns also the corresponding metrics, if return_metrics == True |
| 314 | """ |
| 315 | |
| 316 | try: |
| 317 | query_result, query_metrics = self.query_strategy( |
| 318 | self, X_pool, *query_args, **query_kwargs) |
| 319 | |
| 320 | except: |
| 321 | query_metrics = None |
| 322 | query_result = self.query_strategy( |
| 323 | self, X_pool, *query_args, **query_kwargs) |
| 324 | |
| 325 | if return_metrics: |
| 326 | if query_metrics is None: |
| 327 | warnings.warn( |
| 328 | "The selected query strategy doesn't support return_metrics") |
| 329 | return query_result, retrieve_rows(X_pool, query_result), query_metrics |
| 330 | else: |
| 331 | return query_result, retrieve_rows(X_pool, query_result) |
| 332 | |
| 333 | def rebag(self, **fit_kwargs) -> None: |
| 334 | """ |
nothing calls this directly
no test coverage detected