Skip to content

BaseImitationProtocol

Full path: schola.core.protocols.base.BaseImitationProtocol

schola.core.protocols.base.BaseImitationProtocol

BaseImitationProtocol

BaseImitationProtocol

Bases: BaseProtocol

Base class for imitation learning protocols.

This class extends BaseProtocol with methods specific to collecting demonstration data for imitation learning.

Call GetDefinition to get the environment definition before calling any other methods. Call SendStartupMsg to start collecting data.

Methods

ItemDescription
__init__()
close()Close the protocol connection.
get_dataGet demonstration data from the environment.
get_definitionGet the environment definition for imitation learning.
send_startup_msgSend the startup message for imitation learning data collection.
start()Start the protocol connection.

Attributes

ItemDescription
propertiesGet protocol-specific properties.

get_data

get_data()

Get demonstration data from the environment.

Returns

A tuple containing:

  • Observations for each timestep
  • Rewards for each timestep
  • Termination flags
  • Truncation flags
  • Info dicts
  • Initial agent observations
  • Initial agent info dicts
  • Demonstration actions

Return type: Tuple[List[Dict[str,Any]], List[float], List[Dict[str,bool]], List[Dict[str,bool]], List[Dict[str,str]], Dict[int,Dict[str, Any]], Dict[int,Dict[str, str]], Dict[int, Dict[str,Any]]]


get_definition

get_definition()

Get the environment definition for imitation learning.

Returns

A tuple containing:

  • List of agent IDs per environment
  • Agent types indexed by environment and agent
  • Observation spaces indexed by environment and agent
  • Action spaces indexed by environment and agent

Return type: Tuple[List[List[str]], Dict[int, Dict[str, str]], Dict[int,Dict[str,gym.Space]], Dict[int,Dict[str,gym.Space]]]


send_startup_msg

send_startup_msg(seeds=None, options=None)

Send the startup message for imitation learning data collection.

Parameters

seeds (List, optional) : List of random seeds for each environment.

options (List, optional) : List of startup options for each environment.