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, *query_args, return_metrics: bool = False, **query_kwargs)
| 153 | return self.estimator.predict_proba(X, **predict_proba_kwargs) |
| 154 | |
| 155 | def query(self, X_pool, *query_args, return_metrics: bool = False, **query_kwargs) -> Union[Tuple, modALinput]: |
| 156 | """ |
| 157 | Finds the n_instances most informative point in the data provided by calling the query_strategy function. |
| 158 | |
| 159 | Args: |
| 160 | X_pool: Pool of unlabeled instances to retrieve most informative instances from |
| 161 | return_metrics: boolean to indicate, if the corresponding query metrics should be (not) returned |
| 162 | *query_args: The arguments for the query strategy. For instance, in the case of |
| 163 | :func:`~modAL.uncertainty.uncertainty_sampling`, it is the pool of samples from which the query strategy |
| 164 | should choose instances to request labels. |
| 165 | **query_kwargs: Keyword arguments for the query strategy function. |
| 166 | |
| 167 | Returns: |
| 168 | Value of the query_strategy function. Should be the indices of the instances from the pool chosen to be |
| 169 | labelled and the instances themselves. Can be different in other cases, for instance only the instance to be |
| 170 | labelled upon query synthesis. |
| 171 | query_metrics: returns also the corresponding metrics, if return_metrics == True |
| 172 | """ |
| 173 | |
| 174 | try: |
| 175 | query_result, query_metrics = self.query_strategy( |
| 176 | self, X_pool, *query_args, **query_kwargs) |
| 177 | |
| 178 | except: |
| 179 | query_metrics = None |
| 180 | query_result = self.query_strategy( |
| 181 | self, X_pool, *query_args, **query_kwargs) |
| 182 | |
| 183 | if return_metrics: |
| 184 | if query_metrics is None: |
| 185 | warnings.warn( |
| 186 | "The selected query strategy doesn't support return_metrics") |
| 187 | return query_result, retrieve_rows(X_pool, query_result), query_metrics |
| 188 | else: |
| 189 | return query_result, retrieve_rows(X_pool, query_result) |
| 190 | |
| 191 | def score(self, X: modALinput, y: modALinput, **score_kwargs) -> Any: |
| 192 | """ |