skactiveml.base.SingleAnnotatorStreamQueryStrategy#
- class skactiveml.base.SingleAnnotatorStreamQueryStrategy(budget, random_state=None)[source]#
Bases:
QueryStrategy
Base class for all stream-based active learning query strategies in scikit-activeml.
- Parameters
- budgetfloat, default=None
The budget which models the budgeting constraint used in the stream-based active learning setting.
- random_stateint, RandomState instance, default=None
Controls the randomness of the estimator.
Methods
Get metadata routing of this object.
get_params
([deep])Get parameters for this estimator.
query
(candidates, *args[, return_utilities])Ask the query strategy which instances in candidates to acquire.
set_params
(**params)Set the parameters of this estimator.
update
(candidates, queried_indices, *args[, ...])Update the query strategy with the decisions taken.
- get_metadata_routing()#
Get metadata routing of this object.
Please check User Guide on how the routing mechanism works.
- Returns
- routingMetadataRequest
A
MetadataRequest
encapsulating routing information.
- get_params(deep=True)#
Get parameters for this estimator.
- Parameters
- deepbool, default=True
If True, will return the parameters for this estimator and contained subobjects that are estimators.
- Returns
- paramsdict
Parameter names mapped to their values.
- abstract query(candidates, *args, return_utilities=False, **kwargs)[source]#
Ask the query strategy which instances in candidates to acquire.
The query startegy determines the most useful instances in candidates, which can be acquired within the budgeting constraint specified by the budgetmanager. Please note that, this method does not alter the internal state of the query strategy. To adapt the query strategy to the selected candidates, use update(…) with the selected candidates.
- Parameters
- candidates{array-like, sparse matrix} of shape
- (n_samples, n_features)
The instances which may be queried. Sparse matrices are accepted only if they are supported by the base query strategy.
- return_utilitiesbool, optional
If true, also return the utilities based on the query strategy. The default is False.
- Returns
- queried_indicesndarray of shape (n_sampled_instances,)
The indices of instances in candidates which should be sampled, with 0 <= n_sampled_instances <= n_samples.
- utilities: ndarray of shape (n_samples,), optional
The utilities based on the query strategy. Only provided if return_utilities is True.
- set_params(**params)#
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects (such as
Pipeline
). The latter have parameters of the form<component>__<parameter>
so that it’s possible to update each component of a nested object.- Parameters
- **paramsdict
Estimator parameters.
- Returns
- selfestimator instance
Estimator instance.
- abstract update(candidates, queried_indices, *args, budget_manager_param_dict=None, **kwargs)[source]#
Update the query strategy with the decisions taken.
This function should be used in conjunction with the query function, when the instances queried from query(…) may differ from the instances queried in the end. In this case use query(…) with simulate=true and provide the final decisions via update(…). This is especially helpful, when developing wrapper query strategies.
- Parameters
- candidates{array-like, sparse matrix} of shape
- (n_samples, n_features)
The instances which could be queried. Sparse matrices are accepted only if they are supported by the base query strategy.
- queried_indicesarray-like
Indicates which instances from candidates have been queried.
- budget_manager_param_dictkwargs, optional
Optional kwargs for budgetmanager.
- Returns
- ——-
- selfStreamBasedQueryStrategy
The StreamBasedQueryStrategy returns itself, after it is updated.
Examples using skactiveml.base.SingleAnnotatorStreamQueryStrategy
#

Cognitive Dual-Query Strategy with Random Sampling

Cognitive Dual-Query Strategy with Fixed-Uncertainty

Cognitive Dual-Query Strategy with Variable-Uncertainty

Cognitive Dual-Query Strategy with Randomized-Variable-Uncertainty