Stateful interface
ComputerAdaptiveTesting.Stateful — Module
This module defines the interface for a stateful CAT as well as an implementation in terms of CatRules. The interface is meant to enable polymorphic use of different CAT implementations.
Interface
ComputerAdaptiveTesting.Stateful.StatefulCat — Type
abstract type StatefulCatAbstract supertype for implementation of the stateful CAT interface.
ComputerAdaptiveTesting.Stateful.next_item — Function
next_item(config::StatefulCat) -> IndexTReturns the index of the best next item according to the CAT.
Ideally IndexT will be an integer and the return type a 1-based index, however it should at least be the same type as accepted by add_response!.
ComputerAdaptiveTesting.Stateful.ranked_items — Function
ranked_items(config::StatefulCat) -> AbstractVector{IndexT}Return a vector of indices of the sorted from best to worst item according to the CAT.
ComputerAdaptiveTesting.Stateful.item_criteria — Function
item_criteria(config::StatefulCat) -> AbstractVector{CriteriaT}Returns a vector of criteria values for each item in the item bank.
The criteria can vary, but should attempt to interoperate with ComputerAdaptiveTesting.jl.
ComputerAdaptiveTesting.Stateful.add_response! — Function
julia add_response!(config::StatefulCat, index::IndexT, response::ResponseT)`
The exact response type ResponseT depends on the item bank. It should be chosen to interoperate with any equivalent item bank according to the implementation in ComputerAdaptiveTesting.jl.
ComputerAdaptiveTesting.Stateful.rollback! — Function
rollback!(config::StatefulCat)Rollback the last response added with add_response!.
Some CAT implementations may not support this operation in which case they will throw an error.
ComputerAdaptiveTesting.Stateful.reset! — Function
reset!(config::StatefulCat)Reset the CAT to its initial state, removing all responses.
ComputerAdaptiveTesting.Stateful.set_item_bank! — Function
set_item_bank!(config::StatefulCat, item_bank::AbstractItemBank)Set the current item bank of the CAT. This will also reset the CAT to its initial state, removing all responses.
Some CAT implementations may not support this operation in which case they will throw an error.
ComputerAdaptiveTesting.Stateful.get_responses — Function
get_responses(config::StatefulCat) -> Tuple{AbstractVector{IndexT}, AbstractVector{ResponseT}}Returns a tuple of the indices and responses of the items that have been added to the CAT with add_response! so far.
ComputerAdaptiveTesting.Stateful.get_ability — Function
get_ability(config::StatefulCat) -> AbilityTReturn the current ability estimate according to the CAT. The type of the ability estimate AbilityT depends on the CAT implementation but should attempt to interoperate with ComputerAdaptiveTesting.jl.
CatRules implementation
There is an implementation in terms of CatRules:
ComputerAdaptiveTesting.Stateful.StatefulCatRules — Type
struct StatefulCatRules{TrackedResponsesT<:ComputerAdaptiveTesting.Aggregators.TrackedResponses} <: ComputerAdaptiveTesting.Stateful.StatefulCatThis is a the StatefulCat implementation in terms of CatRules. It is also the de-facto standard for the behavior of the interface.
Usage
Just as CatLoop can wrap CatRules, you can also use it with any implementor of Stateful.StatefulCat, and run using Sim.run_cat.