trinity.algorithm.sample_strategy

Submodules

trinity.algorithm.sample_strategy.mix_sample_strategy module

class trinity.algorithm.sample_strategy.mix_sample_strategy.MixSampleStrategy(buffer_config: BufferConfig, **kwargs)[source]

Bases: SampleStrategy

The default sample strategy.

__init__(buffer_config: BufferConfig, **kwargs)[source]
async sample(step: int) Tuple[Experiences, Dict, List][source]

Sample data from buffer.

Parameters:

step (int) – The step number of current step.

Returns:

The sampled Experiences data. Dict: Metrics for logging. List: Representative data for logging.

Return type:

Experiences

classmethod default_args() Dict[source]

Get the default arguments of the sample strategy.

trinity.algorithm.sample_strategy.sample_strategy module

class trinity.algorithm.sample_strategy.sample_strategy.SampleStrategy(buffer_config: BufferConfig, **kwargs)[source]

Bases: ABC

__init__(buffer_config: BufferConfig, **kwargs) None[source]
abstract async sample(step: int) Tuple[Experiences, Dict, List][source]

Sample data from buffer.

Parameters:

step (int) – The step number of current step.

Returns:

The sampled Experiences data. Dict: Metrics for logging. List: Representative data for logging.

Return type:

Experiences

abstract classmethod default_args() dict[source]

Get the default arguments of the sample strategy.

class trinity.algorithm.sample_strategy.sample_strategy.WarmupSampleStrategy(buffer_config: BufferConfig, **kwargs)[source]

Bases: SampleStrategy

The default sample strategy.

__init__(buffer_config: BufferConfig, **kwargs)[source]
async sample(step: int, **kwargs) Tuple[Experiences, Dict, List][source]

Sample data from buffer.

Parameters:

step (int) – The step number of current step.

Returns:

The sampled Experiences data. Dict: Metrics for logging. List: Representative data for logging.

Return type:

Experiences

classmethod default_args() dict[source]

Get the default arguments of the sample strategy.

class trinity.algorithm.sample_strategy.sample_strategy.DefaultSampleStrategy(buffer_config: BufferConfig, **kwargs)[source]

Bases: SampleStrategy

__init__(buffer_config: BufferConfig, **kwargs)[source]
async sample(step: int, **kwargs) Tuple[Any, Dict, List][source]

Sample data from buffer.

Parameters:

step (int) – The step number of current step.

Returns:

The sampled Experiences data. Dict: Metrics for logging. List: Representative data for logging.

Return type:

Experiences

classmethod default_args() dict[source]

Get the default arguments of the sample strategy.

trinity.algorithm.sample_strategy.utils module

trinity.algorithm.sample_strategy.utils.representative_sample(experiences: List[Experience]) List[dict][source]

Module contents

class trinity.algorithm.sample_strategy.SampleStrategy(buffer_config: BufferConfig, **kwargs)[source]

Bases: ABC

__init__(buffer_config: BufferConfig, **kwargs) None[source]
abstract async sample(step: int) Tuple[Experiences, Dict, List][source]

Sample data from buffer.

Parameters:

step (int) – The step number of current step.

Returns:

The sampled Experiences data. Dict: Metrics for logging. List: Representative data for logging.

Return type:

Experiences

abstract classmethod default_args() dict[source]

Get the default arguments of the sample strategy.

class trinity.algorithm.sample_strategy.DefaultSampleStrategy(buffer_config: BufferConfig, **kwargs)[source]

Bases: SampleStrategy

__init__(buffer_config: BufferConfig, **kwargs)[source]
async sample(step: int, **kwargs) Tuple[Any, Dict, List][source]

Sample data from buffer.

Parameters:

step (int) – The step number of current step.

Returns:

The sampled Experiences data. Dict: Metrics for logging. List: Representative data for logging.

Return type:

Experiences

classmethod default_args() dict[source]

Get the default arguments of the sample strategy.

class trinity.algorithm.sample_strategy.WarmupSampleStrategy(buffer_config: BufferConfig, **kwargs)[source]

Bases: SampleStrategy

The default sample strategy.

__init__(buffer_config: BufferConfig, **kwargs)[source]
async sample(step: int, **kwargs) Tuple[Experiences, Dict, List][source]

Sample data from buffer.

Parameters:

step (int) – The step number of current step.

Returns:

The sampled Experiences data. Dict: Metrics for logging. List: Representative data for logging.

Return type:

Experiences

classmethod default_args() dict[source]

Get the default arguments of the sample strategy.

class trinity.algorithm.sample_strategy.MixSampleStrategy(buffer_config: BufferConfig, **kwargs)[source]

Bases: SampleStrategy

The default sample strategy.

__init__(buffer_config: BufferConfig, **kwargs)[source]
async sample(step: int) Tuple[Experiences, Dict, List][source]

Sample data from buffer.

Parameters:

step (int) – The step number of current step.

Returns:

The sampled Experiences data. Dict: Metrics for logging. List: Representative data for logging.

Return type:

Experiences

classmethod default_args() Dict[source]

Get the default arguments of the sample strategy.