Minari#
Create Minari Dataset#
- minari.create_dataset_from_collector_env(dataset_id: str, collector_env: DataCollectorV0, algorithm_name: str | None = None, author: str | None = None, author_email: str | None = None, code_permalink: str | None = None)[source]#
Create a Minari dataset using the data collected from stepping with a Gymnasium environment wrapped with a DataCollectorV0 Minari wrapper.
The
dataset_id
parameter corresponds to the name of the dataset, with the syntax as follows:(env_name-)(dataset_name)(-v(version))
whereenv_name
identifies the name of the environment used to generate the datasetdataset_name
. Thisdataset_id
is used to load the Minari datasets withminari.load_dataset()
.- Parameters:
dataset_id (str) – name id to identify Minari dataset
collector_env (DataCollectorV0) – Gymnasium environment used to collect the buffer data
buffer (list[Dict[str, Union[list, Dict]]]) – list of episode dictionaries with data
algorithm_name (Optional[str], optional) – name of the algorithm used to collect the data. Defaults to None.
author (Optional[str], optional) – author that generated the dataset. Defaults to None.
author_email (Optional[str], optional) – email of the author that generated the dataset. Defaults to None.
code_permalink (Optional[str], optional) – link to relevant code used to generate the dataset. Defaults to None.
- Returns:
MinariDataset
- minari.create_dataset_from_buffers(dataset_id: str, env: Env, buffer: List[Dict[str, list | Dict]], algorithm_name: str | None = None, author: str | None = None, author_email: str | None = None, code_permalink: str | None = None)[source]#
Create Minari dataset from a list of episode dictionary buffers.
The
dataset_id
parameter corresponds to the name of the dataset, with the syntax as follows:(env_name-)(dataset_name)(-v(version))
whereenv_name
identifies the name of the environment used to generate the datasetdataset_name
. Thisdataset_id
is used to load the Minari datasets withminari.load_dataset()
.- Each episode dictionary buffer must have the following items:
observations: np.ndarray of step observations. shape = (total_episode_steps + 1, (observation_shape)). Should include initial and final observation
actions: np.ndarray of step action. shape = (total_episode_steps + 1, (action_shape)).
rewards: np.ndarray of step rewards. shape = (total_episode_steps + 1, 1).
terminations: np.ndarray of step terminations. shape = (total_episode_steps + 1, 1).
truncations: np.ndarray of step truncations. shape = (total_episode_steps + 1, 1).
Other additional items can be added as long as the values are np.ndarray’s or other nested dictionaries.
- Parameters:
dataset_id (str) – name id to identify Minari dataset
env (gym.Env) – Gymnasium environment used to collect the buffer data
buffer (list[Dict[str, Union[list, Dict]]]) – list of episode dictionaries with data
algorithm_name (Optional[str], optional) – name of the algorithm used to collect the data. Defaults to None.
author (Optional[str], optional) – author that generated the dataset. Defaults to None.
author_email (Optional[str], optional) – email of the author that generated the dataset. Defaults to None.
code_permalink (Optional[str], optional) – link to relevant code used to generate the dataset. Defaults to None.
- Returns:
MinariDataset
Load Minari Dataset#
Split Minari Dataset#
- minari.split_dataset(dataset: MinariDataset, sizes: List[int], seed: int | None = None) List[MinariDataset] [source]#
Split a MinariDataset in multiple datasets.
- Parameters:
dataset (MinariDataset) – the MinariDataset to split
sizes (List[int]) – sizes of the resulting datasets
seed (Optiona[int]) – random seed
- Returns:
datasets (List[MinariDataset]) – resulting list of datasets
Download Minari Dataset#
List Minari Datasets#
Delete Minari Datasets#
Combine Minari Datasets#
- minari.combine_datasets(datasets_to_combine: List[MinariDataset], new_dataset_id: str)[source]#
Combine a group of MinariDataset in to a single dataset with its own name id.
A new HDF5 metadata attribute will be added to the new dataset called combined_datasets. This will contain a list of strings with the dataset names that were combined to form this new Minari dataset.
- Parameters:
datasets_to_combine (list[MinariDataset]) – list of datasets to be combined
new_dataset_id (str) – name id for the newly created dataset