Skip to content

More precise logics for n_actions in Dataset and Simulator #45

@yoongi0428

Description

@yoongi0428

Possible Issue

In bandit feedback, n_actions are set as int(self.action.max() + 1), which doesn't raise any error in above code,
assuming that logs generated by policy covered all possible actions.

However, to be more precise, I think n_actions should be explicitly given, rather than extracted from log data.
And if changed, the above code might raise error.
If 1000 possible actions and only 0~998 actions exist in bandit _feedback and somehow policy selected action 999,
this might raise out-of-index error.

Idea

  1. BanditFeedback data is given n_actions explicitly.
    Rather than:

    @property
    def n_actions(self) -> int:
    """Number of actions."""
    return int(self.action.max() + 1)

  2. Use n_actions directly in convert_to_action_dist
    Rather than:

    action_dist = convert_to_action_dist(
    n_actions=bandit_feedback["action"].max() + 1,
    selected_actions=np.array(selected_actions_list),
    )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions