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

Function make_query_strategy

modAL/utils/combination.py:64–82  ·  view source on GitHub ↗

Takes the given utility measure and selector functions and makes a query strategy by combining them. Args: utility_measure: Utility measure, for instance :func:`~modAL.disagreement.vote_entropy`, but it can be a custom function as well. Should take a classifier and the

(utility_measure: Callable, selector: Callable)

Source from the content-addressed store, hash-verified

62
63
64def make_query_strategy(utility_measure: Callable, selector: Callable) -> Callable:
65 """
66 Takes the given utility measure and selector functions and makes a query strategy by combining them.
67
68 Args:
69 utility_measure: Utility measure, for instance :func:`~modAL.disagreement.vote_entropy`, but it can be a custom
70 function as well. Should take a classifier and the unlabelled data and should return an array containing the
71 utility scores.
72 selector: Function selecting instances for query. Should take an array of utility scores and should return an
73 array containing the queried items.
74
75 Returns:
76 A function which returns queried instances given a classifier and an unlabelled pool.
77 """
78 def query_strategy(classifier: BaseEstimator, X: modALinput) -> Tuple:
79 utility = utility_measure(classifier, X)
80 return selector(utility)
81
82 return query_strategy

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…