coopihc.interactiontask.ExampleTask.ExampleTask

class ExampleTask(*args, **kwargs)[source]

Bases: coopihc.interactiontask.InteractionTask.InteractionTask

An example algebraic task which a single task state ‘x’, which finishes when x = 4.

Methods

base_on_assistant_action

base assistant step

base_on_user_action

base user step

finit

on_assistant_action

Redefine this to specify the task state transitions and rewards issued.

on_user_action

Redefine this to specify the task state transitions and rewards issued.

render

Render the task on the main plot.

reset

Redefine this to specify how to reinitialize the task before each new game.

Attributes

assistant_action

assistant action

parameters

round_number

state

The current state of the task.

turn_number

Turn number.

user_action

user action

property assistant_action

assistant action

The last action input by the assistant.

Returns

assistant action

Return type

State

base_on_assistant_action(*args, **kwargs)

base assistant step

Wraps the assistant defined on_assistant_action() method. For now does little but provide default values, may be useful later.

Returns

(task state, task reward, is_done flag, metadata):

Return type

tuple(State, float, boolean, dictionnary)

base_on_user_action(*args, **kwargs)

base user step

Wraps the user defined on_user_action() method. For now does little but provide default values, may be useful later.

Returns

(task state, task reward, is_done flag, metadata):

Return type

tuple(State, float, boolean, dictionnary)

on_assistant_action(*args, **kwargs)[source]

Redefine this to specify the task state transitions and rewards issued.

Returns

(task state, task reward, is_done flag, {})

Return type

tuple(State, float, boolean, dictionnary)

on_user_action(*args, **kwargs)[source]

Redefine this to specify the task state transitions and rewards issued.

Returns

(task state, task reward, is_done flag, {})

Return type

tuple(State, float, boolean, dictionnary)

render(mode='text', ax_user=None, ax_assistant=None, ax_task=None)

Render the task on the main plot.

Parameters
  • mode – (str) text or plot

  • args – (list) list of axis in order axtask, axuser, axassistant

reset(dic=None)[source]

Redefine this to specify how to reinitialize the task before each new game.

property state

The current state of the task.

Returns

task state

Return type

State

property turn_number

Turn number.

The turn number of the game

Returns

turn number

Return type

numpy.ndarray

property user_action

user action

The last action input by the user.

Returns

user action

Return type

State