actsnclass.random_sampling

actsnclass.random_sampling(test_ids: numpy.array, queryable_ids: numpy.array, batch=1, queryable=False, query_thre=1.0, seed=42) → list

Randomly choose an object from the test sample.

Parameters:
  • test_ids (np.array) – Set of ids for objects in the test sample.
  • queryable_ids (np.array) – Set of ids for objects available for querying.
  • batch (int (optional)) – Number of objects to be chosen in each batch query. Default is 1.
  • queryable (bool (optional)) – If True, check if randomly chosen object is queryable. Default is False.
  • query_thre (float (optinal)) – Threshold where a query is considered worth it. Default is 1.0 (no limit).
  • seed (int (optional)) – Seed for random number generator. Default is 42.
Returns:

query_indx – List of indexes identifying the objects from the test sample to be queried. If there are less queryable objects than the required batch it will return only the available objects – so the list of objects to query can be smaller than ‘batch’.

Return type:

list