Buffer
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.)*
Buffer.store
Buffer.store (episode:~ItemT)
Deposit an item (record/episode) into the pool
Buffer.find
Buffer.find (query:tspace.data.core.PoolQuery)
find an itme by id or name.
Buffer.sample
Buffer.sample ()
sample data pool to get (state, action, reward, nstate) as a tuple of 4 DataFrames
Buffer.load
Buffer.load ()
load buffer from pool
Buffer.close
Buffer.close ()
close the pool, for destructor
Buffer.__init_subclass__
Buffer.__init_subclass__ ()
Get the concrete type of the data item (e.g. Record, Episode, etc.)
Buffer.__post_init__
Buffer.__post_init__ ()
User weakref finalizer to make sure close is called when the object is destroyed