Buffer

ABC Buffer

source

Buffer

 Buffer (pool:Optional[tspace.storage.pool.pool.Pool], batch_size:int)

*The abstract class for providing an buffer interface for data processing.

Buffer is the internal dynamic memory object for pooling the experience tuples. It provides the following interface for inheriting classes (MongoBuffer, DaskBuffer, etc.):

Methods: - load() - save() - store() - sample()

Attributes: - pool: the pool object for storing the data - batch_size: the batch size for sampling - _type_T: the type of the data item (e.g. Record, Episode, etc.)*


source

Buffer.store

 Buffer.store (episode:~ItemT)

Deposit an item (record/episode) into the pool


source

Buffer.find

 Buffer.find (query:tspace.data.core.PoolQuery)

find an itme by id or name.


source

Buffer.sample

 Buffer.sample ()

sample data pool to get (state, action, reward, nstate) as a tuple of 4 DataFrames


source

Buffer.load

 Buffer.load ()

load buffer from pool


source

Buffer.close

 Buffer.close ()

close the pool, for destructor


source

Buffer.__init_subclass__

 Buffer.__init_subclass__ ()

Get the concrete type of the data item (e.g. Record, Episode, etc.)


source

Buffer.__post_init__

 Buffer.__post_init__ ()

User weakref finalizer to make sure close is called when the object is destroyed