Class: SkiftetStatistical::Policies::Base
- Inherits:
-
Object
- Object
- SkiftetStatistical::Policies::Base
- Defined in:
- lib/skiftet_statistical/policies/base.rb
Overview
A selection policy decides which arm to pull next from the current stats.
Subclasses implement #choose(arms), returning the chosen Arm.
Direct Known Subclasses
Instance Method Summary collapse
-
#choose(_arms) ⇒ Object
Pick an arm.
-
#to_h ⇒ Object
Serialisable config (so a Bandit can describe its policy).
Instance Method Details
#choose(_arms) ⇒ Object
Pick an arm. arms is a non-empty Array
9 10 11 |
# File 'lib/skiftet_statistical/policies/base.rb', line 9 def choose(_arms) raise NotImplementedError, "#{self.class} must implement #choose" end |
#to_h ⇒ Object
Serialisable config (so a Bandit can describe its policy).
14 15 16 |
# File 'lib/skiftet_statistical/policies/base.rb', line 14 def to_h { type: self.class.name.split("::").last } end |