Policies
Base Interfaces
Policy interfaces and reusable policy state.
- class ActionValuePolicy[source]
Bases:
PolicyBase class for policies that estimate one value per action.
- recommend_action()[source]
Return the current best-arm recommendation without exploration.
- Return type:
- __init__(n_arms, initial_value=0.0)
- capabilities = PolicyCapabilities(contextual=False, reward_domains=frozenset({<RewardDomain.REAL: 'real'>, <RewardDomain.BINARY: 'binary'>, <RewardDomain.UNIT_INTERVAL: 'unit_interval'>}), objective=<PolicyObjective.CUMULATIVE_REWARD: 'cumulative_reward'>)
- clone()
Create a fresh policy with the same configuration.
The default deep-copies configuration and then resets learned state. Policies that own non-copyable resources must override this method.
- Return type:
- abstractmethod select_action(*, rng)
Choose an action index.
- class ContextualPolicy[source]
Bases:
ABCBase class for linear contextual bandit policies.
- capabilities = PolicyCapabilities(contextual=True, reward_domains=frozenset({<RewardDomain.REAL: 'real'>, <RewardDomain.BINARY: 'binary'>, <RewardDomain.UNIT_INTERVAL: 'unit_interval'>}), objective=<PolicyObjective.CUMULATIVE_REWARD: 'cumulative_reward'>)
- abstractmethod update(*, action, reward, context)[source]
Update policy state after a contextual reward.
- class Policy[source]
Bases:
ABCBase class for non-contextual bandit policies.
- capabilities = PolicyCapabilities(contextual=False, reward_domains=frozenset({<RewardDomain.REAL: 'real'>, <RewardDomain.BINARY: 'binary'>, <RewardDomain.UNIT_INTERVAL: 'unit_interval'>}), objective=<PolicyObjective.CUMULATIVE_REWARD: 'cumulative_reward'>)
- clone()[source]
Create a fresh policy with the same configuration.
The default deep-copies configuration and then resets learned state. Policies that own non-copyable resources must override this method.
- Return type:
- validate_positive(value, *, name, allow_zero=False)[source]
Validate a finite positive or non-negative scalar.
Classic Policies
Compatibility import for the Python reference greedy policy.
- class GreedyPolicy
Bases:
NativePolicyMixin,GreedyPolicyAlways select the action with the highest estimated value.
- __init__(*args, **kwargs)
- capabilities = PolicyCapabilities(contextual=False, reward_domains=frozenset({<RewardDomain.REAL: 'real'>, <RewardDomain.BINARY: 'binary'>, <RewardDomain.UNIT_INTERVAL: 'unit_interval'>}), objective=<PolicyObjective.CUMULATIVE_REWARD: 'cumulative_reward'>)
- clone()
Create a fresh policy with the same configuration.
The default deep-copies configuration and then resets learned state. Policies that own non-copyable resources must override this method.
- Return type:
- property configuration: Mapping[str, object]
Return immutable normalized constructor configuration.
- estimated_state_bytes()
Estimate Rust-owned state memory including reserved capacities.
- Return type:
- recommend_action(*, context=None)
Return the current best-arm recommendation without exploration.
- reset()
Reset learned state.
- Return type:
None
- select_action(*, rng, context=None)
Choose an action index.
- update(*, action, reward, context=None)
Update policy state after observing a reward.
Compatibility import for the Python reference random policy.
- class RandomPolicy
Bases:
NativePolicyMixin,RandomPolicySelect each action uniformly at random.
- __init__(*args, **kwargs)
- capabilities = PolicyCapabilities(contextual=False, reward_domains=frozenset({<RewardDomain.REAL: 'real'>, <RewardDomain.BINARY: 'binary'>, <RewardDomain.UNIT_INTERVAL: 'unit_interval'>}), objective=<PolicyObjective.CUMULATIVE_REWARD: 'cumulative_reward'>)
- clone()
Create a fresh policy with the same configuration.
The default deep-copies configuration and then resets learned state. Policies that own non-copyable resources must override this method.
- Return type:
- property configuration: Mapping[str, object]
Return immutable normalized constructor configuration.
- estimated_state_bytes()
Estimate Rust-owned state memory including reserved capacities.
- Return type:
- recommend_action(*, context=None)
Return the current best-arm recommendation without exploration.
- reset()
Reset learned state.
- Return type:
None
- select_action(*, rng, context=None)
Choose an action index.
- update(*, action, reward, context=None)
Update policy state after observing a reward.
Compatibility imports for Python reference epsilon-greedy policies.
- class DecayingEpsilonGreedyPolicy
Bases:
NativePolicyMixin,DecayingEpsilonGreedyPolicyEpsilon-greedy policy with a monotone exploration schedule.
The schedule is hyperbolic by default:
epsilon_t = min_epsilon + (initial_epsilon - min_epsilon) / (1 + decay_rate * t). This gives users an intuitive policy that explores heavily early and settles into exploitation without fully disabling exploration unlessmin_epsilonis set to zero.- __init__(*args, **kwargs)
- capabilities = PolicyCapabilities(contextual=False, reward_domains=frozenset({<RewardDomain.REAL: 'real'>, <RewardDomain.BINARY: 'binary'>, <RewardDomain.UNIT_INTERVAL: 'unit_interval'>}), objective=<PolicyObjective.CUMULATIVE_REWARD: 'cumulative_reward'>)
- clone()
Create a fresh policy with the same configuration.
The default deep-copies configuration and then resets learned state. Policies that own non-copyable resources must override this method.
- Return type:
- property configuration: Mapping[str, object]
Return immutable normalized constructor configuration.
- estimated_state_bytes()
Estimate Rust-owned state memory including reserved capacities.
- Return type:
- recommend_action(*, context=None)
Return the current best-arm recommendation without exploration.
- reset()
Reset learned state.
- Return type:
None
- select_action(*, rng, context=None)
Choose an action index.
- update(*, action, reward, context=None)
Update policy state after observing a reward.
- class EpsilonGreedyPolicy
Bases:
NativePolicyMixin,EpsilonGreedyPolicyExplore uniformly with probability epsilon, otherwise exploit.
- __init__(*args, **kwargs)
- capabilities = PolicyCapabilities(contextual=False, reward_domains=frozenset({<RewardDomain.REAL: 'real'>, <RewardDomain.BINARY: 'binary'>, <RewardDomain.UNIT_INTERVAL: 'unit_interval'>}), objective=<PolicyObjective.CUMULATIVE_REWARD: 'cumulative_reward'>)
- clone()
Create a fresh policy with the same configuration.
The default deep-copies configuration and then resets learned state. Policies that own non-copyable resources must override this method.
- Return type:
- property configuration: Mapping[str, object]
Return immutable normalized constructor configuration.
- estimated_state_bytes()
Estimate Rust-owned state memory including reserved capacities.
- Return type:
- recommend_action(*, context=None)
Return the current best-arm recommendation without exploration.
- reset()
Reset learned state.
- Return type:
None
- select_action(*, rng, context=None)
Choose an action index.
- update(*, action, reward, context=None)
Update policy state after observing a reward.
Compatibility import for the Python reference adversarial policy.
- class EXP3Policy
Bases:
NativePolicyMixin,EXP3PolicyEXP3 for adversarial rewards in
[0, 1].The policy maintains multiplicative weights over arms and updates the selected arm with an importance-weighted reward estimate.
gammamixes in uniform exploration and also serves as the default learning-rate scale.- __init__(*args, **kwargs)
- capabilities = PolicyCapabilities(contextual=False, reward_domains=frozenset({<RewardDomain.BINARY: 'binary'>, <RewardDomain.UNIT_INTERVAL: 'unit_interval'>}), objective=<PolicyObjective.CUMULATIVE_REWARD: 'cumulative_reward'>)
- clone()
Create a fresh policy with the same configuration.
The default deep-copies configuration and then resets learned state. Policies that own non-copyable resources must override this method.
- Return type:
- property configuration: Mapping[str, object]
Return immutable normalized constructor configuration.
- estimated_state_bytes()
Estimate Rust-owned state memory including reserved capacities.
- Return type:
- recommend_action(*, context=None)
Return the current best-arm recommendation without exploration.
- reset()
Reset learned state.
- Return type:
None
- select_action(*, rng, context=None)
Choose an action index.
- update(*, action, reward, context=None)
Update policy state after observing a reward.
Compatibility imports for Python reference pure-exploration policies.
- class MedianEliminationPolicy
Bases:
NativePolicyMixin,MedianEliminationPolicyMedian elimination for rewards bounded to the unit interval.
- __init__(*args, **kwargs)
- capabilities = PolicyCapabilities(contextual=False, reward_domains=frozenset({<RewardDomain.BINARY: 'binary'>, <RewardDomain.UNIT_INTERVAL: 'unit_interval'>}), objective=<PolicyObjective.BEST_ARM: 'best_arm'>)
- clone()
Create a fresh policy with the same configuration.
The default deep-copies configuration and then resets learned state. Policies that own non-copyable resources must override this method.
- Return type:
- property configuration: Mapping[str, object]
Return immutable normalized constructor configuration.
- estimated_state_bytes()
Estimate Rust-owned state memory including reserved capacities.
- Return type:
- recommend_action(*, context=None)
Return the current best-arm recommendation without exploration.
- reset()
Reset learned state.
- Return type:
None
- select_action(*, rng, context=None)
Choose an action index.
- update(*, action, reward, context=None)
Update policy state after observing a reward.
- class SuccessiveEliminationPolicy
Bases:
NativePolicyMixin,SuccessiveEliminationPolicySuccessive elimination for fixed-confidence best-arm identification.
- __init__(*args, **kwargs)
- capabilities = PolicyCapabilities(contextual=False, reward_domains=frozenset({<RewardDomain.REAL: 'real'>, <RewardDomain.BINARY: 'binary'>, <RewardDomain.UNIT_INTERVAL: 'unit_interval'>}), objective=<PolicyObjective.BEST_ARM: 'best_arm'>)
- clone()
Create a fresh policy with the same configuration.
The default deep-copies configuration and then resets learned state. Policies that own non-copyable resources must override this method.
- Return type:
- property configuration: Mapping[str, object]
Return immutable normalized constructor configuration.
- estimated_state_bytes()
Estimate Rust-owned state memory including reserved capacities.
- Return type:
- recommend_action(*, context=None)
Return the current best-arm recommendation without exploration.
- reset()
Reset learned state.
- Return type:
None
- select_action(*, rng, context=None)
Choose an action index.
- update(*, action, reward, context=None)
Update policy state after observing a reward.
Compatibility import for the Python reference softmax policy.
- class SoftmaxPolicy
Bases:
NativePolicyMixin,SoftmaxPolicySample actions according to a softmax over estimated values.
- __init__(*args, **kwargs)
- capabilities = PolicyCapabilities(contextual=False, reward_domains=frozenset({<RewardDomain.REAL: 'real'>, <RewardDomain.BINARY: 'binary'>, <RewardDomain.UNIT_INTERVAL: 'unit_interval'>}), objective=<PolicyObjective.CUMULATIVE_REWARD: 'cumulative_reward'>)
- clone()
Create a fresh policy with the same configuration.
The default deep-copies configuration and then resets learned state. Policies that own non-copyable resources must override this method.
- Return type:
- property configuration: Mapping[str, object]
Return immutable normalized constructor configuration.
- estimated_state_bytes()
Estimate Rust-owned state memory including reserved capacities.
- Return type:
- recommend_action(*, context=None)
Return the current best-arm recommendation without exploration.
- reset()
Reset learned state.
- Return type:
None
- select_action(*, rng, context=None)
Choose an action index.
- update(*, action, reward, context=None)
Update policy state after observing a reward.
Compatibility import for the Python reference gradient policy.
- class GradientBanditPolicy
Bases:
NativePolicyMixin,GradientBanditPolicyGradient bandit algorithm using action preferences.
- __init__(*args, **kwargs)
- capabilities = PolicyCapabilities(contextual=False, reward_domains=frozenset({<RewardDomain.REAL: 'real'>, <RewardDomain.BINARY: 'binary'>, <RewardDomain.UNIT_INTERVAL: 'unit_interval'>}), objective=<PolicyObjective.CUMULATIVE_REWARD: 'cumulative_reward'>)
- clone()
Create a fresh policy with the same configuration.
The default deep-copies configuration and then resets learned state. Policies that own non-copyable resources must override this method.
- Return type:
- property configuration: Mapping[str, object]
Return immutable normalized constructor configuration.
- estimated_state_bytes()
Estimate Rust-owned state memory including reserved capacities.
- Return type:
- recommend_action(*, context=None)
Return the current best-arm recommendation without exploration.
- reset()
Reset learned state.
- Return type:
None
- select_action(*, rng, context=None)
Choose an action index.
- update(*, action, reward, context=None)
Update policy state after observing a reward.
UCB and Bayesian Policies
Compatibility imports for Python reference UCB policies.
- class KLUCBPolicy
Bases:
NativePolicyMixin,KLUCBPolicyKL-UCB for Bernoulli rewards.
- __init__(*args, **kwargs)
- capabilities = PolicyCapabilities(contextual=False, reward_domains=frozenset({<RewardDomain.BINARY: 'binary'>}), objective=<PolicyObjective.CUMULATIVE_REWARD: 'cumulative_reward'>)
- clone()
Create a fresh policy with the same configuration.
The default deep-copies configuration and then resets learned state. Policies that own non-copyable resources must override this method.
- Return type:
- property configuration: Mapping[str, object]
Return immutable normalized constructor configuration.
- estimated_state_bytes()
Estimate Rust-owned state memory including reserved capacities.
- Return type:
- recommend_action(*, context=None)
Return the current best-arm recommendation without exploration.
- reset()
Reset learned state.
- Return type:
None
- select_action(*, rng, context=None)
Choose an action index.
- update(*, action, reward, context=None)
Update policy state after observing a reward.
- class MOSSPolicy
Bases:
NativePolicyMixin,MOSSPolicyMinimax Optimal Strategy in the Stochastic case (MOSS).
- __init__(*args, **kwargs)
- capabilities = PolicyCapabilities(contextual=False, reward_domains=frozenset({<RewardDomain.REAL: 'real'>, <RewardDomain.BINARY: 'binary'>, <RewardDomain.UNIT_INTERVAL: 'unit_interval'>}), objective=<PolicyObjective.CUMULATIVE_REWARD: 'cumulative_reward'>)
- clone()
Create a fresh policy with the same configuration.
The default deep-copies configuration and then resets learned state. Policies that own non-copyable resources must override this method.
- Return type:
- property configuration: Mapping[str, object]
Return immutable normalized constructor configuration.
- estimated_state_bytes()
Estimate Rust-owned state memory including reserved capacities.
- Return type:
- recommend_action(*, context=None)
Return the current best-arm recommendation without exploration.
- reset()
Reset learned state.
- Return type:
None
- select_action(*, rng, context=None)
Choose an action index.
- update(*, action, reward, context=None)
Update policy state after observing a reward.
- class UCBPolicy
Bases:
NativePolicyMixin,UCBPolicyUCB1 policy for stationary sub-Gaussian rewards.
- __init__(*args, **kwargs)
- capabilities = PolicyCapabilities(contextual=False, reward_domains=frozenset({<RewardDomain.REAL: 'real'>, <RewardDomain.BINARY: 'binary'>, <RewardDomain.UNIT_INTERVAL: 'unit_interval'>}), objective=<PolicyObjective.CUMULATIVE_REWARD: 'cumulative_reward'>)
- clone()
Create a fresh policy with the same configuration.
The default deep-copies configuration and then resets learned state. Policies that own non-copyable resources must override this method.
- Return type:
- property configuration: Mapping[str, object]
Return immutable normalized constructor configuration.
- estimated_state_bytes()
Estimate Rust-owned state memory including reserved capacities.
- Return type:
- recommend_action(*, context=None)
Return the current best-arm recommendation without exploration.
- reset()
Reset learned state.
- Return type:
None
- select_action(*, rng, context=None)
Choose an action index.
- update(*, action, reward, context=None)
Update policy state after observing a reward.
Compatibility imports for Python reference Thompson-sampling policies.
- class BernoulliThompsonSamplingPolicy
Bases:
NativePolicyMixin,BernoulliThompsonSamplingPolicyThompson sampling with Beta-Bernoulli posteriors.
- __init__(*args, **kwargs)
- capabilities = PolicyCapabilities(contextual=False, reward_domains=frozenset({<RewardDomain.BINARY: 'binary'>}), objective=<PolicyObjective.CUMULATIVE_REWARD: 'cumulative_reward'>)
- clone()
Create a fresh policy with the same configuration.
The default deep-copies configuration and then resets learned state. Policies that own non-copyable resources must override this method.
- Return type:
- property configuration: Mapping[str, object]
Return immutable normalized constructor configuration.
- estimated_state_bytes()
Estimate Rust-owned state memory including reserved capacities.
- Return type:
- recommend_action(*, context=None)
Return the current best-arm recommendation without exploration.
- reset()
Reset learned state.
- Return type:
None
- select_action(*, rng, context=None)
Choose an action index.
- update(*, action, reward, context=None)
Update policy state after observing a reward.
- class GaussianThompsonSamplingPolicy
Bases:
NativePolicyMixin,GaussianThompsonSamplingPolicyThompson sampling for Gaussian rewards with known observation variance.
- __init__(*args, **kwargs)
- capabilities = PolicyCapabilities(contextual=False, reward_domains=frozenset({<RewardDomain.REAL: 'real'>, <RewardDomain.BINARY: 'binary'>, <RewardDomain.UNIT_INTERVAL: 'unit_interval'>}), objective=<PolicyObjective.CUMULATIVE_REWARD: 'cumulative_reward'>)
- clone()
Create a fresh policy with the same configuration.
The default deep-copies configuration and then resets learned state. Policies that own non-copyable resources must override this method.
- Return type:
- property configuration: Mapping[str, object]
Return immutable normalized constructor configuration.
- estimated_state_bytes()
Estimate Rust-owned state memory including reserved capacities.
- Return type:
- recommend_action(*, context=None)
Return the current best-arm recommendation without exploration.
- reset()
Reset learned state.
- Return type:
None
- select_action(*, rng, context=None)
Choose an action index.
- update(*, action, reward, context=None)
Update policy state after observing a reward.
Compatibility imports for the Python reference Bayesian-UCB policies.
- class BernoulliBayesianUCBPolicy
Bases:
NativePolicyMixin,BernoulliBayesianUCBPolicyBayesian UCB using Beta posterior quantiles.
- __init__(*args, **kwargs)
- capabilities = PolicyCapabilities(contextual=False, reward_domains=frozenset({<RewardDomain.BINARY: 'binary'>}), objective=<PolicyObjective.CUMULATIVE_REWARD: 'cumulative_reward'>)
- clone()
Create a fresh policy with the same configuration.
The default deep-copies configuration and then resets learned state. Policies that own non-copyable resources must override this method.
- Return type:
- property configuration: Mapping[str, object]
Return immutable normalized constructor configuration.
- estimated_state_bytes()
Estimate Rust-owned state memory including reserved capacities.
- Return type:
- recommend_action(*, context=None)
Return the current best-arm recommendation without exploration.
- reset()
Reset learned state.
- Return type:
None
- select_action(*, rng, context=None)
Choose an action index.
- update(*, action, reward, context=None)
Update policy state after observing a reward.
- class GaussianBayesianUCBPolicy
Bases:
NativePolicyMixin,GaussianBayesianUCBPolicyBayesian UCB for Gaussian rewards with known observation variance.
- __init__(*args, **kwargs)
- capabilities = PolicyCapabilities(contextual=False, reward_domains=frozenset({<RewardDomain.REAL: 'real'>, <RewardDomain.BINARY: 'binary'>, <RewardDomain.UNIT_INTERVAL: 'unit_interval'>}), objective=<PolicyObjective.CUMULATIVE_REWARD: 'cumulative_reward'>)
- clone()
Create a fresh policy with the same configuration.
The default deep-copies configuration and then resets learned state. Policies that own non-copyable resources must override this method.
- Return type:
- property configuration: Mapping[str, object]
Return immutable normalized constructor configuration.
- estimated_state_bytes()
Estimate Rust-owned state memory including reserved capacities.
- Return type:
- recommend_action(*, context=None)
Return the current best-arm recommendation without exploration.
- reset()
Reset learned state.
- Return type:
None
- select_action(*, rng, context=None)
Choose an action index.
- update(*, action, reward, context=None)
Update policy state after observing a reward.
Non-stationary Policies
Compatibility imports for Python reference non-stationary policies.
- class DiscountedBernoulliThompsonSamplingPolicy
Bases:
NativePolicyMixin,DiscountedBernoulliThompsonSamplingPolicyBeta-Bernoulli Thompson Sampling with exponential forgetting.
- __init__(*args, **kwargs)
- capabilities = PolicyCapabilities(contextual=False, reward_domains=frozenset({<RewardDomain.BINARY: 'binary'>}), objective=<PolicyObjective.CUMULATIVE_REWARD: 'cumulative_reward'>)
- clone()
Create a fresh policy with the same configuration.
The default deep-copies configuration and then resets learned state. Policies that own non-copyable resources must override this method.
- Return type:
- property configuration: Mapping[str, object]
Return immutable normalized constructor configuration.
- estimated_state_bytes()
Estimate Rust-owned state memory including reserved capacities.
- Return type:
- recommend_action(*, context=None)
Return the current best-arm recommendation without exploration.
- reset()
Reset learned state.
- Return type:
None
- select_action(*, rng, context=None)
Choose an action index.
- update(*, action, reward, context=None)
Update policy state after observing a reward.
- class DiscountedUCBPolicy
Bases:
NativePolicyMixin,DiscountedUCBPolicyUCB with exponentially discounted counts and estimates.
- __init__(*args, **kwargs)
- capabilities = PolicyCapabilities(contextual=False, reward_domains=frozenset({<RewardDomain.REAL: 'real'>, <RewardDomain.BINARY: 'binary'>, <RewardDomain.UNIT_INTERVAL: 'unit_interval'>}), objective=<PolicyObjective.CUMULATIVE_REWARD: 'cumulative_reward'>)
- clone()
Create a fresh policy with the same configuration.
The default deep-copies configuration and then resets learned state. Policies that own non-copyable resources must override this method.
- Return type:
- property configuration: Mapping[str, object]
Return immutable normalized constructor configuration.
- estimated_state_bytes()
Estimate Rust-owned state memory including reserved capacities.
- Return type:
- recommend_action(*, context=None)
Return the current best-arm recommendation without exploration.
- reset()
Reset learned state.
- Return type:
None
- select_action(*, rng, context=None)
Choose an action index.
- update(*, action, reward, context=None)
Update policy state after observing a reward.
- class SlidingWindowBernoulliThompsonSamplingPolicy
Bases:
NativePolicyMixin,SlidingWindowBernoulliThompsonSamplingPolicyBeta-Bernoulli sampling over the most recent global time steps.
- __init__(*args, **kwargs)
- capabilities = PolicyCapabilities(contextual=False, reward_domains=frozenset({<RewardDomain.BINARY: 'binary'>}), objective=<PolicyObjective.CUMULATIVE_REWARD: 'cumulative_reward'>)
- clone()
Create a fresh policy with the same configuration.
The default deep-copies configuration and then resets learned state. Policies that own non-copyable resources must override this method.
- Return type:
- property configuration: Mapping[str, object]
Return immutable normalized constructor configuration.
- estimated_state_bytes()
Estimate Rust-owned state memory including reserved capacities.
- Return type:
- recommend_action(*, context=None)
Return the current best-arm recommendation without exploration.
- reset()
Reset learned state.
- Return type:
None
- select_action(*, rng, context=None)
Choose an action index.
- update(*, action, reward, context=None)
Update policy state after observing a reward.
- class SlidingWindowUCBPolicy
Bases:
NativePolicyMixin,SlidingWindowUCBPolicyUCB over observations from the most recent global time steps.
- __init__(*args, **kwargs)
- capabilities = PolicyCapabilities(contextual=False, reward_domains=frozenset({<RewardDomain.REAL: 'real'>, <RewardDomain.BINARY: 'binary'>, <RewardDomain.UNIT_INTERVAL: 'unit_interval'>}), objective=<PolicyObjective.CUMULATIVE_REWARD: 'cumulative_reward'>)
- clone()
Create a fresh policy with the same configuration.
The default deep-copies configuration and then resets learned state. Policies that own non-copyable resources must override this method.
- Return type:
- property configuration: Mapping[str, object]
Return immutable normalized constructor configuration.
- estimated_state_bytes()
Estimate Rust-owned state memory including reserved capacities.
- Return type:
- recommend_action(*, context=None)
Return the current best-arm recommendation without exploration.
- reset()
Reset learned state.
- Return type:
None
- select_action(*, rng, context=None)
Choose an action index.
- update(*, action, reward, context=None)
Update policy state after observing a reward.
Compatibility imports for Python reference change-detection policies.
- class CUSUMUCBPolicy
Bases:
NativePolicyMixin,CUSUMUCBPolicyCUSUM-triggered resetting UCB.
- __init__(*args, **kwargs)
- capabilities = PolicyCapabilities(contextual=False, reward_domains=frozenset({<RewardDomain.REAL: 'real'>, <RewardDomain.BINARY: 'binary'>, <RewardDomain.UNIT_INTERVAL: 'unit_interval'>}), objective=<PolicyObjective.CUMULATIVE_REWARD: 'cumulative_reward'>)
- clone()
Create a fresh policy with the same configuration.
The default deep-copies configuration and then resets learned state. Policies that own non-copyable resources must override this method.
- Return type:
- property configuration: Mapping[str, object]
Return immutable normalized constructor configuration.
- estimated_state_bytes()
Estimate Rust-owned state memory including reserved capacities.
- Return type:
- recommend_action(*, context=None)
Return the current best-arm recommendation without exploration.
- reset()
Reset learned state.
- Return type:
None
- select_action(*, rng, context=None)
Choose an action index.
- update(*, action, reward, context=None)
Update policy state after observing a reward.
- class ChangePointUCBPolicy
Bases:
NativePolicyMixin,ChangePointUCBPolicyUCB with per-arm change detection and local arm resets.
- __init__(*args, **kwargs)
- capabilities = PolicyCapabilities(contextual=False, reward_domains=frozenset({<RewardDomain.REAL: 'real'>, <RewardDomain.BINARY: 'binary'>, <RewardDomain.UNIT_INTERVAL: 'unit_interval'>}), objective=<PolicyObjective.CUMULATIVE_REWARD: 'cumulative_reward'>)
- clone()
Create a fresh policy with the same configuration.
The default deep-copies configuration and then resets learned state. Policies that own non-copyable resources must override this method.
- Return type:
- property configuration: Mapping[str, object]
Return immutable normalized constructor configuration.
- estimated_state_bytes()
Estimate Rust-owned state memory including reserved capacities.
- Return type:
- recommend_action(*, context=None)
Return the current best-arm recommendation without exploration.
- reset()
Reset learned state.
- Return type:
None
- select_action(*, rng, context=None)
Choose an action index.
- update(*, action, reward, context=None)
Update policy state after observing a reward.
- class PageHinkleyUCBPolicy
Bases:
NativePolicyMixin,PageHinkleyUCBPolicyPage-Hinkley-triggered resetting UCB.
- __init__(*args, **kwargs)
- capabilities = PolicyCapabilities(contextual=False, reward_domains=frozenset({<RewardDomain.REAL: 'real'>, <RewardDomain.BINARY: 'binary'>, <RewardDomain.UNIT_INTERVAL: 'unit_interval'>}), objective=<PolicyObjective.CUMULATIVE_REWARD: 'cumulative_reward'>)
- clone()
Create a fresh policy with the same configuration.
The default deep-copies configuration and then resets learned state. Policies that own non-copyable resources must override this method.
- Return type:
- property configuration: Mapping[str, object]
Return immutable normalized constructor configuration.
- estimated_state_bytes()
Estimate Rust-owned state memory including reserved capacities.
- Return type:
- recommend_action(*, context=None)
Return the current best-arm recommendation without exploration.
- reset()
Reset learned state.
- Return type:
None
- select_action(*, rng, context=None)
Choose an action index.
- update(*, action, reward, context=None)
Update policy state after observing a reward.
Contextual Policies
Compatibility imports for Python reference contextual policies.
- class LinearEpsilonGreedyPolicy
Bases:
NativePolicyMixin,LinearEpsilonGreedyPolicyLinear contextual policy with epsilon-greedy exploration.
- __init__(*args, **kwargs)
- capabilities = PolicyCapabilities(contextual=True, reward_domains=frozenset({<RewardDomain.REAL: 'real'>, <RewardDomain.BINARY: 'binary'>, <RewardDomain.UNIT_INTERVAL: 'unit_interval'>}), objective=<PolicyObjective.CUMULATIVE_REWARD: 'cumulative_reward'>)
- clone()
Create a fresh policy with the same immutable configuration.
- Return type:
- property configuration: Mapping[str, object]
Return immutable normalized constructor configuration.
- estimated_state_bytes()
Estimate Rust-owned state memory including reserved capacities.
- Return type:
- recommend_action(*, context=None)
Return the current recommendation without exploratory sampling.
- reset()
Reset learned state.
- Return type:
None
- select_action(*, rng, context=None)
Choose an action index for a context matrix.
- update(*, action, reward, context=None)
Update policy state after a contextual reward.
- class LinearThompsonSamplingPolicy
Bases:
NativePolicyMixin,LinearThompsonSamplingPolicyBayesian linear Thompson Sampling for contextual bandits.
- __init__(*args, **kwargs)
- capabilities = PolicyCapabilities(contextual=True, reward_domains=frozenset({<RewardDomain.REAL: 'real'>, <RewardDomain.BINARY: 'binary'>, <RewardDomain.UNIT_INTERVAL: 'unit_interval'>}), objective=<PolicyObjective.CUMULATIVE_REWARD: 'cumulative_reward'>)
- clone()
Create a fresh policy with the same immutable configuration.
- Return type:
- property configuration: Mapping[str, object]
Return immutable normalized constructor configuration.
- estimated_state_bytes()
Estimate Rust-owned state memory including reserved capacities.
- Return type:
- recommend_action(*, context=None)
Return the current recommendation without exploratory sampling.
- reset()
Reset learned state.
- Return type:
None
- select_action(*, rng, context=None)
Choose an action index for a context matrix.
- update(*, action, reward, context=None)
Update policy state after a contextual reward.
- class LinUCBPolicy
Bases:
NativePolicyMixin,LinUCBPolicyDisjoint linear UCB for contextual bandits.
- __init__(*args, **kwargs)
- capabilities = PolicyCapabilities(contextual=True, reward_domains=frozenset({<RewardDomain.REAL: 'real'>, <RewardDomain.BINARY: 'binary'>, <RewardDomain.UNIT_INTERVAL: 'unit_interval'>}), objective=<PolicyObjective.CUMULATIVE_REWARD: 'cumulative_reward'>)
- clone()
Create a fresh policy with the same immutable configuration.
- Return type:
- property configuration: Mapping[str, object]
Return immutable normalized constructor configuration.
- estimated_state_bytes()
Estimate Rust-owned state memory including reserved capacities.
- Return type:
- recommend_action(*, context=None)
Return the current recommendation without exploratory sampling.
- reset()
Reset learned state.
- Return type:
None
- select_action(*, rng, context=None)
Choose an action index for a context matrix.
- update(*, action, reward, context=None)
Update policy state after a contextual reward.
- class LogisticContextualBanditPolicy
Bases:
NativePolicyMixin,LogisticContextualBanditPolicyOnline logistic contextual bandit for Bernoulli rewards.
Each arm has an independent logistic model. The policy predicts click or conversion probability for each arm, explores with epsilon-greedy sampling, and updates the selected arm using one stochastic-gradient step.
- __init__(*args, **kwargs)
- capabilities = PolicyCapabilities(contextual=True, reward_domains=frozenset({<RewardDomain.BINARY: 'binary'>}), objective=<PolicyObjective.CUMULATIVE_REWARD: 'cumulative_reward'>)
- clone()
Create a fresh policy with the same immutable configuration.
- Return type:
- property configuration: Mapping[str, object]
Return immutable normalized constructor configuration.
- estimated_state_bytes()
Estimate Rust-owned state memory including reserved capacities.
- Return type:
- recommend_action(*, context=None)
Return the current recommendation without exploratory sampling.
- reset()
Reset learned state.
- Return type:
None
- select_action(*, rng, context=None)
Choose an action index for a context matrix.
- update(*, action, reward, context=None)
Update policy state after a contextual reward.