Tile Coding in Python

by JS

While I’m posting implementations of useful learning algorithms I might as well include something from the archives, newly uploaded to gist. This CMAC/Tile Coding implementation is a bit longer than most gists, but half the code is a pair of fully working examples of the CMAC in operation. This particular CMAC implementation exploits Python dictionaries to get hashing for free, something that needs to be done explicitly in other implementations (e.g. Sutton’s tile coding example).