d2c.data

BaseData

class BaseData(data_path: Union[str, List[str]])[source]

Bases: abc.ABC

The basic class of the replay buffer. Inherit this class to build data loaders for practical application and benchmark experiments.

The API methods the user should implement are:

  • _build_data(): Construct the data through adding the transitions into the replay buffer.

  • _build_data_loader(): Construct the data loader.

Parameters

data_path (str) – the file path of the dataset.

property data

Return the replay buffer.

Data

class Data(config)[source]

Bases: d2c.data.data.BaseData

Create the replay buffer with batch data that is from the benchmarks or real-world applications dataset.

It uses different data loaders to get the transitions and adds them into the replay buffer. This class generates the dataset for the offline RL training.

The main methods that users of this class need to know are:

  • data(): Return the constructed replay buffer;

  • _build_data_loader(): Read the batch data and create a data loader. It builds different data loader according to the corresponding parameters in the configuration.

  • _build_data(): Create a replay buffer and add the data into it.

Note

To add a data loader for a new benchmark, you should implement a new method _xxx_data_loader`(like :meth:`_app_data_loader, _d4rl_data_loader()) and add this method into _data_loader_list().

Parameters

config – the configuration.

property state_shift_scale

DataNoise

class DataNoise(config, env: d2c.envs.learned.env.LeaEnv)[source]

Bases: d2c.data.data.Data

Construct a dataset that with noised action.

Parameters
  • config – the configuration.

  • env (BaseEnv) – the env to provide the action information(minimum and maximum).

DataMix

class DataMix(config)[source]

Bases: d2c.data.data.BaseData

Construct a dataset by mixing several data.

property state_shift_scale