Fuzzy Naive Cartographer
The "model" part of a model-based reinforcement learning algorithm.
Installation
Pull down the FNC repository. At the command line:
uv add naive-cartographer
Usage
The FNC class Naive Cartographer is intended to be used in tandem with a planner (not included) to build a reinforcement learning agent. At each time step
- The FNC makes a prediction
- The planner uses that prediction to choose an action
- The FNC registers the action selection
The outline of an agent class looks like this:
from cartographer import NaiveCartographer as Model
class Agent
def __init__(self, n_sensors, n_actions):
model = Model(n_sensors=n_sensors, n_actions=n_actions)
planner = ...
def step(self, sensors, reward):
predictions, rewards, uncertainties = model.predict(sensors, reward)
actions = planner.choose_actions(predictions, rewards, uncertainties)
model.update_actions(actions)
return actions
Testing
Run some unit tests with
uv run pytest
About
A Fuzzy Naive Cartographer (FNC) builds a Markov Decision Process-like model of its world in the form of a set of sequences. Sequences are of the form of state-action-state as in MDPs. Here they're also referred to as feature-action-outcome sequences, to disambiguate the before- and after-state.
FNC builds a value function too. It creates a set of feature-action pairs and associates a reward with each. This is analogous to the state-action value functions of Q-learning.
A model and a value function allow for prediction and planning. Knowing the current active features and recent actions, both the reward and the resulting features can be anticipated.
Technically FNC is just the "model" part of a model-based RL algorithm. It needs to paired with a planner, some element that will choose an action or goal, to be a complete RL algorithm. There are some rudimentary planners included with this module to get you up and running.
There is more detail in the white paper at https://brandonrohrer.com/cartographer
Release files for naive-cartographer 3.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| naive_cartographer-3.0.1.tar.gz | 29.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| naive_cartographer-3.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 39.9 kB
Release files / naive_cartographer-3.0.1.tar.gz
| Download URL | naive_cartographer-3.0.1.tar.gz |
|---|---|
| Size | 29.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ed40e7149784ddf1cae6cf9aaf28b51360a87dd44b29a50e7a179452a2b6c7a1
|
|
BLAKE2b-256 checksum How to use checksums |
df6aa9de525b0ef3ed971029d6a236b6b0c5750dca4476540ce2bd1ce40c90b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.1
|
Release files / naive_cartographer-3.0.1-py3-none-any.whl
| Download URL | naive_cartographer-3.0.1-py3-none-any.whl |
|---|---|
| Size | 10.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b8539ecb96d1d79fbf530fb65fe847716d2e9de1d8300012a4480dcd620bb45c
|
|
BLAKE2b-256 checksum How to use checksums |
a5a2363d41e3be7ef19c300b775f07ef81efbd350dcf0b5c699b95ed88ad0426
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.1
|