Skip to main content

PyFixedReps

Short for: Python Fixed Representations. This is a collection of unit tested implementations of common fixed representations commonly used with linear (in features) RL systems.

Benchmarks

Installing

Can be installed using pip by including this in your requirements.txt:

pip install PyFixedReps-andnp==4.1.2

I highly recommend specifying the version number when installing in order to ensure reproducibility of experiments. This library is fairly stable, so does not change often and there is little risk of missing an important change.

Tile-coder

from PyFixedReps import TileCoder

tc = TileCoder({
    # [required]
    'tiles': 2, # how many tiles in each tiling
    'tilings': 4,
    'dims': 2, # shape of the state-vector

    # [optional]
    'random_offset': True, # instead of using the default fixed-width offset, randomly generate offsets between tilings
    'input_ranges': [(-1.2, 0.5), (-0.07, 0.07)], # a vector of same length as 'dims' containing (min, max) tuples to rescale inputs
    'scale_output': True, # scales the output by number of active features
})

state = [-1.1, 0.03]
# returns an n-hot numpy array for active tiles
# if scale_output is true, then the "hot" tiles will be scaled by number of tilings
features = tc.encode(state)
print(features) # -> [0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1]

# returns the indices of the n-hot active tiles
# length of the list will be equal to number of tilings
# useful for using sparse vectors for faster computation, but harder to work with than "encode"
indices = tc.get_indices(state)
print(indices) # -> [4, 12, 31, 89]

num_features = tc.features()
print(num_features) # -> 16, the length of the vector generated by "encode"

Options

  • random_offset - In most cases, having a uniform even offset is sufficient to have uncorrelated and high coverage of the statespace. Occasionally, it becomes important that the offsets are randomly generated to break any correlations or structure in the statespace.
  • input_ranges - It's important that the inputs are scaled between [0, 1] for this tile-coder to be most effective. When not scaled, we can potentially get into bad failure cases where only a small percentage of the tiles are ever active. This is true of all current tile-coder implementations. This implementation is robust to imperfect scaling by wrapping values larger than 1 back around to 0 (modular arithmetic), so as long as the units are roughly correct then good performance can still be achieved.
  • scale_output - Has the encode function scale the outputs by the norm of the feature vector so that every feature vector has unit norm. This is simply a scalar multiple of every feature vector, which is often perfectly absorbed into the stepsize parameter, the effect of this option is to make it easier to find good stepsize by decoupling number of tilings from applicable stepsize range.

Metadata

Release files for pyfixedreps-andnp 4.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyfixedreps-andnp 4.1.2
File Size Uploaded
PyFixedReps_andnp-4.1.2.tar.gz 14.2 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for pyfixedreps-andnp 4.1.2
File
PyFixedReps_andnp-4.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details
PyFixedReps_andnp-4.1.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ ARM64 Details
PyFixedReps_andnp-4.1.2-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
PyFixedReps_andnp-4.1.2-cp312-cp312-macosx_10_12_x86_64.whl CPython 3.12 CPython 3.12 macOS 10.12+ x86-64 Details
PyFixedReps_andnp-4.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details
PyFixedReps_andnp-4.1.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ ARM64 Details
PyFixedReps_andnp-4.1.2-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
PyFixedReps_andnp-4.1.2-cp311-cp311-macosx_10_12_x86_64.whl CPython 3.11 CPython 3.11 macOS 10.12+ x86-64 Details
PyFixedReps_andnp-4.1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details
PyFixedReps_andnp-4.1.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ ARM64 Details
PyFixedReps_andnp-4.1.2-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details
PyFixedReps_andnp-4.1.2-cp310-cp310-macosx_10_12_x86_64.whl CPython 3.10 CPython 3.10 macOS 10.12+ x86-64 Details

Total release size: 3.3 MB

Release files / PyFixedReps_andnp-4.1.2.tar.gz

Download URL PyFixedReps_andnp-4.1.2.tar.gz
Size 14.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c6215f900df426bf1b6c818524bea8b1c86faf784f1cb9b66269229f7cc3e8b4
BLAKE2b-256 checksum
How to use checksums
cc22cafe23cc86306fc1e6c46b79a22de744d18422ff659dd81430c67d203f77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.7.4

Release files / PyFixedReps_andnp-4.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL PyFixedReps_andnp-4.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 291.7 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
e203f551572a3991c6b101927ff2d2a2bbd8697ed4fdfe9035a926b14f608301
BLAKE2b-256 checksum
How to use checksums
7d1188a417f233231440493b27925c74512e68f90f225353a49508442da04441
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.7.4

Release files / PyFixedReps_andnp-4.1.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL PyFixedReps_andnp-4.1.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 290.1 kB
Tags CPython 3.12 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
e43d5f2100a0e7f531d4dbe8e487b0fcb1f09b2327ad604e6fa5e9789ec2c9f9
BLAKE2b-256 checksum
How to use checksums
f6dcd8d12786c3a08ed935fea51697f2cc8a46ded135f19f318c41bc65a0d01c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.7.4

Release files / PyFixedReps_andnp-4.1.2-cp312-cp312-macosx_11_0_arm64.whl

Download URL PyFixedReps_andnp-4.1.2-cp312-cp312-macosx_11_0_arm64.whl
Size 254.3 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
6b4bc743078eded8014ce8d3ae3fd20bf23335918afb6a44aec600aef85617ec
BLAKE2b-256 checksum
How to use checksums
8e11c2569a30b2b2066a6d6234c1bca91972bb57d4779b23b055c34ef13d2ae4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.7.4

Release files / PyFixedReps_andnp-4.1.2-cp312-cp312-macosx_10_12_x86_64.whl

Download URL PyFixedReps_andnp-4.1.2-cp312-cp312-macosx_10_12_x86_64.whl
Size 259.6 kB
Tags CPython 3.12 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
2249cf54d21a7ec7e0af000c4ad9d0be80d4fa36c9f3b41d6df0dcd51ed561cf
BLAKE2b-256 checksum
How to use checksums
1c307f70dd9ee6099a4af01738f7584406b8bc5315626970de1d8e5e3318cfb6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.7.4

Release files / PyFixedReps_andnp-4.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL PyFixedReps_andnp-4.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 292.7 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
500ec892c8f63d9d36266dbba0572d618432b386de41808927bbeb43979f59f7
BLAKE2b-256 checksum
How to use checksums
34d3b66ee448dbb32176bae4d5788f33beb1a36990025f0b5588319b2e140ed6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.7.4

Release files / PyFixedReps_andnp-4.1.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL PyFixedReps_andnp-4.1.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 290.5 kB
Tags CPython 3.11 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
89db8fad13330d2e8e0a3447bb1b4e0de85805670901a2fcb7170d1573c4bfa8
BLAKE2b-256 checksum
How to use checksums
08e004e6b9f08644b6b1095b3b90564887d2adb05d3845748a7683fca2edf735
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.7.4

Release files / PyFixedReps_andnp-4.1.2-cp311-cp311-macosx_11_0_arm64.whl

Download URL PyFixedReps_andnp-4.1.2-cp311-cp311-macosx_11_0_arm64.whl
Size 254.8 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
0318eb6fd24cc0c3784561029828f76dcfdf26e7ee9391c686cb47f4f6db3f81
BLAKE2b-256 checksum
How to use checksums
07f2982a4f0a3df9422b3d9ba22d1e2eff1e4036b7b84394105e4978151ace22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.7.4

Release files / PyFixedReps_andnp-4.1.2-cp311-cp311-macosx_10_12_x86_64.whl

Download URL PyFixedReps_andnp-4.1.2-cp311-cp311-macosx_10_12_x86_64.whl
Size 260.8 kB
Tags CPython 3.11 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
c046ce3325ca40fcba8f074c26a616296bca52f4b476220053be1e6d3d1542aa
BLAKE2b-256 checksum
How to use checksums
715fcd7829da6092be4694f0387df5294ef1a368c36725d7600a0f374c81f1de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.7.4

Release files / PyFixedReps_andnp-4.1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL PyFixedReps_andnp-4.1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 291.8 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
6f51e610e15dd0af071175cf0153f1fea3ac87c49bdb849d4bfc1303cc445733
BLAKE2b-256 checksum
How to use checksums
6f054a2bb89ebd9c7993022aa1d310d5684340ef5e675e83a9b9e1b55118c198
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.7.4

Release files / PyFixedReps_andnp-4.1.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL PyFixedReps_andnp-4.1.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 289.8 kB
Tags CPython 3.10 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
1bcd6e6f7c86b90b1ab1777274c93d1b620a96d6235e32deb078b93c7fca62de
BLAKE2b-256 checksum
How to use checksums
48c5c3c29143bfa2bb56ac90c0cb35be43320ab22d0e14bcb76d043ee3cbe478
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.7.4

Release files / PyFixedReps_andnp-4.1.2-cp310-cp310-macosx_11_0_arm64.whl

Download URL PyFixedReps_andnp-4.1.2-cp310-cp310-macosx_11_0_arm64.whl
Size 254.2 kB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
91de4237359d2574bae38451f5fa21485c3a8373c43f5642ecadfb2f175b94b0
BLAKE2b-256 checksum
How to use checksums
4542a060a45ab66ab277b8cbbb73ca1a35d68a2368035d9e5bd52141476dc2a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.7.4

Release files / PyFixedReps_andnp-4.1.2-cp310-cp310-macosx_10_12_x86_64.whl

Download URL PyFixedReps_andnp-4.1.2-cp310-cp310-macosx_10_12_x86_64.whl
Size 260.0 kB
Tags CPython 3.10 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
db2826cfc6812f7bde61bfe9de424dfe252e7ebeeb317eeeb80e056bf76819da
BLAKE2b-256 checksum
How to use checksums
5554568c890f954972b5d9f80a59c0a537052ff27c7b1e8e1485a657c234dba7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.7.4

Release history Release notifications | RSS feed

This release

4.1.2 This release

13 release files

4.1.0

2 release files

4.0.2

2 release files

4.0.1

2 release files

4.0.0

2 release files

3.0.1

2 release files

2.0.0

2 release files

1.0.0

2 release files

0.0.5

2 release files

0.0.4

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page