BudgetManager#
- class skactiveml.base.BudgetManager(budget=None)[source]#
Bases:
ABC,BaseEstimatorBase class for all budget managers for stream-based active learning to model budgeting constraints.
- Parameters:
- budgetfloat, default=None
Specifies the ratio of samples which are allowed to be sampled, with 0 < budget <= 1. If budget is None, it is replaced with the default budget 0.1.
Methods
query_by_utility(utilities, *args, **kwargs)Ask the budget manager which utilities are sufficient to query the corresponding labels.
update(candidates, queried_indices, *args, ...)Updates the budget manager.
Get metadata routing of this object.
get_params([deep])Get parameters for this estimator.
set_params(**params)Set the parameters of this estimator.
- abstract BudgetManager.query_by_utility(utilities, *args, **kwargs)[source]#
Ask the budget manager which utilities are sufficient to query the corresponding labels.
The first call may initialize the manager. Once initialized, querying must leave its acquisition state unchanged, including counters, thresholds, histories, and random state. Repeated calls with the same utilities and parameters must return the same indices until update advances that state.
- Parameters:
- utilitiesnp.ndarray of shape (n_samples,)
The utilities provided by the stream-based active learning strategy, which are used to determine whether querying a sample is worth it given the budgeting constraint.
- Returns:
- queried_indiceslist of int or ndarray of shape (n_queried_indices,)
The indices of samples in candidates whose labels are queried, with 0 <= queried_indices < n_samples.
- abstract BudgetManager.update(candidates, queried_indices, *args, **kwargs)[source]#
Updates the budget manager.
If called before query_by_utility, this method must also initialize all state required for subsequent queries.
- Parameters:
- candidates{array-like, sparse matrix} of shape (n_candidates, n_features)
The samples which may be queried. Sparse matrices are accepted only if they are supported by the base query strategy.
- queried_indicesarray-like of shape (n_queried_indices,)
The indices of samples in candidates whose labels are queried, with 0 <= queried_indices < n_candidates.
- Returns:
- selfBudgetManager
The budget manager returns itself, after it is updated.
- BudgetManager.get_metadata_routing()#
Get metadata routing of this object.
Please check User Guide on how the routing mechanism works.
- Returns:
- routingMetadataRequest
A
MetadataRequestencapsulating routing information.
- BudgetManager.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.
- BudgetManager.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.