MCPcopy Create free account
hub / github.com/ddbourgin/numpy-ml / tiles

Function tiles

numpy_ml/rl_models/tiles/tiles3.py:90–103  ·  view source on GitHub ↗

returns num-tilings tile indices corresponding to the floats and ints

(ihtORsize, numtilings, floats, ints=[], readonly=False)

Source from the content-addressed store, hash-verified

88
89
90def tiles(ihtORsize, numtilings, floats, ints=[], readonly=False):
91 """returns num-tilings tile indices corresponding to the floats and ints"""
92 qfloats = [floor(f * numtilings) for f in floats]
93 Tiles = []
94 for tiling in range(numtilings):
95 tilingX2 = tiling * 2
96 coords = [tiling]
97 b = tiling
98 for q in qfloats:
99 coords.append((q + b) // numtilings)
100 b += tilingX2
101 coords.extend(ints)
102 Tiles.append(hashcoords(coords, ihtORsize, readonly))
103 return Tiles
104
105
106def tileswrap(ihtORsize, numtilings, floats, wrapwidths, ints=[], readonly=False):

Callers 1

encode_obs_as_tileFunction · 0.90

Calls 1

hashcoordsFunction · 0.85

Tested by

no test coverage detected