Query Decider (Implementation)#

alts.modules.query.query_decider
class AllQueryDecider[source]#

Bases: QueryDecider

Description
Always picks all query candidates.
decide(self, query_candidates, scores)[source]#
Description
Returns the list of candidates.
Decides always.
Parameters:
  • query_candidates (Iterable over NDArrays) – 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

class NoQueryDecider[source]#

Bases: QueryDecider

Description
Never picks any query candidates.
decide(self, query_candidates, scores)[source]#
Description
Returns 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

Description
Picks 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]#
Description
Returns 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

Description
Always picks the k best query candidates based on their score.
Parameters:

k (int) – How many queries to pick (default = 4)

decide(self, query_candidates, scores)[source]#
Description
Returns 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#