query_strategy.cost_sensitive. QueryCostSensitiveRandom

query_strategy.cost_sensitive.QueryCostSensitiveRandom()

Randomly selects a batch of instance-label pairs.

Methods

query_strategy.cost_sensitive.QueryCostSensitiveRandom. select

query_strategy.cost_sensitive.QueryCostSensitiveRandom.select(unlabel_index, oracle, cost, budget=40)

Randomly selects a batch of instance-label pairs under the constraints of meeting the budget conditions.

Parameters:
unlabel_index: {list, np.ndarray, MultiLabelIndexCollection}
The indexes of unlabeled samples. It should be a 1d array of indexes (column major, start from 0) or
MultiLabelIndexCollection or a list of tuples with 2 elements, in which,
the 1st element is the index of instance and the 2nd element is the index of labels.
oracle: Oracle,(default=None)
Oracle indicate the cost for each label.
Oracle in active learning whose role is to label the given query.And it can also give the cost of
each corresponding label.The Oracle includes the label and cost information at least.
Oracle(labels=labels, cost=cost)
cost: np.array, (default=None), shape [1, n_classes] or [n_classes]
The costs of querying each class.if not provide,it will all be 1.
budget: int, optional (default=40)
The budget of the select cost.If cost for eatch labels is 1,will degenerate into the batch_size.
Returns:
selected_ins_lab_pair: list
A list of tuples that contains the indexes of selected instance-label pairs.

Copyright © 2018, alipy developers (BSD 3 License).