ReplayTables
Getting started
Installation:
pip install ReplayTables-andnp
Basic usage:
from typing import NamedTuple
from ReplayTables.ReplayBuffer import ReplayBuffer
class Data(NamedTuple):
x: np.ndarray
a: np.ndarray
r: np.ndarray
buffer = ReplayBuffer(
max_size=100_000,
structure=Data,
rng=np.random.default_rng(0),
)
buffer.add(Data(x, a, r))
batch = buffer.sample(32)
print(batch.x.shape) # -> (32, d)
print(batch.a.shape) # -> (32, )
print(batch.r.shape) # -> (32, )
Prioritized Replay
An implementation of prioritized experience replay from
Schaul, Tom, et al. "Prioritized experience replay." ICLR (2016).
The defaults for this implementation strictly adhere to the defaults from the original work, though several configuration options are available.
from typing import NamedTuple
from ReplayTables.PER import PERConfig, PrioritizedReplay
class Data(NamedTuple):
a: float
b: float
# all configurables are optional.
config = PERConfig(
# can also use "mean" mode to place new samples in the middle of the distribution
# or "given" mode, which requires giving the priority when the sample is added
new_priority_mode='max',
# the sampling distribution is a mixture between uniform sampling and the priority
# distribution. This specifies the weight given to the uniform sampler.
# Setting to 1 reverts this back to an inefficient form of standard uniform replay.
uniform_probability=1e-3,
# this implementation assume priorities are positive. Can scale priorities by raising to
# some power. Default is `priority**(1/2)`
priority_exponent=0.5,
# if `new_priority_mode` is 'max', then the buffer tracks the highest seen priority.
# this can cause accidental saturation if outlier priorities are observed. This provides
# an exponential decay of the max in order to prevent permanent saturation.
max_decay=1,
)
# if no config is given, defaults to original PER parameters
buffer = PrioritizedReplay(
max_size=100_000,
structure=Data,
rng=np.random.default_rng(0),
config=config,
)
buffer.add(Data(a=1, b=2))
# if `new_priority_mode` is 'given':
buffer.add(Data(a=1, b=2), priority=1.3)
batch = buffer.sample(32)
Metadata
Release files for replaytables-andnp 8.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ReplayTables_andnp-8.0.0.tar.gz | 31.3 kB | Details |
Built distributions (wheels)
Total release size: 3.9 MB
Release files / ReplayTables_andnp-8.0.0.tar.gz
| Download URL | ReplayTables_andnp-8.0.0.tar.gz |
|---|---|
| Size | 31.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
11d95627d81ce7fea67a688aed1c245e76c20d7ec39f58e14bfadd34135df2c5
|
|
BLAKE2b-256 checksum How to use checksums |
005ee51c5eb86e418c2bfc0bd4e5267ec8a56d156261cb842d369c18247df653
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.8.1
|
Release files / ReplayTables_andnp-8.0.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | ReplayTables_andnp-8.0.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 341.4 kB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
2e3c83ebff4f10cb4aab1284a1e9d5eee4e8356958b5675fa5f255ecab4db55c
|
|
BLAKE2b-256 checksum How to use checksums |
17006f20d422a3515e2edf0186eeb1741b6ac9cc5eda35886688758c264e51c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.8.1
|
Release files / ReplayTables_andnp-8.0.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | ReplayTables_andnp-8.0.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 338.3 kB |
| Tags | CPython 3.12 Linux glibc 2.17+ ARM64 |
|
SHA-256 checksum How to use checksums |
3489f5a5dcf684555d6cf51dc83f9d96ea6f7dd1363f94f7aa3ba4461c405ca4
|
|
BLAKE2b-256 checksum How to use checksums |
ccb8074189c18be49bec1837a064119011f014008439ec62f8ffba5bd5b610bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.8.1
|
Release files / ReplayTables_andnp-8.0.0-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | ReplayTables_andnp-8.0.0-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 300.8 kB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
f7312478551470b6e76dd78a5f62d2fe4f73b97857b85c4a71400d1d7d497da3
|
|
BLAKE2b-256 checksum How to use checksums |
65068ab1a74a613db0837d2b436aedc11775db4829b4571ff1314e75def66930
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.8.1
|
Release files / ReplayTables_andnp-8.0.0-cp312-cp312-macosx_10_12_x86_64.whl
| Download URL | ReplayTables_andnp-8.0.0-cp312-cp312-macosx_10_12_x86_64.whl |
|---|---|
| Size | 305.3 kB |
| Tags | CPython 3.12 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
166fb71b9db2618ed5c3a1ef7f7fc078cc38d3195ecb91ffec8790d3dd85a0f6
|
|
BLAKE2b-256 checksum How to use checksums |
eab734026da911adc55ab6b1e9d4b62c81ffc3857541be4ca36f8a07f62684a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.8.1
|
Release files / ReplayTables_andnp-8.0.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | ReplayTables_andnp-8.0.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 341.9 kB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
2210f7f1dd4202089ab9ab56a273ffff272c6cc4e135b70c2733e3f07ac581cd
|
|
BLAKE2b-256 checksum How to use checksums |
d279128bf53d596bed609594e1120bedfef61ea1e631284ec5053c0dc21b761e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.8.1
|
Release files / ReplayTables_andnp-8.0.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | ReplayTables_andnp-8.0.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 339.0 kB |
| Tags | CPython 3.11 Linux glibc 2.17+ ARM64 |
|
SHA-256 checksum How to use checksums |
9abac9a9c230f987c6ef2b207d8c3b2600e1577707ee53e7e0d7afb0e8260434
|
|
BLAKE2b-256 checksum How to use checksums |
0a24d6f6fc2fb1271a03c6ca96768eb60244cf069aacf70a7355cf53bfa2494f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.8.1
|
Release files / ReplayTables_andnp-8.0.0-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | ReplayTables_andnp-8.0.0-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 301.6 kB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
44ac7a43c796abebd49645eca21728483c4c20538b81cdb05d33040a7e2db447
|
|
BLAKE2b-256 checksum How to use checksums |
dc1fee6153d2be6c325e09d104e009b43656aa2e1c80797c3b2063ecdf1f5b8d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.8.1
|
Release files / ReplayTables_andnp-8.0.0-cp311-cp311-macosx_10_12_x86_64.whl
| Download URL | ReplayTables_andnp-8.0.0-cp311-cp311-macosx_10_12_x86_64.whl |
|---|---|
| Size | 306.4 kB |
| Tags | CPython 3.11 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
c42886a79372c657a4d1ad6ad47d9b511c227e3c7fc2a358db701930cdf88f71
|
|
BLAKE2b-256 checksum How to use checksums |
c13a4bf42f1a592da8e49c87590d3b28f1453f94d701a35374346ce0408ff140
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.8.1
|
Release files / ReplayTables_andnp-8.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | ReplayTables_andnp-8.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 341.9 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
85d147b789d85dfdb7fd4344da420a30dcd17a45d8a2eb8cfcf3a957030c2bcb
|
|
BLAKE2b-256 checksum How to use checksums |
9066751d153fa4422c95e914b957e971c0871b0bae5185aa2096b3a19fff311e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.8.1
|
Release files / ReplayTables_andnp-8.0.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | ReplayTables_andnp-8.0.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 338.8 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ ARM64 |
|
SHA-256 checksum How to use checksums |
ad272f0e9e37a6d1c8a02abaea463ca1fe958fa97c887d0aae57046d6d28c871
|
|
BLAKE2b-256 checksum How to use checksums |
1965a88aab194f88d48b9d5cf29981482e566cb738faf01b8ff3e2911e4a5e64
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.8.1
|
Release files / ReplayTables_andnp-8.0.0-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | ReplayTables_andnp-8.0.0-cp310-cp310-macosx_11_0_arm64.whl |
|---|---|
| Size | 301.7 kB |
| Tags | CPython 3.10 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
b32332c9ac949ecf64c40520b8511df6a502019148c98325ac98088720d931a6
|
|
BLAKE2b-256 checksum How to use checksums |
355fca48dd8decfebba23f0fd0f83feef728d925271d807cef98f2f4d18966fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.8.1
|
Release files / ReplayTables_andnp-8.0.0-cp310-cp310-macosx_10_12_x86_64.whl
| Download URL | ReplayTables_andnp-8.0.0-cp310-cp310-macosx_10_12_x86_64.whl |
|---|---|
| Size | 306.4 kB |
| Tags | CPython 3.10 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
b9d78423dcc1b718399d438c329470ed697f9e8fc08bfec0db28d28b9e39abc1
|
|
BLAKE2b-256 checksum How to use checksums |
25f9cea6f769d983ad1ee41881ed4d7f0fdc04a2767355744a3acacb48f80ea5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.8.1
|