class Kot::Test

Attributes

est_theta[R]

Public Class Methods

new(item_bank, est_theta = 0.0, selector = RandomesqueSelector.new, estimator = HillClimbingEstimator.new) click to toggle source
# File lib/kot/test.rb, line 7
def initialize(item_bank, est_theta = 0.0, selector = RandomesqueSelector.new, estimator = HillClimbingEstimator.new)
  @item_bank = item_bank
  @est_theta = est_theta
  @selector = selector
  @estimator = estimator

  @responses = []
  @asked_items = []
end

Public Instance Methods

next_item() click to toggle source

Ask the selector for a new item from the item bank.

# File lib/kot/test.rb, line 29
def next_item
  possible_items = @item_bank - @asked_items
  @selector.select(@est_theta, possible_items)
end
respond(response, item) click to toggle source

Add a response for a given item.

# File lib/kot/test.rb, line 35
def respond(response, item)
  @responses << response
  @asked_items << item
  update_est_theta
end
see() click to toggle source

Get the standard error of estimation for the test so far.

# File lib/kot/test.rb, line 18
def see
  return Float::INFINITY if @asked_items.empty?
  ItemResponseTheory.see(@est_theta, @asked_items)
end
update_est_theta() click to toggle source

Update the estimated theta for the test so far.

# File lib/kot/test.rb, line 24
def update_est_theta
  @est_theta = @estimator.estimate(est_theta: @est_theta, responses: @responses, items: @asked_items, all_items: @item_bank)
end