skactiveml.stream.budgetmanager.SplitBudgetManager#
- class skactiveml.stream.budgetmanager.SplitBudgetManager(budget=None, w=100, theta=1.0, s=0.01, v=0.1, random_state=None)[source]#
Bases:
EstimatedBudgetZliobaite
Budget manager which checks, whether the specified budget has been exhausted already. If not, an instance is queried, when the utility is higher than the specified budget. 100*v% of instances will be queried randomly and in 100*(1-v)% of will be queried cases according to VariableUncertainty
This budget manager calculates the estimated budget spent in the last w steps and compares that to the budget. If the ratio is smaller than the specified budget, i.e., budget - u_t / w > 0 , the budget manager samples an instance when its utility is higher than the budget. u is the estimate of how many true lables were queried within the last w steps. The recursive funktion, u_t = u_t-1 * (w-1) / w + labeling_t , is used to calculate u at time t. See also
EstimatedBudgetZliobaite
- Parameters
- budgetfloat, optional (default=None)
Specifies the ratio of instances which are allowed to be queried, with 0 <= budget <= 1. See Also
BudgetManager
.- wint, optional (default=100)
Specifies the size of the memory window. Controlles the budget in the last w steps taken. Default = 100
- thetafloat, optional (default=1.0)
Specifies the starting threshold in wich instances are purchased. This value of theta will recalculated after each instance. Default = 1
- sfloat, optional (default=0.01)
Specifies the value in wich theta is decresed or increased based on the purchase of the given label. Default = 0.01
- vfloat, optional (default=0.1)
Specifies the percent value of instances queried randomly.
- random_stateint | np.random.RandomState, optional (default=None)
Random state for candidate selection.
See also
EstimatedBudgetZliobaite
BudgetManager implementing the base class for Zliobaite based budget managers
Methods
Get metadata routing of this object.
get_params
([deep])Get parameters for this estimator.
query_by_utility
(utilities)Ask the budget manager which utilities are sufficient to query the corresponding instance.
set_params
(**params)Set the parameters of this estimator.
update
(candidates, queried_indices)Updates the budget manager.
- 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.
- query_by_utility(utilities)[source]#
Ask the budget manager which utilities are sufficient to query the corresponding instance.
- Parameters
- utilitiesndarray of shape (n_samples,)
The utilities provided by the stream-based active learning strategy, which are used to determine whether sampling an instance is worth it given the budgeting constraint.
- Returns
- queried_indicesndarray of shape (n_queried_instances,)
The indices of instances represented by utilities which should be queried, with 0 <= n_queried_instances <= n_samples.
- 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.
- update(candidates, queried_indices)[source]#
Updates the budget manager.
- 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 of shape (n_samples,)
Indicates which instances from candidates have been queried.
- Returns
- selfSplitBudgetManager
The SplitBudget returns itself, after it is updated.