choose_rank() returns the action choice using ranking_response. ranking_response contains all the actions and distribution from with the action was sampled. It also contains the chosen action id and the unique event_id representing the choice. This unique event_id must be used to report back outcomes against this choice for the online trainer. More...
#include <ranking_response.h>
Public Types | |
| using | iterator = slot_ranking::iterator |
| using | const_iterator = slot_ranking::const_iterator |
Public Member Functions | |
| ranking_response (char const *event_id) | |
| Construct a new ranking response object. More... | |
| const char * | get_event_id () const |
| Unique event_id for this ranking request. This event_id must be used when calling report_outcome so it can be joined with the chosen action. More... | |
| void | set_event_id (const char *event_id) |
| Set the event_id. (This is set internally by the API) More... | |
| int | get_chosen_action_id (size_t &action_id, api_status *status=nullptr) const |
| Get the chosen action id. More... | |
| int | set_chosen_action_id (size_t action_id, api_status *status=nullptr) |
| Set the chosen action id. (This is set internally by the API) More... | |
| int | set_chosen_action_id_unchecked (size_t action_id, api_status *status=nullptr) |
| Set the chosen action id, but do not verify the index fits within the ranking. (This is set internally by the API) This is used in CCB where subsequent ranking_responses have subsets of the orignal actionset. More... | |
| void | push_back (const size_t action_id, const float prob) |
| Add (action id, probability) pair to the slot (This is set internally by the API) More... | |
| size_t | size () const |
| Size of the action collection. More... | |
| void | set_model_id (const char *model_id) |
| Set the model_id. Every rank call is associated with a unique model used to predict. A unique model_id is associated with each unique model. (This is set internally by the API) More... | |
| void | set_model_id (std::string &&model_id) |
| Set the model_id. Every rank call is associated with a unique model used to predict. A unique model_id is associated with each unique model. (This is set internally by the API). Input model_id is left in an unspecified but valid state. More... | |
| const char * | get_model_id () const |
| Get the model_id. Every rank call (single or multi slot) is associated with a unique model used to predict. A unique model_id is associated with each unique model. (This is set internally by the API) More... | |
| void | clear () |
| Clear the ranking response object so that it can be reused. The goal is to reuse response without reallocating as much as possible. | |
| ranking_response (ranking_response &&) noexcept | |
| Move construct a new ranking response object. The underlying data is taken from the rvalue reference. | |
| ranking_response & | operator= (ranking_response &&) noexcept |
| Move assignment operator for ranking response. The underlying data is taken from rvalue reference, and then it is cleared. More... | |
| ranking_response (const ranking_response &)=delete | |
| Copy constructor is removed since implementation will be deleted twice. | |
| ranking_response & | operator= (const ranking_response &)=delete |
| assignment operator is removed since implementation will be deleted twice | |
| const_iterator | begin () const |
| Returns an iterator pointing to the first element of the (action, probability) collection. | |
| iterator | begin () |
| const_iterator | end () const |
| Returns an iterator referring to the past-the-end element of the (action, probability) collection. | |
| iterator | end () |
choose_rank() returns the action choice using ranking_response. ranking_response contains all the actions and distribution from with the action was sampled. It also contains the chosen action id and the unique event_id representing the choice. This unique event_id must be used to report back outcomes against this choice for the online trainer.
| reinforcement_learning::ranking_response::ranking_response | ( | char const * | event_id | ) |
Construct a new ranking response object.
| event_id | The unique identifier for this interaction. This event_id must be used when reporting the outcome for this action |
| int reinforcement_learning::ranking_response::get_chosen_action_id | ( | size_t & | action_id, |
| api_status * | status = nullptr |
||
| ) | const |
Get the chosen action id.
| action_id | Chosen action id |
| status | Optional field with detailed string description if there is an error |
| const char* reinforcement_learning::ranking_response::get_event_id | ( | ) | const |
Unique event_id for this ranking request. This event_id must be used when calling report_outcome so it can be joined with the chosen action.
| const char* reinforcement_learning::ranking_response::get_model_id | ( | ) | const |
Get the model_id. Every rank call (single or multi slot) is associated with a unique model used to predict. A unique model_id is associated with each unique model. (This is set internally by the API)
|
noexcept |
Move assignment operator for ranking response. The underlying data is taken from rvalue reference, and then it is cleared.
| void reinforcement_learning::ranking_response::push_back | ( | const size_t | action_id, |
| const float | prob | ||
| ) |
Add (action id, probability) pair to the slot (This is set internally by the API)
| action_id | |
| prob |
| int reinforcement_learning::ranking_response::set_chosen_action_id | ( | size_t | action_id, |
| api_status * | status = nullptr |
||
| ) |
Set the chosen action id. (This is set internally by the API)
| action_id | Chosen action id |
| status | Optional field with detailed string description if there is an error |
| int reinforcement_learning::ranking_response::set_chosen_action_id_unchecked | ( | size_t | action_id, |
| api_status * | status = nullptr |
||
| ) |
Set the chosen action id, but do not verify the index fits within the ranking. (This is set internally by the API) This is used in CCB where subsequent ranking_responses have subsets of the orignal actionset.
| action_id | Chosen action id |
| status | Optional field with detailed string description if there is an error |
| void reinforcement_learning::ranking_response::set_event_id | ( | const char * | event_id | ) |
Set the event_id. (This is set internally by the API)
| event_id |
| void reinforcement_learning::ranking_response::set_model_id | ( | const char * | model_id | ) |
Set the model_id. Every rank call is associated with a unique model used to predict. A unique model_id is associated with each unique model. (This is set internally by the API)
| model_id |
| void reinforcement_learning::ranking_response::set_model_id | ( | std::string && | model_id | ) |
Set the model_id. Every rank call is associated with a unique model used to predict. A unique model_id is associated with each unique model. (This is set internally by the API). Input model_id is left in an unspecified but valid state.
| model_id |
| size_t reinforcement_learning::ranking_response::size | ( | ) | const |
Size of the action collection.