skactiveml.stream.budgetmanager.DensityBasedSplitBudgetManager#
- class skactiveml.stream.budgetmanager.DensityBasedSplitBudgetManager(budget=None, theta=1.0, s=0.01, delta=1.0, random_state=None)[source]#
Bases:
BudgetManager
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 and when the probability of the most likely class exceeds a time-dependent threshold calculated based on the budget, the number of classes and the number of observed and acquired samples. This class`s logic is the same as compared to SplitBudgetManager except for how available budget is calculated.
This budget manager calculates the fixed budget spent and compares that to the budget. If the ratio is smaller than the specified budget, i.e., budget - u / t > 0 , the budget manager samples an instance when its utility is higher than the budget. u is the number of queried instances within t observed instances.
- Parameters
- budgetfloat, optional (default=None)
Specifies the ratio of instances which are allowed to be queried, with 0 <= budget <= 1. See Also
BudgetManager
.- 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
- deltafloat, optional (default=1.0)
Specifies the standart deviation of the distribution. Default 1.0
- 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
SplitBudgetManager
BudgetManager that is using EstimatedBudgetZliobaite.
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
- selfDensityBasedBudgetManager
The DensityBasedBudgetManager returns itself, after it is updated.