Query Decider (Implementation)#
- class AllQueryDecider[source]#
Bases:
QueryDecider
DescriptionAlways picks all query candidates.
- class NoQueryDecider[source]#
Bases:
QueryDecider
DescriptionNever picks any query candidates.- decide(self, query_candidates, scores)[source]#
- DescriptionReturns an empty query_candidates list.Decides never.
- Parameters:
query_candidates – A list of queries to choose from
scores – A list of scores associated to the queries in
query_candidates
(Not used here)
- Returns:
False, Empty list of queries
- Return type:
boolean, Iterable over NDArrays
- class ThresholdQueryDecider(threshold)[source]#
Bases:
QueryDecider
DescriptionPicks all query candidates that have a score above a certain threshold.- Parameters:
threshold – The threshold the query candidates have to exceed (defaults = 0.5)
- decide(self, query_candidates, scores)[source]#
- DescriptionReturns all query candidates with a score above the threshold.Decides only if there are any query candidates fulfilling this requirement.
- Parameters:
query_candidates – A list of queries to choose from
scores – A list of scores associated to the queries in
query_candidates
(Not used here)
- Returns:
Whether it wants to decide, List of query candidates above the threshold
- Return type:
boolean, Iterable over NDArrays
- threshold: float = 0.5#
- class TopKQueryDecider(k)[source]#
Bases:
QueryDecider
DescriptionAlways picks thek
best query candidates based on their score.- Parameters:
k (int) – How many queries to pick (default = 4)
- decide(self, query_candidates, scores)[source]#
- DescriptionReturns the
k
query candidates with the highest scores.Decides always.- Parameters:
query_candidates – A list of queries to choose from
scores – A list of scores associated to the queries in
query_candidates
(Not used here)
- Returns:
True, query_candidates
- Return type:
boolean, Iterable over NDArrays
- k: int = 4#