MCPcopy Create free account
hub / github.com/modAL-python/modAL / max_std_sampling

Function max_std_sampling

modAL/disagreement.py:186–211  ·  view source on GitHub ↗

Regressor standard deviation sampling strategy. Args: regressor: The regressor for which the labels are to be queried. X: The pool of samples to query from. n_instances: Number of samples to be queried. random_tie_break: If True, shuffles utility scores to r

(regressor: BaseEstimator, X: modALinput,
                     n_instances: int = 1,  random_tie_break=False,
                     **predict_kwargs)

Source from the content-addressed store, hash-verified

184
185
186def max_std_sampling(regressor: BaseEstimator, X: modALinput,
187 n_instances: int = 1, random_tie_break=False,
188 **predict_kwargs) -> np.ndarray:
189 """
190 Regressor standard deviation sampling strategy.
191
192 Args:
193 regressor: The regressor for which the labels are to be queried.
194 X: The pool of samples to query from.
195 n_instances: Number of samples to be queried.
196 random_tie_break: If True, shuffles utility scores to randomize the order. This
197 can be used to break the tie when the highest utility score is not unique.
198 **predict_kwargs: Keyword arguments to be passed to :meth:`predict` of the CommiteeRegressor.
199
200 Returns:
201 The indices of the instances from X chosen to be labelled.
202 The standard deviation of the chosen instances.
203
204 """
205 _, std = regressor.predict(X, return_std=True, **predict_kwargs)
206 std = std.reshape(X.shape[0], )
207
208 if not random_tie_break:
209 return multi_argmax(std, n_instances=n_instances)
210
211 return shuffled_argmax(std, n_instances=n_instances)

Callers

nothing calls this directly

Calls 3

multi_argmaxFunction · 0.90
shuffled_argmaxFunction · 0.90
predictMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…